GaussianInterpolateImageFunction2D.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2008-2015 Imperial College London
5  * Copyright 2008-2013 Daniel Rueckert, Julia Schnabel
6  * Copyright 2013-2015 Andreas Schuh
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef MIRTK_GaussianInterpolateImageFunction2D_H
22 #define MIRTK_GaussianInterpolateImageFunction2D_H
23 
24 #include "mirtk/GaussianInterpolateImageFunction.h"
25 
26 
27 namespace mirtk {
28 
29 
30 /**
31  * Gaussian interpolation of generic 2D image
32  */
33 template <class TImage>
36 {
38  mirtkGenericInterpolatorTypes(GenericGaussianInterpolateImageFunction);
39 
40 public:
41 
42  /// Default constructor
44 
45  /// Get value of given image at arbitrary location (in pixels)
46  ///
47  /// This function is used to interpolate the image value at arbitrary
48  /// locations when no extrapolator was set.
49  VoxelType Get(double, double, double = 0, double = 0) const;
50 
51  /// Get value of given image at arbitrary location (in pixels)
52  ///
53  /// This function is used to only interpolate foreground image values.
54  /// If fully outside the foreground region, the _DefaultValue is returned.
55  VoxelType GetWithPadding(double, double, double = 0, double = 0) const;
56 
57  /// Get value of given image at arbitrary location (in pixels)
58  ///
59  /// If the location is inside the finite domain of the image, an actual image
60  /// instance can be passed as first argument directly such as an instance of
61  /// GenericImage. Otherwise, an image function which extends the finite
62  /// image domain to an infinite lattice is needed, i.e., an instance of a
63  /// subclass of ExtrapolateImageFunction.
64  template <class TOtherImage> typename TOtherImage::VoxelType
65  Get(const TOtherImage *, double, double, double = 0, double = 0) const;
66 
67  /// Get value of given image at arbitrary location (in pixels)
68  ///
69  /// This function is used to only interpolate foreground image values.
70  /// If fully outside the foreground region, the _DefaultValue is returned.
71  ///
72  /// If the location is inside the finite domain of the image, an actual image
73  /// instance can be passed as first argument directly such as an instance of
74  /// GenericImage. Otherwise, an image function which extends the finite
75  /// image domain to an infinite lattice is needed, i.e., an instance of a
76  /// subclass of ExtrapolateImageFunction.
77  template <class TOtherImage> typename TOtherImage::VoxelType
78  GetWithPadding(const TOtherImage *, double, double, double = 0, double = 0) const;
79 
80  /// Evaluate generic image without handling boundary conditions
81  ///
82  /// This version is faster than EvaluateOutside, but is only defined inside
83  /// the domain for which all image values required for interpolation are
84  /// defined and thus require no extrapolation of the finite image.
85  virtual VoxelType GetInside(double, double, double = 0, double = 0) const;
86 
87  /// Evaluate generic image at an arbitrary location (in pixels)
88  virtual VoxelType GetOutside(double, double, double = 0, double = 0) const;
89 
90  /// Evaluate generic image without handling boundary conditions
91  ///
92  /// If the location is partially inside the foreground region of the image,
93  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
94  /// is returned.
95  ///
96  /// This version is faster than GetWithPaddingOutside, but is only defined
97  /// inside the domain for which all image values required for interpolation
98  /// are defined and thus require no extrapolation of the finite image.
99  virtual VoxelType GetWithPaddingInside(double, double, double = 0, double = 0) const;
100 
101  /// Evaluate generic image at an arbitrary location (in pixels)
102  ///
103  /// If the location is partially inside the foreground region of the image,
104  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
105  /// is returned.
106  virtual VoxelType GetWithPaddingOutside(double, double, double = 0, double = 0) const;
107 
108 };
109 
110 
111 /**
112  * Gaussian interpolation of any 2D image
113  */
116 {
117  mirtkObjectMacro(GaussianInterpolateImageFunction2D);
118 
119 public:
120 
121  /// Constructor
123  :
125  {}
126 
127 };
128 
129 
130 } // namespace mirtk
131 
132 #endif // MIRTK_GaussianInterpolateImageFunction2D_H
virtual VoxelType GetWithPaddingInside(double, double, double=0, double=0) const
VoxelType Get(double, double, double=0, double=0) const
virtual VoxelType GetInside(double, double, double=0, double=0) const
Definition: IOConfig.h:41
VoxelType GetWithPadding(double, double, double=0, double=0) const
GenericGaussianInterpolateImageFunction2D(double sigma=1.0)
Default constructor.
virtual VoxelType GetOutside(double, double, double=0, double=0) const
Evaluate generic image at an arbitrary location (in pixels)
virtual VoxelType GetWithPaddingOutside(double, double, double=0, double=0) const