[ITK-users] Loading a specifing region of an image from disk

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Nov 4 09:31:39 EST 2014


Discussion inline below:

On Nov 3, 2014, at 5:58 PM, Pol Monsó Purtí <lluna.nova at gmail.com> wrote:

> I've read the article early this afternoon and I found it very good and encouraging. Specially "The other difference is that the reader fully supports streaming and only reads the required region from the file."
>  
> That is exactly what we need. I was just wondering wether it splitted the volume and took the chunks that intersected with the requested one or if it really just loaded the requested one. I replicated that code taking out the processing and just having a reader and a writer, but I didn't know how to test that indeed it was just loading that requested piece.

For the ImageIO file formats I wrote which are just headers with binary data, they can read an arbitrary ImageIORegion and don't read any more. Practically however, its extremely in efficient to not read complete contiguous scanlines as there is to much random access and it slows down. For Tiff ( similar to some JPEG2000 formats), the image is encoded as strips or tiles. The underlying libtiff library can only easily decode these entire chunks, so the plan is that the requested region will be expanded by the image io to the union of the strips/tiles needed to read the requested region.
> 
> 
> > 2.- Will the pipeline only load the requested region, including the reader?
> 
> The pipeline has a series of steps which include propagating a requested region, and giving each filter the opportunity to enlarge this region. I have frequently assemble pipelines which perform out-of-core processing as you desire. However all filters in the pipeline must support streaming, and not enlarging the requested region to the largest possible region.
> 
> 
> Yes, I've seen that not many support streaming. But in our case we would just need a reader that can read a specific region. 
>  
> Additionally the ImageIO for the reader and writer must also support streaming. There are several ImageIO's which support streaming reading (MRC,MetaIO, VTK, Nift, JPEG2000, etc), I believe that only MRC, VTK and MetaIO  fully support it for writing. So TIFF is currently not there.
> 
> Yeah, we were thinking on using HDF5, but maybe you have some idea on what would be best. That's another topic thought.

I find the the header + raw image data are rather efficient for random access of the whole image. These files are archived with compression, and decompressed when needed. 

> 
> Recently I have been working on improving the itkTIFFImageIO [2], and have performance gains of upto 3-5X from the prior version. However, I haven't gotten to adding streaming yet. It's is a back burner project for me to add support for stream reading to it, so that may be coming shortly ( this poking helps ). However, adding stream and paste writing is not planned.
> 
> 
> Good work! 3-5x! That might be of interest actually for something else we have. Can we pull your code?

Its in ITK master please test :)
> 
> For this case you should add in an ExtractImageFilter, or a CropImageFilter.
> 
> 
> But if I use Extract or Crop, the reader is still loading the full image to disk, isn't it?

Nope. The only the sub-region is requested to the reader, and if the reader supports streaming that region will be read.

I'd suggest reading section 13.3 of the ITK Software guide a couple times. And then assemble the pipeline Reader->Extract, and printing the output of each filter for each step in Extract->UpdateOutputInformation(), Extract->PropagateRequestedRegion() and then Extract->UpdateOutputData(). This will help you to under stand the step in the pipeline execution.

Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20141104/ecb94c4e/attachment.html>


More information about the Insight-users mailing list