[Insight-developers] writing an ImageToImageFilter, problem with Requested Region...
kent williams
norman-k-williams at uiowa.edu
Fri Jul 24 17:51:40 EDT 2009
The problem lies, actually, before my filter's GenerateData is called.
The abort happens in itk::DataObject::PropogateRequestedRegion(), where it
calls itk::ProcessObject::PropogateRequestedRegion, which then calls
itk::DataObject::PropogateRequestedRegion, which calls
itk::DataObject::VerifyRequestedRegion, which returns false. At that point,
an exception is thrown.
The problem is that calling SetInput a second time doesn't update the
requested region, so if the region doesn't fit in the input region, an
exception is thrown. If the input region coincidentally happens to contain
the requested region, it's even worse, because the filter would succeed but
not process the entire input region.
So as far as I can tell, a program should do one of two things:
1. Never re-use a filter on different sized inputs, always instantiate a
fresh instance of the filter.
2. Always call UpdateLargestPossibleRegion() instead of Update(), if you
want to re-use a filter.
On 7/24/09 4:11 PM, "Gaëtan Lehmann" <gaetan.lehmann at jouy.inra.fr> wrote:
>>
>
> You have to call UpdateLargestPossibleRegion() inside GenerateData(),
> instead of Update(). Note that if the filter is not enlarging the
> requested region to the largest one, you may have some problem with
> that code. I may be better to force the requested region of the
> internal filter to the requested region of the output image of your
> custom filter.
>
> Do you still have this kind of exception if you use the double
> GraftOutput()? I think that the region are copied properly by
> GraftOutput(). If your internal code fits entirely in the pipeline
> model, it may be enough to make your code work properly.
>
> Gaëtan
>
>
More information about the Insight-developers
mailing list