[Insight-developers] writing an ImageToImageFilter, problem with Requested Region...

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Jul 24 15:58:49 EDT 2009


Hello Kent,

	This sounds familiar. If I recall correctly try calling:

x->UpdateLargestPossibleRegion();

instead of:

x->Update();

I think it comes down to an old RequestedRegion sticking around in the  
output image of the filter.

Brad


On Jul 24, 2009, at 3:44 PM, kent williams wrote:

> I've been working on an ITK filter that encapsulates some processing
> previously done in an ad hoc function -- the idea being we'd like to  
> be able
> to stick it in a pipeline, rather than run one pipeline, call the  
> function,
> and run the rest of the pipeline.
>
> The filter as I've written it works fine.  But if I try and re-use the
> filter it throws an exception:
>
> terminate called after throwing an instance of
> 'itk::InvalidRequestedRegionError'
>  what():
> /scratch/kent/BT/BRAINS-COMPILE/Darwin/DEBUG_64-lib/Insight/Code/ 
> Common/itkD
> ataObject.cxx:397:
> Requested region is (at least partially) outside the largest possible
> region.
>
> In other words what I'm doing is this:
>
>    itk::MyFilter::Pointer x = itk::MyFilter::New();
>    x->SetInput(inputImage1);
>    x->Update();
>    firstresult = x->GetOutput();
>    x->SetInput(inputImage2);
>    x->Update();  // *** EXCEPTION HERE
>    secondresult = x->GetOutput();
>
> The problem happens in itk::DataObject::PropogateRequestedRegion,  
> because
> VerifyRequestedRegion() fails -- the requested region is based on  
> the size
> of inputImage1. inputImage2 has a smaller volume, so it can't  
> satisfy the
> larger RequestedRegion.
>
> So the question is this:  What should I be doing in my filter to  
> support
> re-use?  How am I supposed to make the filter re-compute the requested
> region based on the size of the new Input?
>
> Or I guess another question might be this: Do ITK Filters, in  
> general, ever
> support this kind of re-use?
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.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-developers

========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090724/7b467603/attachment.htm>


More information about the Insight-developers mailing list