[ITK-users] Reading a very large image

Pol Monsó Purtí lluna.nova at gmail.com
Tue Mar 3 04:35:14 EST 2015


Hello Vikram,


I followed the same road a few months ago, read the kind and insightful
answer of Bradley here:
http://public.kitware.com/pipermail/community/2014-November/007678.html

tl; dr
@Bradley is working on streaming the tiff reader, but it isn't ready yet
(right? I apologize for not having had the time to test it). So indeed,
your reader is reading the whole image. Try using mha instead if possible.


2015-03-03 8:19 GMT+01:00 Vikram Venkatraghavan <88.vikram at gmail.com>:

> Hello,
>
> I am relatively new to ITK. I am trying to read a very large TIFF image
> using the IO streaming functionality in ITK. I am reading a very small
> portion of the image and I still end up getting memory allocation error. I
> get the feeling, the code is trying to read the entire image at once, even
> after specifying the region to read. Can someone please tell what is wrong
> the following code snippet ?
>
> typedef itk::RGBPixel< unsigned char >  RGBPixelType;
> typedef itk::Image< RGBPixelType, 2 >   RGB2DImageType;
> typedef itk::ImageFileReader<RGB2DImageType> RGBReaderType;
>
> itk::TIFFImageIO::Pointer tiffIO = itk::TIFFImageIO::New();
> tiffIO->SetPixelType(itk::ImageIOBase::RGBA);
>
> RGB2DImageType::SizeType sz;
> RGB2DImageType::IndexType idx;
> sz[0]=128; sz[1]=128;
> idx[0]=0; idx[1]=0;
>
> itk::ImageIORegion region(2);
> region.SetSize(0,sz[0]);
> region.SetSize(1,sz[1]);
> region.SetIndex(0,idx[0]);
> region.SetIndex(1,idx[1]);
> tiffIO->SetIORegion(region);
>
> RGBReaderType::Pointer reader = RGBReaderType::New();
> reader->SetFileName("V:\\TiFF_Image.tiff");
> reader->SetImageIO(tiffIO);
> reader->SetUseStreaming(1);
> reader->Update();
>
> Thanks in advance.
>
> Regards,
> Vikram
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20150303/55aeb222/attachment.html>


More information about the Insight-users mailing list