VelocityToDisplacementField.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_VelocityToDisplacementField_H
21 #define MIRTK_VelocityToDisplacementField_H
22 
23 #include "mirtk/ImageToImage.h"
24 
25 #include "mirtk/InterpolationMode.h"
26 #include "mirtk/ExtrapolationMode.h"
27 
28 
29 namespace mirtk {
30 
31 
32 /**
33  * Computes a displacement field from a stationary velocity field.
34  *
35  * Base class for image filters which compute the exponential map of a
36  * stationary velocity field. The filter output is a diffeomorphic
37  * displacement field.
38  */
39 template <class TVoxel>
41 {
42  mirtkAbstractImageFilterMacro(VelocityToDisplacementField, TVoxel);
43 
44  // ---------------------------------------------------------------------------
45  // Attributes
46 
47  /// Vector field interpolation mode
48  mirtkPublicAttributeMacro(InterpolationMode, Interpolation);
49 
50  /// Vector field extrapolation mode
51  mirtkPublicAttributeMacro(ExtrapolationMode, Extrapolation);
52 
53  /// Whether to compute interpolation coefficients from the given input
54  /// or if the input images contain the coefficients already
55  mirtkPublicAttributeMacro(bool, ComputeInterpolationCoefficients);
56 
57  /// Whether filter should compute the inverse displacement field
58  ///
59  /// Note that this is equivalent to simply changing the sign of \c _T.
60  /// It is in particular used by the DisplacementToVelocityField filter.
61  mirtkPublicAttributeMacro(bool, ComputeInverse);
62 
63  /// Number of integration steps
64  mirtkPublicAttributeMacro(int, NumberOfSteps);
65 
66  /// Upper integration limit (negative <=> inverse)
67  mirtkPublicAttributeMacro(double, UpperIntegrationLimit);
68 
69 protected:
70 
71  /// Optional input displacement field which is composed with the
72  /// exponential of the velocity field, i.e., exp(v) ° phi
74 
75  /// Initialize filter
76  virtual void Initialize();
77 
78  /// Finalize filter
79  virtual void Finalize();
80 
81  /// Constructor
83 
84 public:
85 
86  /// Destructor
88 
89  // Import other overloads
90  using Baseclass::Input;
91 
92  /// Set n-th input (0: velocity field, 1: input displacement field, optional)
93  virtual void Input(int, const ImageType *);
94 
95  /// Get n-th input (0: velocity field, 1: input displacement field, optional)
96  virtual const ImageType *Input(int);
97 
98 };
99 
100 
101 } // namespace mirtk
102 
103 #endif // MIRTK_VelocityToDisplacementField_H
virtual void Initialize()
Initialize filter.
VelocityToDisplacementField()
Constructor.
InterpolationMode
Image interpolation modes.
Definition: IOConfig.h:41
virtual void Finalize()
Finalize filter.
ExtrapolationMode
Image extrapolation modes.
virtual ~VelocityToDisplacementField()
Destructor.
virtual void Input(int, const ImageType *)
Set n-th input (0: velocity field, 1: input displacement field, optional)