niftynet.engine.windows_aggregator_base module

This module is used to cache window-based network outputs,
form a image-level output, write the cached the results to hard drive
class niftynet.engine.windows_aggregator_base.ImageWindowsAggregator(image_reader=None)

Bases: object

Image windows are retrieved and analysed by the tensorflow graph, this windows aggregator receives output window data in numpy array. To access image-level information the reader is needed.

static crop_batch(window, location, border)

This utility function removes two borders along each spatial dim of the output image window data, adjusts window spatial coordinates accordingly.

Parameters:
  • window
  • location
  • border
Returns:

decode_batch(*args, **kwargs)

The implementation of caching and writing batch output goes here. This function should return False when the location vector is stopping signal, to notify the inference loop to terminate.

Parameters:
  • args
  • kwargs
Returns:

True if more batch data are expected, False otherwise

image_id

Index of the image in the output image list maintained by image reader :return: integer of the position in image list

input_image

Get the corresponding input image of these batch data. So that the batch data can be stored correctly in terms of interpolation order, orientation, pixdims :return: an image object from image reader