New VTK transform classes
Tim Hutton
T.Hutton at eastman.ucl.ac.uk
Thu Mar 9 11:29:34 EST 2000
Another addition to the family now, vtkLandmarkTransform (derived from
vtkLinearTransform) computes the best alignment between two sets of
corresponding landmarks, in a least-squares sense. It doesn't distort
objects, just translates, rotates and scales them. Can turn scaling off by
calling SetModeToRigidBody().
Thanks to David for all his help and his good work in revamping the
transform classes.
Tim.
At 10:55 06/03/00 -0500, David Gobbi wrote:
>Hi All,
>
>I've added a new set of vtk*Transform classes to VTK recently.
>These extent the vtkGeneralTransform heirarchy which was
>introduced in VTK 3.1:
>
>Abstract Classes Concrete Classes
>---------------- ----------------
>
>vtkGeneralTransform
> | \
> | vtkWarpTransform ------ vtkThinPlateSplineTransform
> | \- vtkGridTransform (not ready yet)
> |
>vtkPerspectiveTransform ---------------- vtkProjectionTransform
> |
>vtkLinearTransform --------------------- vtkTransform
> \---- vtkQuaternionTransform
> \--- vtkIdentityTransform
>
>The vtkGeneralTransform and vtkThinPlateSplineTransform were added in
>vtk 3.1, and the vtkTransform goes waaay back. All of the other transform
>classes are new.
>
>The modifications to vtkTransform are 100% backwards compatible.
>
>
>A brief description of each transform:
>-------------------------------------
>
>vtkTransform -- Describes a linear (i.e. affine) transformation. In the
> past this was also used for perspective transformations --
> this is to be strongly discouraged.
>
>vtkQuaternionTransform -- Describes a linear transformation based on
> quaternions: this restricts the transformation to
> rotation and isotropic scale. It has an
> InterpolateTransform() method that allows SLERP-style
> interpolation between key frames (anyone want to add
> SQUAD?)
>
>vtkIdentityTransform -- Does absolutely nothing, but does it more efficently
> than any other transformation.
>
>vtkProjectionTransform -- Perspective (e.g. camera-style) transformations.
> For now, you have to build the 4x4 projection matrix
> yourself. If anyone wants to move some of the
> vtkCamera.cxx code to vtkProjectionTransform.cxx, that
> would be great.
>
>vtkThinPlateSplineTransform -- A warp transformation that uses a set
> of control points and a radial basis function. Right
> now only two RBFs are available, more will be added
> in the future.
>
>vtkGridTransform -- A warp transformation defined in terms of a
> regularely sampled 3D grid of displacement vectors.
> It's not in VTK yet, because I haven't found time
> to properly test it.
>
>
>The new transform pipeline
>--------------------------
>
>There are also a set of vtk*TransformConcatenation classes to allow
>you to build a transformation pipeline:
>
>vtkGeneralTransformConcatenation - concatenate any transforms
>vtkPerspectiveTransformConcatenation - concatenate perspective transforms
>vtkLinearTransformConcatenation - concatenate linear transforms
>
>For example:
>
> vtkThinPlateSplineTransform vtkTransform
> | |
> | [ invert ]
> | |
> \-----[ concatenate ]-------/
> |
> v
> [ vtkTransformPolyDataFilter SetTransform ]
>
>
>vtkThinPlateSplineTransform warpTrans
>warpTrans SetSourceLandmarks points1
>warpTrans SetTargetLandmarks points2
>
>vtkTransform linearTrans
>linearTrans RotateX 30
>
>vtkGeneralTransformConcatenation concat # create identity
>concat Concatenate warpTrans
>concat Concatenate [linearTrans GetInverse]
>
>vtkTransformPolyDataFilter poly
>poly SetTransform concat
>poly SetInput input # some input vtkPolyData
>
>Now 'concat' is a concatenation of 'warpTrans' and the inverse of
>'linearTrans.' If you modify one of the transforms (e.g. change the
>ThinPlateSpline control points) the concatenation will automatically
>update to reflect the change.
>
>
>Note that inversion is pipelined in a simlilar manner to concatenation,
>e.g. if you do
>
>vtkTransformPolyDataFilter poly
>poly SetTransform [warpTrans GetInverse]
>
>and then modify the warpTrans control points, you do not have to
>call "poly SetTransform [warpTrans GetInverse]" again to force an
>update -- everything is automatic.
>
>The inversion is handled by a proxy class, vtkGeneralTransformInverse.
>
>
>Tcl Examples
>------------
>
>contrib/thinPlate.tcl
>contrib/TestWarpReslice.tcl
>(More & better examples will be added soon)
>
>
>Future changes
>--------------
>
>Currently only two other vtk classes know about the vtkGeneralTransform
>heirarchy: vtkTransformPolyDataFilter and vtkImageReslice. The following
>classes can also also be changed with minimal work:
>
>common/vtkImplicitFunction - SetTransform(vtkGeneralTransform *)
>graphics/vtkTransformFilter - SetTransform(vtkGeneralTransform *)
>
>As well, there are several classes that could be internally
>modified to be implemented in terms of the new transformations.
>The best examples of this are vtkProp3D and vtkCamera. I plan to
>make the vtkProp3D (i.e. vtkActor) changes myself sometime this week.
>
>
>Also, if anyone is interested in doing animation with VTK, it might
>be worthwhile to make a vtkQuaternionTransformCollection that
>provides high-quality interpolation between a set of key-frame
>transformations. Key-frame interpolation can already be done in VTK
>with the old vtkTransform, but the vtkQuaternionTransform is much
>better suited for this. Between transform interpolation and the
>vtkLinearTransformConcatenation class (to handle joints etc)
>there is a much greater potential for VTK to be used in animation.
>
> - David
>
>--
> David Gobbi, MSc dgobbi at irus.rri.on.ca
> Advanced Imaging Research Group
> Robarts Research Institute, University of Western Ontario
>
>--------------------------------------------------------------------
>This is the private VTK discussion list. Please keep messages on-topic.
>Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
><majordomo at public.kitware.com>. For help, send message body containing
>"info vtkusers" to the same address.
>--------------------------------------------------------------------
>
>
---------------------------------------------------------------------------
Tim Hutton, Research Assistant Email: T.Hutton at eastman.ucl.ac.uk
MINORI Project Eternal: T.Hutton at mail.com
Dental and Medical Informatics http://www.eastman.ucl.ac.uk/~dmi/MINORI
Eastman Dental Institute, UCL Tel: [+44] (0207) 915 2344
256 Gray's Inn Road, London WC1X 8LD, UK Fax: [+44] (0207) 915 2303
---------------------------------------------------------------------------
This email represents the views of the sender alone and must not be
construed as representing the views of the Eastman Dental Institute. It may
contain confidential information and may be protected by law as a legally
privileged document and copyright work. Its content should not be disclosed
and it should not be given or copied to anyone other than the person(s)
named or referenced above. If you have received this email in error, please
contact the sender.
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list