niftynet.engine.windows_aggregator_identity module

windows aggregator saves each item in a batch output as an image.

class WindowAsImageAggregator(image_reader=None, output_path='./output', postfix='_niftynet_generated')[source]

Bases: niftynet.engine.windows_aggregator_base.ImageWindowsAggregator

This class saves each item in a batch output to images, the output filenames can be defined in three ways:

1. location is None (input image from a random distribution): a uuid is generated as output filename.

2. the length of the location array is 2: (indicates output image is from an interpolation of two input images):

  • location[batch_id, 0] is used as a base_name,
  • location[batch_id, 0] is used as a relative_id

output file name is "{}_{}"%(base_name, relative_id).

3. the length of the location array is greater than 2: (indicates output image is from single input image) location[batch_id, 0] is used as the file name

decode_batch(window, location=None)[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.

Parameters:
  • args
  • kwargs
Returns:

True if more batch data are expected, False otherwise