[ITK-users] Smallest region containing the physical space covered by another image's region
Cyril Mory
cyril.mory at creatis.insa-lyon.fr
Wed Apr 15 07:23:16 EDT 2015
Hi Matt,
I have added such a method to itkImageBase, it is called
GetSmallestRegionContainingRegion. The patch is submitted on a branch
with the same name. I made my best, but I think it will require more
improvements than the previous one before it can get merged.
In particular, I haven't used the itk::BoundingBox class, because from
its description it seems to handle only itk::Point. Should I convert
indexes to points, run the BoundingBox calculation, and convert back ?
I'll wait for the comments
Cyril
On 04/13/2015 09:12 PM, Matt McCormick wrote:
> 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