DifferenceOfCompositionLieBracketImageFilter3D.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_DifferenceOfCompositionLieBracketImageFilter3D_H
21 #define MIRTK_DifferenceOfCompositionLieBracketImageFilter3D_H
22 
23 #include "mirtk/LieBracketImageFilter.h"
24 #include "mirtk/InterpolateImageFunction.h"
25 
26 
27 namespace mirtk {
28 
29 
30 /**
31  * Image filter for computation of Lie bracket of two 3D vector fields.
32  *
33  * This filter implements the definition of the Lie bracket as the difference
34  * of the composition of the first vector field with the second and vice versa,
35  * i.e., [X,Y] = X(Y) - Y(X).
36  */
37 template <class TVoxel>
39 : public LieBracketImageFilter<TVoxel>
40 {
41  mirtkImageFilterMacro(DifferenceOfCompositionLieBracketImageFilter3D, TVoxel);
42 
43  /// Vector field interpolation mode
44  mirtkPublicAttributeMacro(InterpolationMode, Interpolation);
45 
46  /// Vector field extrapolation mode
47  mirtkPublicAttributeMacro(ExtrapolationMode, Extrapolation);
48 
49  /// Whether to compute interpolation coefficients from the given input
50  /// or if the input images contain the coefficients already
51  mirtkPublicAttributeMacro(bool, ComputeInterpolationCoefficients);
52 
53 protected:
54 
56 
57  InterpolatorType *_Interpolator[2]; /// Input vector field interpolators
58  double _Scaling [2]; /// Scaling of input vector fields
59 
60  /// Initialize filter
61  virtual void Initialize();
62 
63 public:
64 
65  /// Constructor
67 
68  /// Destructor
70 
71  /// Set scaling of n-th input vector field
72  void Scaling(int, double);
73 
74  /// Get scaling of n-th input vector field
75  double Scaling(int) const;
76 
77  /// Run filter on every voxel
78  virtual void Run();
79 
80  /// Run filter on single voxel
81  virtual void Run(double [3], int, int, int);
82 
83  /// Run filter on single voxel and component
84  virtual double Run(int, int, int, int);
85 };
86 
87 
88 } // namespace mirtk
89 
90 #endif // MIRTK_DifferenceOfCompositionLieBracketImageFilter3D_H
virtual void Initialize()
Scaling of input vector fields.
virtual ~DifferenceOfCompositionLieBracketImageFilter3D()
Destructor.
InterpolationMode
Image interpolation modes.
Definition: IOConfig.h:41
virtual void Run()
Run filter on every voxel.
ExtrapolationMode
Image extrapolation modes.
void Scaling(int, double)
Set scaling of n-th input vector field.