[Insight-developers] Image::TransformPhysicalPointToIndex

Luis Ibanez luis.ibanez@kitware.com
Thu, 28 Feb 2002 11:24:09 -0500


Well, it is a Chicken-Egg problem...

1) Yes, you do can set ANY transform at run-time,
     and call image->TransfromPhysicalToIndex()
     at any moment. That will work just fine.

    but....
    if somebody call RebuildTransform() that will
   crash because the RebuildTransform() method
   assumes an "AffineTransform"

2) If we change the current state, and Nobody (not even
    RebuildTransform() initialize the transform... then
    the image will not have a Transform at all and any
    call to TransformIndexToPhysicalPoint() will be
    pointless.


It sounds like a Factory problem...maybe what the image
need is not a Transform but a TransfromFactory....


I will follow Jim's suggestion that the image should
not be responsible for managing conversions from
pixels to world coordinates.   Let the image be a
grid like container and let some other class take over
the task of interpreting how this grid maps to physical
space.

We could still attach a Generic Transform to the image
but remove  from the image the responsibility of initializing
such Transform and using it for transforming points into indices.

How about a class that :

1) receives an ImageRegion
2) receives a Generic Transform

and provides the service of mapping between:

Points, Indices and ContinuousIndices

This is already done in   itk::ImageSpatialFunction
in order to simplify its internal code.

This new class could be initialized from an image,
pretty much like we construct iterators now:

     ImagePointer image = ImagePointer::New();
    Transformer  tr(  image,  image->GetBufferedRegion() );

then the class can be used like:

          tr.Transform( point, index );

This has the drawback (as Damion pointed out before) that
conversions that are done now with one line of code will
require three or four....





Luis



======================================   

Damion Shelton wrote:

> Hi...
>
>> Images requiring other Transform has to derive from itk::Image and
>> instantiate the corresponding  xxTranforms in their constructors.
>
>
> Does this mean that it's impossible to just "set" the transform at run 
> time?I.e., you can't have a "default" affine transform, and then at 
> some point replace it with some other transform?
>
> -Damion-
>