[ITK] [ITK-users] Reading a very large image

Vikram Venkatraghavan 88.vikram at gmail.com
Tue Mar 3 02:19:40 EST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150303/cb71d7c9/attachment.html>
-------------- next part --------------
_____________________________________
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


More information about the Community mailing list