[Insight-users] InvalidRequestedRegionError with ExtractImageFilter

Sergio Vera sergio.vera at alma3d.com
Thu Mar 10 05:21:57 EST 2011


Hi...

You might be, however, using a slice value too big for your image.
What are the values of slice and of image->GetLargestPossibleRegion()?

Sergio

On Thu, Mar 10, 2011 at 10:39 AM, Melanie Uks <meluks2010 at googlemail.com>wrote:

> Hi all,
>
> 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:
>
>   itk::InvalidRequestedRegionError (0153BF38)
>   Location: "void __thiscall
> itk::DataObject::PropagateRequestedRegion(void) throw (class
> itk::InvalidRequestedRegionError)"
>   File: ..\..\InsightToolkit-3.16.0\Code\Common\itkDataObject.cxx
>   Line:397
>   Description: Requested region is (at least partially outside the largest
> possible region.
>
> The image is a global variable and used with several (itk) functions. One
> of those is the ExtractImageFilter.
> This is the code:
>
>      typedef itk::Image<PixelType, 2> OutputImageType;    //dimension
>     typedef itk::ExtractImageFilter<ImageType, OutputImageType>
> ExtractFilterType;
>     ExtractFilterType::Pointer extractFilter = ExtractFilterType::New();
>
>     ImageType::RegionType inputRegion = image->GetLargestPossibleRegion();
> //image size
>     ImageType::SizeType size = inputRegion.GetSize();
>     size[1]=0;    //y-Dimension wird gelöscht
>
>     ImageType::IndexType start = inputRegion.GetIndex();
>     start[1]=slice; //constant y-value
>
>     ImageType::RegionType desiredRegion;  //region of the slide in the 3D
> inage
>     desiredRegion.SetSize(size);
>     desiredRegion.SetIndex(start);
>
>     extractFilter->SetExtractionRegion(desiredRegion); //add region to
> filter
>     extractFilter->SetInput(image); //Input: image
>
>     OutputImageType::Pointer outimage = OutputImageType::New();
>
>     try
>     {
>          extractFilter->Update(); //filtering
>          outimage = extractFilter->GetOutput();
>     }
>     catch(itk::ExceptionObject &err)
>     {
>         std::cerr << "ExeptionObject caught!" << std::endl;
>         std::cerr << "Image2QImage Slice extract." << std::endl;
>         std::cerr << err << std::endl;
>     }
>
> It would be great if someone knows what I have to change to avoid the
> error.
> Thanks in advance!
> Regards
>
> melanie
>
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
>


-- 
Sergio Vera

 Alma IT Systems
 C/ Vilana, 4B, 4º 1ª
 08022 Barcelona
 T. (+34) 932 380 592
 www.alma3d.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110310/ad4bae82/attachment.htm>


More information about the Insight-users mailing list