[Insight-users] Comparing AffineTransform and CenteredAffineTransform

Luis Ibanez luis . ibanez at kitware . com
Wed, 15 Oct 2003 22:27:39 -0400


Hi Gavin,

Thanks for testing the use of ComputeOffset().

The documentation for the CenteredAffineTransform
was modified yesterday.

for the class:
http://www . itk . org/Insight/Doxygen/html/classitk_1_1CenteredAffineTransform . html#_details

and for the ComputeOffset() method:
http://www . itk . org/Insight/Doxygen/html/classitk_1_1CenteredAffineTransform . html#a5

Please let us know if you consider that some more
details may be needed in the comments.

Thanks


   Luis



------------------
Gavin Baker wrote:
> Hello Luis,
> 
> On Tue, Oct 14, 2003 at 10:55:45AM -0400, Luis Ibanez wrote:
> 
> 
>>Thanks for posting your detailed code.
>>
>>Your usage of the CenteredAffineTransform is correct.
>>
>>The only detail missing is that after you have set the
>>center and the rotation, the method "ComputeOffset()"
>>must be called before using the transform.
> 
> 
> Aha! I see... that makes sense now, looking at the code - but it is
> certainly not obvious.
> 
> 
>>The code will look like:
>>
>>
>>>caffine->SetCenter( centerB  );
>>>caffine->Rotate( 0, 1, angle );
>>>caffine->ComputeOffset();
>>
> 
> I tested this and it does indeed work as expected.
> 
> 
>>This is a bit missleading here...
>>we should probably add a comment on the
>>doxygen documentation.
>>
>>
>>The CenteredAffineTransform derives from the
>>AffineTransform. The offset of the base class
>>should be recomputed in order to take into
>>account the center of rotation.
> 
> 
> Thanks for clearing this up.
> 
> Regards,
> 
>  :: Gavin
> 
> PS: Here is a little patch for the doc comments to cover this:
> 
> 
> --- Code/Common/itkCenteredAffineTransform.h    2003-09-11 00:29:03.000000000 +1000
> +++ /tmp/itkCenteredAffineTransform.h   2003-10-16 11:00:31.000000000 +1000
> @@ -27,8 +27,11 @@
>  /**
>   * \brief Affine transformation with a specified center of rotation.
>   *
> - * This class implements an Affine transform in which the rotation center can be explicitly selected.
> + * This class implements an Affine transform in which the rotation center
> + * can be explicitly selected.
>   *
> + * Note that once all the transformations (translation, rotation, etc) have
> + * been applied, ComputeOffset() must be called to recalculate the new offset.
>   * 
>   * \ingroup Transforms
>   *
> @@ -120,7 +123,8 @@
>    itkGetConstReferenceMacro( Translation, OutputVectorType );
>   
>    /** Compute the offset using the rotation center, the matrix
> -   *  and the final translation. */
> +   *  and the final translation. This must be called after all
> +   *  transformations have been applied. */
>    virtual void ComputeOffset(void);
>  
>  protected:
> 
> 
>