[Insight-developers] writing an ImageToImageFilter, problem with Requested Region...
kent williams
norman-k-williams at uiowa.edu
Fri Jul 24 15:44:52 EDT 2009
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?
More information about the Insight-developers
mailing list