Hi, David,<div> I'm afraid it doesn't work, the codes are following for 16bit nrrd. The memory still increases up to the size of the image not the region of image I defined. Is it due to the image type or something? The codes are following:</div>
<div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>UShortImageType::IndexType index;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>index[0] = startX;</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>index[1] = startY;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>index[2] = startZ;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>UShortImageType::SizeType size;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>size[0] = sizeX;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>size[1] = sizeY;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>size[2] = sizeZ;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>UShortImageType::RegionType region;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>region.SetIndex( index);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>region.SetSize( size);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ushortImageReader::Pointer reader = ushortImageReader::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>reader->SetFileName(fileName);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>reader->GetOutput()->SetRequestedRegion(region);</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>try</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>reader->Update();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>catch ( itk::ExceptionObject &err)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cout << "Error in bin_image_writer: " << err << std::endl; </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
</div><div><br></div><div><br></div><div>Yan<br><br><div class="gmail_quote">On Tue, Aug 14, 2012 at 4:08 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div class="im">On Tue, Aug 14, 2012 at 4:59 PM, yan xu <span dir="ltr"><<a href="mailto:xy198908@gmail.com" target="_blank">xy198908@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi, all<div> I'm facing a problem to read only portion of the image to test the algorithm since the whole image is too big for the memory. I have tried using the itk pipeline through extractimage filter, but I don't think it works. The memory still goes larger and larger. My image type is 16bit nrrd. What I hope is that the only the desired region of the image is loaded into the memory. Is there a solution for that? Thank you!</div>
</blockquote><div><br></div></div><div>I've never done it, but you could try this:</div><div><br></div><a href="http://www.itk.org/Wiki/ITK/Examples/SimpleOperations/RequestedRegion" target="_blank">http://www.itk.org/Wiki/ITK/Examples/SimpleOperations/RequestedRegion</a><br clear="all">
<br>on your ImageReader.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_quote"><br><div>David</div></div>
</font></span></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>