Proposals:Adding Streaming Support in ITK Image Writing

From KitwarePublic
Jump to navigationJump to search

Background

This page describes the changes that are needed in ITK ImageIO classes and the ImageFileWriter in order to support streaming.

Streaming infrastructure is already available for Reading. However only a couple of ImageIO classes fully implement support for this functionality.

This page host discussions on how streaming could be implemented for writing images. The nuance is that the ImageFileWriter should become the class that selects the image pieces and request them in sequence to the pipeline. This should be done, presumably, in collaboration with the ImageIO class that manage the image file format at hand.

Current Implementation

The current implementation has the following methods:

void ImageFileWriter::SetIORegion(const ImageIORegion & region);
virtual void ImageIOBase::SetIORegion (ImageIORegion _arg);
virtual void ImageIOBase::SetUseStreamedWriting (bool _arg);

These methods allows two types of streaming, updating a small subregion, and iteratively streaming the entire image.

The problem with the way it is currently written is that its a rather low level method and not robust. Specifically the pipeline must be manually configured and executed before the specific ImageIORegion is written. If the incoming Image to ImageFileWrite does not match the expected region ( i.e. the incoming filer does not stream) erroneous results will be generated. In addition the user must select an appropriate set of regions which are compatible with the ImageIO class and iterate the pipeline over those.

itkMetaImageStreamingWriterIOTest.cxx contains a sample usage.

Challenges

  • Maintaining ROI information with the image (disk ROI != image->region)
  • Inserting into an existing image on disk that has a different pixel type
  • Extending the size of an image file on disk
  • Compression (zseek) - convert to uncompressed and then insert (and then recompress?)
  • itkImageToVTKImageFilter support

Classes

ImageFileWriter

ImageIO

Specific Formats

MetaImage

Nifti

MINC2