andreped commited on
Commit
b437043
1 Parent(s): d1ff5ab

refactoring, adding informative prints for liver vessel segmentation in log, which supports verbose mode

Browse files
Files changed (1) hide show
  1. livermask/utils/process.py +2 -2
livermask/utils/process.py CHANGED
@@ -135,7 +135,7 @@ def vessel_segmenter(curr, output, cpu, verbose, multiple_flag, liver_mask, name
135
  # read config
136
  config = Config(yaml.safe_load(open("./configs/base.yml")))
137
 
138
- # read data
139
  nib_volume = nib.load(curr)
140
  new_spacing = [1., 1., 1.]
141
  resampled_volume = resample_to_output(nib_volume, new_spacing, order=1)
@@ -163,6 +163,7 @@ def vessel_segmenter(curr, output, cpu, verbose, multiple_flag, liver_mask, name
163
  prediction_map = np.zeros((ze + config.patch['patchside'], ye + config.patch['patchside'], xe + config.patch['patchside']))
164
  probability_map = np.zeros((config.unet['number_of_label'], ze+config.patch['patchside'], ye + config.patch['patchside'], xe + config.patch['patchside']))
165
 
 
166
  # Patch loop
167
  for s in tqdm(range(xm * ym * zm), ascii=True, desc='Patch loop', disable=not verbose):
168
  xi = int(s % xm) * config.patch['patchside']
@@ -192,7 +193,6 @@ def vessel_segmenter(curr, output, cpu, verbose, multiple_flag, liver_mask, name
192
 
193
  prediction_map[zi:zi + config.patch['patchside'], yi:yi + config.patch['patchside'], xi:xi + config.patch['patchside']] = prediction_patch[0, :, :, :]
194
 
195
- print('Save image')
196
  probability_map = probability_map[:, :ze, :ye, :xe]
197
  prediction_map = prediction_map[:ze, :ye, :xe]
198
 
 
135
  # read config
136
  config = Config(yaml.safe_load(open("./configs/base.yml")))
137
 
138
+ log.info("resize back...")
139
  nib_volume = nib.load(curr)
140
  new_spacing = [1., 1., 1.]
141
  resampled_volume = resample_to_output(nib_volume, new_spacing, order=1)
 
163
  prediction_map = np.zeros((ze + config.patch['patchside'], ye + config.patch['patchside'], xe + config.patch['patchside']))
164
  probability_map = np.zeros((config.unet['number_of_label'], ze+config.patch['patchside'], ye + config.patch['patchside'], xe + config.patch['patchside']))
165
 
166
+ log.info("predicting...")
167
  # Patch loop
168
  for s in tqdm(range(xm * ym * zm), ascii=True, desc='Patch loop', disable=not verbose):
169
  xi = int(s % xm) * config.patch['patchside']
 
193
 
194
  prediction_map[zi:zi + config.patch['patchside'], yi:yi + config.patch['patchside'], xi:xi + config.patch['patchside']] = prediction_patch[0, :, :, :]
195
 
 
196
  probability_map = probability_map[:, :ze, :ye, :xe]
197
  prediction_map = prediction_map[:ze, :ye, :xe]
198