<div dir="ltr"><div>Hello Vikram,<br><br><br></div><div>I followed the same road a few months ago, read the kind and insightful answer of Bradley here: <a href="http://public.kitware.com/pipermail/community/2014-November/007678.html">http://public.kitware.com/pipermail/community/2014-November/007678.html</a><br><br></div><div>tl; dr<br></div><div>@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.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-03 8:19 GMT+01:00 Vikram Venkatraghavan <span dir="ltr"><<a href="mailto:88.vikram@gmail.com" target="_blank">88.vikram@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div dir="ltr"><div><font color="#000000">Hello,</font></div><div><font color="#000000"><br></font></div><div><span style="color:rgb(0,0,0)">I am relatively new to ITK. </span><font color="#000000">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 ?</font></div><div><font color="#000000"><br></font></div><div><font color="#000000"><div>typedef itk::RGBPixel< unsigned char > RGBPixelType;</div><div>typedef itk::Image< RGBPixelType, 2 > RGB2DImageType;</div><div>typedef itk::ImageFileReader<RGB2DImageType> RGBReaderType;</div><div><br></div><div>itk::TIFFImageIO::Pointer tiffIO = itk::TIFFImageIO::New();</div><div>tiffIO->SetPixelType(itk::ImageIOBase::RGBA);</div><div><br></div><div>RGB2DImageType::SizeType sz;</div><div>RGB2DImageType::IndexType idx;</div><div>sz[0]=128; sz[1]=128;</div><div>idx[0]=0; idx[1]=0;</div><div><br></div><div>itk::ImageIORegion region(2);</div><div>region.SetSize(0,sz[0]);</div><div>region.SetSize(1,sz[1]);</div><div>region.SetIndex(0,idx[0]);</div><div>region.SetIndex(1,idx[1]);</div><div>tiffIO->SetIORegion(region);</div><div><br></div><div>RGBReaderType::Pointer reader = RGBReaderType::New();</div><div>reader->SetFileName("V:\\TiFF_Image.tiff");</div><div>reader->SetImageIO(tiffIO);</div><div>reader->SetUseStreaming(1);<br></div><div>reader->Update();</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Regards,</div><div>Vikram</div></font></div>
<div></div></div></div>
</div>
<br>_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-users" target="_blank">http://public.kitware.com/mailman/listinfo/insight-users</a><br>
<br></blockquote></div><br></div>