niftynet.engine.sampler_grid module¶
Sampling image by a sliding window.
-
class
GridSampler
(reader, data_param, batch_size, spatial_window_size=(), window_border=(), queue_length=10)[source]¶ Bases:
niftynet.layer.base_layer.Layer
,niftynet.engine.image_window_buffer.InputBatchQueueRunner
This class generators ND image samples with a sliding window.
-
grid_spatial_coordinates
(subject_id, img_sizes, win_sizes, border_size)[source]¶ 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
- 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: - subject_id – integer value indicates the position of of this
image in