InverseAffineTransformation.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_InverseAffineTransformation_H
21 #define MIRTK_InverseAffineTransformation_H
22 
23 #include "mirtk/AffineTransformation.h"
24 #include "mirtk/EventDelegate.h"
25 
26 
27 namespace mirtk {
28 
29 
30 /**
31  * Class for inverse linear transformation.
32  *
33  * An instance of this class decorates either a rigid, similarity, or an
34  * affine transformation and represents the inverse of this transformation,
35  * i.e., T(x) = A^-1 x. The ParametricGradient function computes the
36  * update of the parameters of the decorated transformation. Instances of this
37  * class are used by the image registration filter for an inverse consistent
38  * (possibly symmetric) affine registration.
39  *
40  * Note: For a symmetric inverse consistent affine registration, the use of
41  * AffineTransformation and InverseAffineTransformation is more
42  * efficient then two PartialAffineTransformation instances.
43  * For example, use the \c ireg energy function setting
44  * "-NMI(I1 o T^-1, I2 o T)" instead of "-NMI(I1 o T^-0.5, I2 o T^0.5)".
45  * The resulting transformation has to be squared, i.e., applied twice
46  * to obtain the full transformation between I1 and I2, however.
47  *
48  * \sa PartialAffineTransformation
49  */
51 {
52  mirtkTransformationMacro(InverseAffineTransformation);
53 
54  // ---------------------------------------------------------------------------
55  // Attributes
56 
57  /// Pointer to decorated transformation
58  mirtkReadOnlyAggregateMacro(AffineTransformation, Transformation);
59 
60  /// Observes changes of decorated transformation
61  EventDelegate _TransformationObserver;
62 
63  /// Update transformation after change of decorated transformation
64  void OnTransformationChanged();
65 
66 public:
67 
68  /// Set decorated rigid, similarity, or affine transformation
70 
71  // ---------------------------------------------------------------------------
72  // Construction/Destruction
73 
74  /// Constructor
76 
77  /// Destructor
79 
80  // ---------------------------------------------------------------------------
81  // Transformation parameters
82 
83  /// Checks whether transformation depends on the same vector of parameters
84  virtual bool HasSameDOFsAs(const class Transformation *) const;
85 
86  // ---------------------------------------------------------------------------
87  // Derivatives
88 
90 
91  /// Calculates the Jacobian of the transformation w.r.t the parameters
92  virtual void JacobianDOFs(double [3], int, double, double, double, double = 0, double = 1) const;
93 
94 };
95 
96 
97 } // namespace mirtk
98 
99 #endif // MIRTK_InverseAffineTransformation_H
virtual ~InverseAffineTransformation()
Destructor.
InverseAffineTransformation(AffineTransformation *=NULL)
Constructor.
virtual void JacobianDOFs(double [3], int, double, double, double, double=0, double=1) const
Calculates the Jacobian of the transformation w.r.t the parameters.
virtual bool HasSameDOFsAs(const class Transformation *) const
Checks whether transformation depends on the same vector of parameters.
Definition: IOConfig.h:41
virtual void JacobianDOFs(double [3], int, double, double, double, double=0, double=-1) const
Calculates the Jacobian of the transformation w.r.t the parameters.
void Transformation(AffineTransformation *)
Set decorated rigid, similarity, or affine transformation.