niftynet.engine.sampler_grid module

sampling image by a sliding window

class niftynet.engine.sampler_grid.GridSampler(reader, data_param, batch_size, spatial_window_size=(), window_border=(), queue_length=10)

Bases: niftynet.layer.base_layer.Layer, niftynet.engine.image_window_buffer.InputBatchQueueRunner

This class generators ND image samples with a sliding window

layer_op()
niftynet.engine.sampler_grid.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

The border size changes the sampling locations but not the corresponding window sizes of the coordinates.

Parameters:subject_id – integer value indicates the position of of this

image in image_reader.file_list

Parameters:
  • img_sizes – a dictionary of image shapes, {input_name: shape}
  • win_sizes – a dictionary of window shapes, {input_name: shape}
  • border_size – size of padding on both sides of each dim
Returns: