[Insight-developers] interrupting filter execution
Miller, James V (GE, Research)
millerjv at crd.ge.com
Mon Jul 24 12:27:44 EDT 2006
Paul,
I'm worried that not all transforms have an inverse (or the inverse is
too complicated to evaluate).
I think the way to do this is place another class under Transform that
is something like InvertibleTransform. This class would have the
virtual method to return the inverse of the transform. MatrixOffsetTransformBase
and IdentityTransform would inherit from InvertibleTransform.
This may not be the best way to do it because a MatrixOffsetTransformBase
not have to be invertible (could be a projection). Perhaps we can satisfy
this by having a method IsInvertible() on the InvertibleTransform which
verifies whether the current transform is actually invertible.
(I have been wanting to put in a subclass of Transform called LinearTransform
that MatrixOffsetTransformBase and IdentityTransform would inherit from).
Jim
-----Original Message-----
From: insight-developers-bounces+millerjv=crd.ge.com at itk.org
[mailto:insight-developers-bounces+millerjv=crd.ge.com at itk.org]On Behalf
Of Paul Koshevoy
Sent: Saturday, July 22, 2006 5:27 PM
To: insight-developers at itk.org
Subject: Re: [Insight-developers] interrupting filter execution
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.
_______________________________________________
Insight-developers mailing list
Insight-developers at itk.org
http://www.itk.org/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list