Hi, Matt,<div> According to CanStreamRead, right now only MetaImageIO and VTKImageIO are streamable right? What does it need to be a streaming reader? Thank you!</div><div> Yan</div><div><br><div class="gmail_quote">
On Tue, Aug 14, 2012 at 5:03 PM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Yan,<br>
<br>
Streaming will only occur if the filter is streamable and it has been<br>
implemented as a streamable filter. Unfortunately the NrrdImageIO is<br>
not implemented as a streaming reader at this time, so it will always<br>
load the entire image to memory. For more information, see the<br>
CanStreamRead method on itk::ImageIOBase.<br>
<br>
HTH,<br>
Matt<br>
<div><div class="h5"><br>
On Tue, Aug 14, 2012 at 9:22 PM, yan xu <<a href="mailto:xy198908@gmail.com">xy198908@gmail.com</a>> wrote:<br>
> Hi, David,<br>
> I'm afraid it doesn't work, the codes are following for 16bit nrrd.<br>
> The memory still increases up to the size of the image not the region of<br>
> image I defined. Is it due to the image type or something? The codes are<br>
> following:<br>
><br>
> UShortImageType::IndexType index;<br>
> index[0] = startX;<br>
> index[1] = startY;<br>
> index[2] = startZ;<br>
><br>
> UShortImageType::SizeType size;<br>
> size[0] = sizeX;<br>
> size[1] = sizeY;<br>
> size[2] = sizeZ;<br>
><br>
> UShortImageType::RegionType region;<br>
> region.SetIndex( index);<br>
> region.SetSize( size);<br>
><br>
> ushortImageReader::Pointer reader = ushortImageReader::New();<br>
> reader->SetFileName(fileName);<br>
> reader->GetOutput()->SetRequestedRegion(region);<br>
><br>
> try<br>
> {<br>
> reader->Update();<br>
> }<br>
> catch ( itk::ExceptionObject &err)<br>
> {<br>
> std::cout << "Error in bin_image_writer: " << err << std::endl;<br>
> }<br>
><br>
><br>
> Yan<br>
><br>
><br>
> On Tue, Aug 14, 2012 at 4:08 PM, David Doria <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>> wrote:<br>
>><br>
>> On Tue, Aug 14, 2012 at 4:59 PM, yan xu <<a href="mailto:xy198908@gmail.com">xy198908@gmail.com</a>> wrote:<br>
>>><br>
>>> Hi, all<br>
>>> I'm facing a problem to read only portion of the image to test the<br>
>>> algorithm since the whole image is too big for the memory. I have tried<br>
>>> using the itk pipeline through extractimage filter, but I don't think it<br>
>>> works. The memory still goes larger and larger. My image type is 16bit nrrd.<br>
>>> What I hope is that the only the desired region of the image is loaded into<br>
>>> the memory. Is there a solution for that? Thank you!<br>
>><br>
>><br>
>> I've never done it, but you could try this:<br>
>><br>
>> <a href="http://www.itk.org/Wiki/ITK/Examples/SimpleOperations/RequestedRegion" target="_blank">http://www.itk.org/Wiki/ITK/Examples/SimpleOperations/RequestedRegion</a><br>
>><br>
>> on your ImageReader.<br>
>><br>
>> David<br>
><br>
><br>
><br>
><br>
> --<br>
> Yan Xu<br>
> Research Assistant<br>
> Bio-Image Analytics Laboratory<br>
> Department of Electrical and Computer Engineering<br>
> University of Houston<br>
><br>
><br>
><br>
</div></div>> _____________________________________<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://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Yan Xu</div><div>Research Assistant</div><div><span>Bio-Image Analytics Laboratory</span>
</div>
<div>Department of Electrical and Computer Engineering</div>
<div>University of Houston<br></div>
<div> </div><br>
</div>