Hi Sergio,<br><br>this is the solution. I'm ashamed that I didn't check this before. I solve the problem now.<br>Thanks for your hint!<br><br>Regards,<br>Melanie<br><br><div class="gmail_quote">2011/3/10 Sergio Vera <span dir="ltr"><<a href="mailto:sergio.vera@alma3d.com">sergio.vera@alma3d.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi...<div><br></div><div>You might be, however, using a <span style="font-family: 'courier new',monospace;">slice</span><font face="arial, helvetica, sans-serif"> value too big for your image.</font></div>
<div><font face="arial, helvetica, sans-serif">What are the values of slice and of <span style="font-family: 'courier new',monospace;">image->GetLargestPossibleRegion()?</span></font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">Sergio<br></font><br><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Mar 10, 2011 at 10:39 AM, Melanie Uks <span dir="ltr"><<a href="mailto:meluks2010@googlemail.com" target="_blank">meluks2010@googlemail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">Hi all,<br><br>I try to extract a slide of a 3D image with the ExtractImageFilter. I mainly used the code I found in the Software Guide under "7.7 Extracting Slices". I always get this error:<br>
<br><span style="color: rgb(255, 0, 0);"> itk::InvalidRequestedRegionError (0153BF38)</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> Location: "void __thiscall itk::DataObject::PropagateRequestedRegion(void) throw (class itk::InvalidRequestedRegionError)"</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> File: ..\..\InsightToolkit-3.16.0\Code\Common\itkDataObject.cxx</span><br style="color: rgb(255, 0, 0);">
<span style="color: rgb(255, 0, 0);"> Line:397</span><br style="color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);"> Description: Requested region is (at least partially outside the largest possible region.</span><br>
<br>The image is a global variable and used with several (itk) functions. One of those is the ExtractImageFilter.<br>This is the code:<br><br> <span style="font-family: courier new,monospace;"> typedef itk::Image<PixelType, 2> OutputImageType; //dimension</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> typedef itk::ExtractImageFilter<ImageType, OutputImageType> ExtractFilterType;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ExtractFilterType::Pointer extractFilter = ExtractFilterType::New();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ImageType::RegionType inputRegion = image->GetLargestPossibleRegion(); //image size</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ImageType::SizeType size = inputRegion.GetSize();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> size[1]=0; //y-Dimension wird gelöscht</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ImageType::IndexType start = inputRegion.GetIndex(); </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> start[1]=slice; //constant y-value</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> ImageType::RegionType desiredRegion; //region of the slide in the 3D inage</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> desiredRegion.SetSize(size);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> desiredRegion.SetIndex(start);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> extractFilter->SetExtractionRegion(desiredRegion); //add region to filter</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> extractFilter->SetInput(image); //Input: image</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> OutputImageType::Pointer outimage = OutputImageType::New();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> try</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> extractFilter->Update(); //filtering</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> outimage = extractFilter->GetOutput();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> catch(itk::ExceptionObject &err)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> std::cerr << "ExeptionObject caught!" << std::endl;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> std::cerr << "Image2QImage Slice extract." << std::endl;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> std::cerr << err << std::endl;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br>
<br>It would be great if someone knows what I have to change to avoid the error.<br>Thanks in advance!<br>Regards<br><font color="#888888"><br>melanie<br>
</font><br></div></div>_____________________________________<div class="im"><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.html" target="_blank">http://www.kitware.com/products/protraining.html</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></div></blockquote></div><br><br clear="all"><br>-- <br>Sergio Vera<br><br> Alma IT Systems<br> C/ Vilana, 4B, 4º 1ª<br> 08022 Barcelona<br> T. (+34) 932 380 592<br> <a href="http://www.alma3d.com" target="_blank">www.alma3d.com</a><br>
</div>
</blockquote></div><br>