[Insight-users] Writing and Streaming

Luis Ibanez luis.ibanez at kitware.com
Sat Dec 6 18:25:23 EST 2008



Hi Brad,


The functionality of Streaming is not fully implemented
on the ImageFileWriter.


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.


  Please let us know if you have further questions,


     Thanks


        Luis


-------------------------
Bradley Lowekamp wrote:
> Greetings all!
> 
> I am trying to stream my data set. I see that MetaIO supports streaming 
> for reading and writing. But I don't seem to be able to use it for 
> writing. I am trying to stream my 13GB data set from a ImageFileReader 
> through a ShrinkImageFilter then write is out with a ImageFileWriter. If 
> I replace the writer with a StreamingImageFilter it works great, the 
> reader streams and everything.
> 
> To get the writer to stream (or not) I am doing this:
> 
>  shrinker->UpdateOutputInformation();
>  RGBVolumeType::RegionType outputRegion = 
> shrinker->GetOutput()->GetLargestPossibleRegion();
> 
>   itk::ImageRegionSplitter<3>::Pointer splitter = 
> itk::ImageRegionSplitter<3>::New();
>   numberOfSplits = splitter->GetNumberOfSplits(outputRegion, 
> numberOfSplits);
> 
>   writer->SetFileName( outputFilePN.GetPathName()); 
>   writer->SetInput(shrinker->GetOutput());
>   for(unsigned int i = 0; i < numberOfSplits; ++i) {
>       RGBVolumeType::RegionType streamRegion = splitter->GetSplit(i, 
> numberOfSplits, outputRegion);
>       ioRegion = streamRegion; // sudo code
> 
>       writer->SetIORegion(ioRegion);
>       writer->Update();
>     }
> 
> 
> Is this the correct approach? Does anyone have an example of streaming 
> writing? 
> 
> I think I am going to dig though the ImageFileWriter now to see what are 
> the updates going on in the pipeline execution. I still a bit fuzzy on 
> these details, so  may miss something.
> 
> Please let me know of any suggestions.
> 
> Thanks,
> Brad
> 
> ========================================================
> 
> Bradley Lowekamp  
> 
> Lockheed Martin Contractor for
> 
> Office of High Performance Computing and Communications
> 
> National Library of Medicine 
> 
> blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users


More information about the Insight-users mailing list