[ITK-users] Smallest region containing the physical space covered by another image's region
Matt McCormick
matt.mccormick at kitware.com
Mon Apr 13 15:12:57 EDT 2015
Hi Cyril,
> I am preparing a patch for the itkWarpImageFilter, and I came to realize
> that computing the requestedRegion of the inputs from the output's requested
> region is non trivial.
Great job on the patch submission! :-)
> - the displacement in the deformation field can be very large, in any
> direction, ... therefore there is no choice but to load the full input image
> into memory (unless we want to go through the whole deformation field to
> evaluate the maximum displacement, but in a method like
> GenerateInputRequestedRegion we do not want such heavy processing)
> => Input image's requested region should be the largest possible region
Yes, this is a good assessment.
> - the requested region in the deformation field, on the other hand, can be
> computed. But it is not trivial. If the output and the DF have identical
> information (spacing, origin, direction), then the requested region in the
> DF should be copied from the output. If their information differs, computing
> the requested region would require a method to compute the smallest
> rectangular region that contains the physical space covered by an other
> image's region, the other image having (potentially) a different spacing,
> origin and/or direction. Does such a method exist somewhere in ITK ?
A possible approach here could transform all corner indexes of the
output to physical space points, transform physical points to index
space of the DF, and compute a bounding box of these index points.
The methods to apply could be
TransformIndexToPhysicalPoint
TransformPhysicalPointToIndex
on the ImageBase class and the itk::BoundingBox class.
HTH,
Matt
More information about the Insight-users
mailing list