[Insight-developers] example image to image filter with
differentinput and output dimensions
Miller, James V (Research)
millerjv at crd.ge.com
Mon Oct 10 09:53:19 EDT 2005
Simon,
The UnaryFunctorImageFilter allows for the output image to have a larger
dimension than the input image. Most of the code to handle this is in this
file.
Special code has to be put in the GenerateOutputInformation() method. Also,
you may need to be careful how you construct the regions for any iterators in
you GenerateData() methods. Here is a snippet from UnaryFunctorImageFilter. In
this example, the outputRegionForThread was passed as a parameter to the
ThreadedGenerateData() method. We have to use the CallCopyOutputRegionToInputRegion()
method to convert that region to a suitable region for the input. This method is
defined up in ImageToImageFilter.
// Define the portion of the input to walk for this thread, using
// the CallCopyOutputRegionToInputRegion method allows for the input
// and output images to be different dimensions
InputImageRegionType inputRegionForThread;
this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread);
// Define the iterators
ImageRegionConstIterator<TInputImage> inputIt(inputPtr, inputRegionForThread);
ImageRegionIterator<TOutputImage> outputIt(outputPtr, outputRegionForThread);
I've used the CastImageFilter (a subclass of UnaryFunctorImageFilter) to increase
the dimension of an image.
Jim
-----Original Message-----
From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
Of Simon Warfield
Sent: Monday, October 10, 2005 9:25 AM
To: Insight-developers (E-mail)
Subject: [Insight-developers] example image to image filter with
differentinput and output dimensions
I am having some trouble with a filter that reads 3D data and generates
4D data.
In particular, the default mechanism for constructing the 4D output
fails with a bad cast error.
Are there any examples of image to image filters where the output
dimension is larger than the input dimension ?
--
Simon
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list