def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              window_border=(),
              interp_order=0):
     ImageWindowsAggregator.__init__(self, image_reader=image_reader)
     self.name = name
     self.output_path = os.path.abspath(output_path)
     self.window_border = window_border
     self.output_interp_order = interp_order
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              window_border=(),
              interp_order=0):
     ImageWindowsAggregator.__init__(self, image_reader=image_reader)
     self.name = name
     self.image_out = None
     self.output_path = os.path.abspath(output_path)
     self.window_border = window_border
     self.output_interp_order = interp_order
 def __init__(self,
              image_reader=None,
              output_path=os.path.join('.', 'output'),
              prefix='_niftynet_generated'):
     ImageWindowsAggregator.__init__(
         self, image_reader=image_reader, output_path=output_path)
     self.output_path = os.path.abspath(output_path)
     self.inferred_csv = os.path.join(self.output_path, 'inferred.csv')
     self.output_id = {'base_name': None, 'relative_id': 0}
     self.prefix = prefix
     if os.path.exists(self.inferred_csv):
         os.remove(self.inferred_csv)
示例#4
0
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              postfix='_niftynet_out'):
     ImageWindowsAggregator.__init__(
         self, image_reader=image_reader, output_path=output_path)
     self.name = name
     self.output_interp_order = 0
     self.postfix = postfix
     self.csv_path = os.path.join(self.output_path, self.postfix+'.csv')
     if os.path.exists(self.csv_path):
         os.remove(self.csv_path)
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              window_border=(),
              interp_order=0,
              prefix='_niftynet_out'):
     ImageWindowsAggregator.__init__(
         self, image_reader=image_reader, output_path=output_path)
     self.name = name
     self.window_border = window_border
     self.output_interp_order = interp_order
     self.prefix = prefix
 def __init__(self,
              image_reader=None,
              output_path=os.path.join('.', 'output'),
              prefix='_niftynet_generated'):
     ImageWindowsAggregator.__init__(self,
                                     image_reader=image_reader,
                                     output_path=output_path)
     self.output_path = os.path.abspath(output_path)
     self.inferred_csv = os.path.join(self.output_path, 'inferred.csv')
     self.output_id = {'base_name': None, 'relative_id': 0}
     self.prefix = prefix
     if os.path.exists(self.inferred_csv):
         os.remove(self.inferred_csv)
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              prefix='_niftynet_out'):
     ImageWindowsAggregator.__init__(
         self, image_reader=image_reader, output_path=output_path)
     self.name = name
     self.output_interp_order = 0
     self.prefix = prefix
     self.csv_path = os.path.join(self.output_path, self.prefix+'.csv')
     if os.path.exists(self.csv_path):
         os.remove(self.csv_path)
示例#8
0
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              window_border=(),
              interp_order=0,
              postfix='_niftynet_out'):
     ImageWindowsAggregator.__init__(self,
                                     image_reader=image_reader,
                                     output_path=output_path)
     self.name = name
     self.window_border = window_border
     self.output_interp_order = interp_order
     self.postfix = postfix
示例#9
0
 def __init__(self,
              image_reader,
              name='image',
              output_path=os.path.join('.', 'output'),
              window_border=(),
              interp_order=0,
              postfix='niftynet_out',
              fill_constant=0.0):
     ImageWindowsAggregator.__init__(self,
                                     image_reader=image_reader,
                                     output_path=output_path)
     self.name = name
     self.image_out = None
     self.csv_out = None
     self.window_border = window_border
     self.output_interp_order = interp_order
     self.postfix = postfix
     self.fill_constant = fill_constant
示例#10
0
 def __init__(self,
              image_reader=None,
              output_path=os.path.join('.', 'output')):
     ImageWindowsAggregator.__init__(self, image_reader=image_reader)
     self.output_path = os.path.abspath(output_path)
     self.output_id = {'base_name': None, 'relative_id': 0}
coords = []
with tf.Session() as sess:
    for _ in range(20):
        uniform_windows = sess.run(next_window)
        coords.append(uniform_windows['MR_location'])
coords = np.concatenate(coords, axis=0)
vis_coordinates(image_2d, coords, 'output/uniform.png')

###
# create & show all grid samples
###
grid_sampler = GridSampler(reader, spatial_window_size, window_border=border)
next_grid = grid_sampler.pop_batch_op()
coords = []
with tf.Session() as sess:
    while True:
        window = sess.run(next_grid)
        if window['MR_location'][0, 0] == -1:
            break
        coords.append(window['MR_location'])
coords = np.concatenate(coords, axis=0)
vis_coordinates(image_2d, coords, 'output/grid.png')

###
# create & show cropped grid samples (in aggregator)
###
n_window = coords.shape[0]
dummy_window = np.zeros((n_window, 800, 800, 1, 1))
_, coords = IA.crop_batch(dummy_window, coords, border=border)
vis_coordinates(image_2d, coords, 'output/grid_cropped.png')
 def __init__(self,
              image_reader=None,
              output_path=os.path.join('.', 'output')):
     ImageWindowsAggregator.__init__(self, image_reader=image_reader)
     self.output_path = os.path.abspath(output_path)
     self.output_id = {'base_name': None, 'relative_id': 0}