fd8ca0c975e380dfcd7239408258b5852be33f06,niftynet/engine/sampler_grid.py,GridSampler,layer_op,#GridSampler#,54
Before Change
// fill output window array
image_array = output_dict[
self.window.image_data_placeholder(name)]
for (i, location) in enumerate(location_array[:, 1:]):
x_, y_, z_, _x, _y, _z = location
try:
image_array[i, ...] = \
data[name][x_:_x, y_:_y, z_:_z, ...]
except ValueError:
tf.logging.fatal(
"dimensionality miss match in input volumes, "
"please specify spatial_window_size with a "
"3D tuple and make sure each element is "
"smaller than the image length in each dim.")
raise
yield output_dict
def rand_spatial_coordinates(subject_id, img_sizes, win_sizes, n_samples):
After Change
break
image_shapes = {mod: data[mod].shape for mod in self.window.fields}
static_window_shapes = self.window.match_image_shapes(image_shapes)
coordinates = grid_spatial_coordinates(
image_id, image_shapes, static_window_shapes, self.border_size)
n_locations = coordinates.values()[0].shape[0]
for i in range(n_locations):
// initialise output dict
output_dict = {}
for name in list(data):
assert coordinates[name].shape[0] == n_locations, \
"different number of grid samples from the input" \
"images, don"t know how to combine them in the queue"
x_, y_, z_, _x, _y, _z = coordinates[name][i, 1:]
try:
image_window = data[name][x_:_x, y_:_y, z_:_z, ...]
except ValueError:
tf.logging.fatal(
"dimensionality miss match in input volumes, "
"please specify spatial_window_size with a "
"3D tuple and make sure each element is "
"smaller than the image length in each dim.")
raise
// fill output dict with data
coordinates_key = self.window.coordinates_placeholder(name)
image_data_key = self.window.image_data_placeholder(name)
output_dict[coordinates_key] = coordinates[name][[i], ...]
output_dict[image_data_key] = image_window[np.newaxis, ...]
yield output_dict
def grid_spatial_coordinates(subject_id, img_sizes, win_sizes, border_size):
This function generates all coordinates of feasible windows, with
step sizes specified in grid_size parameter
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: NifTK/NiftyNet
Commit Name: fd8ca0c975e380dfcd7239408258b5852be33f06
Time: 2017-08-12
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/sampler_grid.py
Class Name: GridSampler
Method Name: layer_op
Project Name: aleju/imgaug
Commit Name: b0bdcbfdabcae1933980925c8f2438cbb2359a49
Time: 2019-09-13
Author: kontakt@ajung.name
File Name: imgaug/augmenters/geometric.py
Class Name: ElasticTransformation
Method Name: _augment_images
Project Name: OpenNMT/OpenNMT-py
Commit Name: bc1351d47d9fe83bc6c7830a8563ddb874953ed4
Time: 2019-01-09
Author: benzurdopeters@gmail.com
File Name: onmt/train_single.py
Class Name:
Method Name: main