HessianImageFilter.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2015 Daniel Rueckert, Julia Schnabel
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_HessianImageFilter_H
21 #define MIRTK_HessianImageFilter_H
22 
23 #include "mirtk/ImageToImage.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Class for calculating the second order gradient of an image.
31  *
32  * The class provides an interface to calculating the second order gradient in the
33  * x-x-, x-y-, x-z-, y-y-, y-z- and z-z- directions.
34  */
35 template <class TVoxel>
36 class HessianImageFilter : public ImageToImage<TVoxel>
37 {
38  mirtkImageFilterMacro(HessianImageFilter, TVoxel);
39 
40  // ---------------------------------------------------------------------------
41  // Types
42 public:
43 
44  /// Type of gradient vector to compute
45  enum OutputType {
46  HESSIAN_XX,
47  HESSIAN_XY,
48  HESSIAN_XZ,
49  HESSIAN_YY,
50  HESSIAN_YZ,
51  HESSIAN_ZZ,
52  HESSIAN_VECTOR,
53  HESSIAN_MATRIX
54  };
55 
56  // ---------------------------------------------------------------------------
57  // Attributes
58 protected:
59 
60  /// Whether to return gradient in mm or voxel units
61  mirtkPublicAttributeMacro(bool, UseVoxelSize);
62 
63  /// Whether to return gradient in world orientation
64  mirtkPublicAttributeMacro(bool, UseOrientation);
65 
66  /// Padding value
67  mirtkPublicAttributeMacro(double, PaddingValue);
68 
69  /// Which Hessian component(s) to output
71 
72  // ---------------------------------------------------------------------------
73  // Construction/Destruction
74 public:
75 
76  /// Constructor
77  HessianImageFilter(OutputType type = HESSIAN_MATRIX);
78 
79  // ---------------------------------------------------------------------------
80  // Execution
81 
82  /// Run the Hessian filter
83  virtual void Run();
84 
85 protected:
86 
87  /// Initialize the filter
88  virtual void Initialize();
89 
90 };
91 
92 
93 } // namespace mirtk
94 
95 #endif // MIRTK_HessianImageFilter_H
OutputType
Type of gradient vector to compute.
mirtkPublicAttributeMacro(bool, UseVoxelSize)
Whether to return gradient in mm or voxel units.
HessianImageFilter(OutputType type=HESSIAN_MATRIX)
Constructor.
Definition: IOConfig.h:41
virtual void Run()
Run the Hessian filter.
virtual void Initialize()
Initialize the filter.