MantisBT - ITK
View Issue Details
0008323ITKpublic2008-12-22 11:562009-03-11 10:03
Bradley Lowekamp 
Bradley Lowekamp 
normalfeatureN/A
closedfixed 
 
ITK-3-12 
0008323: An Implementation of streaming for ImageFileWriter with collaboration from ImageIOBase
Attached is a patch which include updates to ImageFileWriter, ImageIOBase, and itkMetaImageIO.

A virtual method was added to ImageIOBase to generate RegionsSplitters specific for a ImageIO object. MetaImageIO got a implementation of this.

The way ImageFileWriter executes the pipeline was modified to drive streaming. Some correction and miss matching tolerance was added to passing buffers to ImageIO.

Before this patch itkMetaImageStreamingWriterIOTest2 was passing with incorrect/blank output.

Luis gave the following description of what needed to be done (and I did it):
The design proposal for implementing this feature is to move
(copy/paste) part of the code that you find in the itkStreamingImageFilter (in Code/BasicFilters) to the
itkImageFileWriter class.

In particular, the proposal is to use the itkImageRegionSplitter
inside the ImageFileWriter.

During the design discussions, one of the issues that came up
is that only the specific ImageIO classes are qualified to know
what would be the appropriate way to split the data in order to
match the type of blocks that the output image file format can
manage (e.g. DICOM can only stream slices).


Therefore, the suggested design is that the ImageFileWriter
will ask the ImageIO class to provide a specific instance of
an itkImageRegionSplitter, and then it will use it in a for
loop for generating sub-regions of the image, and request
them from the preceding image filters.

Until this is implemented, then your best options, is to do
just what you are doing: using the itkStreamingImageFilter
just before the ImageFileWriter. The drawback of course is
that you have to whole in memory the full-size output image
before being able to write it to disk.

No tags attached.
related to 0008333closed Bradley Lowekamp MetaImageIO does not read correctly stream with non-uniform image spacing 
related to 0008369closed Bradley Lowekamp Some VectorImage filters set output information in AllocateOutputs 
diff StreamingFileWriter.diff (15,066) 2008-12-22 11:56
https://public.kitware.com/Bug/file/1938/StreamingFileWriter.diff
Issue History
2008-12-22 11:56Bradley LowekampNew Issue
2008-12-22 11:56Bradley LowekampFile Added: StreamingFileWriter.diff
2008-12-22 12:02Bradley LowekampNote Added: 0014416
2008-12-30 14:56Bradley LowekampNote Added: 0014453
2009-01-13 09:53Bradley LowekampNote Added: 0014543
2009-01-13 10:23Bradley LowekampNote Added: 0014544
2009-01-13 10:38Bradley LowekampRelationship addedrelated to 0008333
2009-01-13 10:56Bradley LowekampRelationship addedrelated to 0008369
2009-01-13 10:57Bradley LowekampStatusnew => assigned
2009-02-05 13:19Bradley LowekampAssigned To => Bradley Lowekamp
2009-02-18 12:57Bradley LowekampNote Added: 0015147
2009-02-18 12:57Bradley LowekampStatusassigned => resolved
2009-02-18 12:57Bradley LowekampResolutionopen => fixed
2009-03-11 10:03Bradley LowekampStatusresolved => closed
2009-03-11 10:03Bradley LowekampFixed in Version => ITK-3-12

Notes
(0014416)
Bradley Lowekamp   
2008-12-22 12:02   
Basic usage for a MetaIO file:

reader->SetUseStreaming(true)
writer->SetInput( reader->GetOutput() );
writer->SetNumberOfStreamDivisions(numberOfDataPieces);
writer->SetUseStreaming(true);
writer->Update();
(0014453)
Bradley Lowekamp   
2008-12-30 14:56   
This is an experimental build with these changes:

http://www.cdash.org/CDash/buildSummary.php?buildid=240632 [^]
(0014543)
Bradley Lowekamp   
2009-01-13 09:53   
This was discussed at the NAMIC project week:
http://www.itk.org/Wiki/Proposals:Adding_Streaming_Support_in_ITK_Image_Writing [^]
(0014544)
Bradley Lowekamp   
2009-01-13 10:23   
The revised design was commited
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageFileWriter.h.diff?cvsroot=Insight&r1=1.20&r2=1.21 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageFileWriter.txx.diff?cvsroot=Insight&r1=1.56&r2=1.57 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageIOBase.cxx.diff?cvsroot=Insight&r1=1.80&r2=1.81 [^]
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkImageIOBase.h.diff?cvsroot=Insight&r1=1.49&r2=1.50 [^]
(0015147)
Bradley Lowekamp   
2009-02-18 12:57   
Streaming writing is now working