[Insight-developers] GetInverse is unusable -- patch attached

Paul Koshevoy koshevoy at sci.utah.edu
Wed Apr 8 12:05:49 EDT 2009


Luis Ibanez wrote:
> Hi Tom,
>
> Here are some observations about the patch: itk-getinverse.patch
>
> ----
>
> In line 184:
>
> CenteredRigid2DTransform<TScalarType>::
> +GetInverse( Self* inverse) const
> +{
> +  if(!inverse)
> +    {
> +    return false;
> +    }
>
>
> It is tempting to use a SmartPointer as argument
> so that we can do:
>
> +GetInverse( Self::Pointer inverse) const
> +{
> +  if( inverse.IsNull() )
> +    {
> +    inverse = Self::New();
> +    }
>
>   


Hi Luis,

It seems the code you are objecting to is the existing ITK code.  
Passing a Self pointer (smart or not) restricts the inverse transform 
type to be the same type as the forward transform.  That is broken, 
because only a few transforms have an analytic inverse of the same 
type.  This is not what my patch does, although I have followed the 
style and implemented GetInverse() inline in the .h file.

My current patch doesn't have the changes you are referring to:
https://code.sci.utah.edu/svn/ImageReconstruction/trunk/code/itk-patch/InsightToolkit-3.12.0-GetInverse.patch 


    Pavel.



More information about the Insight-developers mailing list