[Insight-developers] interrupting filter execution

Paul Koshevoy koshevoy at sci.utah.edu
Sat Jul 22 17:27:18 EDT 2006


Jim Miller wrote:
> Paul,
> 
> We should revisit your GetInverse() needs.  At a minimum, we should figure
> out a way so that you do not need to patch files in the ITK release. 
> Can you
> tell me again what files you are patching and what the patches are?
> 
> Jim
> 

I need a virtual GetInverse() method that returns a pointer to
itk::Transform. I've been patching the following files in the ITK:

itkTransform.h
itkIdentityTransform.h
itkMatrixOffsetTransformBase.h
itkScaleTransform.h
itkTranslationTransform.h

I added the following to itk::Transform:

  /** Base inverse transform type. */
  typedef Transform< TScalarType, NOutputDimensions, NInputDimensions >
InverseTransformType;

  typedef SmartPointer< InverseTransformType > InverseTransformPointer;

  /** Return an inverse of this transform. If the inverse has not been
   *  implemented, return NULL.The type of the inverse transform
   *  does not necessarily need to match the type of the forward
   *  transform.
   *  This allows one to return a numeric inverse transform instead. */
  virtual InverseTransformPointer GetInverse() const
  { return NULL; }


I've overridden this new virtual GetInverse() function in
IdentityTransform, MatrixOffsetTransformBase, ScaleTransform and
TranslationTransform using the existing GetInverse(Self * inverse)
functionality, as follows:


  /** Return an inverse of this transform. */
  virtual InverseTransformPointer GetInverse() const
  {
    Pointer inv = New();
    return GetInverse(inv) ? inv.GetPointer() : NULL;
  }


	Paul.


More information about the Insight-developers mailing list