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 ImageWindowsAggregator(image_reader=None, output_path='.')[source]

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.


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.

Returns:an image object from image reader

Index of the image in the output image list maintained by image reader.

Returns:integer of the position in image list
decode_batch(*args, **kwargs)[source]

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.

  • args
  • kwargs

True if more batch data are expected, False otherwise

static crop_batch(window, location, border=None)[source]

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

  • window
  • location
  • border

log_inferred(subject_name, filename)[source]

This function writes out a csv of inferred files

  • subject_name – subject name corresponding to output
  • filename – filename of output