CSplineInterpolateImageFunction2D.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_CSplineInterpolateImageFunction2D_H
21 #define MIRTK_CSplineInterpolateImageFunction2D_H
22 
23 #include "mirtk/CSplineInterpolateImageFunction.h"
24 
25 
26 namespace mirtk {
27 
28 
29 /**
30  * Cubic spline interpolation of generic 2D image
31  */
32 template <class TImage>
35 {
37  mirtkGenericInterpolatorTypes(GenericCSplineInterpolateImageFunction);
38 
39 public:
40 
41  /// Default constructor
43 
44  /// Get value of given image at arbitrary location (in pixels)
45  ///
46  /// This function is used to interpolate the image value at arbitrary
47  /// locations when no extrapolator was set.
48  VoxelType Get(double, double, double = 0, double = 0) const;
49 
50  /// Get value of given image at arbitrary location (in pixels)
51  ///
52  /// This function is used to only interpolate foreground image values.
53  /// If fully outside the foreground region, the _DefaultValue is returned.
54  VoxelType GetWithPadding(double, double, double = 0, double = 0) const;
55 
56  /// Get value of given image at arbitrary location (in pixels)
57  ///
58  /// If the location is inside the finite domain of the image, an actual image
59  /// instance can be passed as first argument directly such as an instance of
60  /// GenericImage. Otherwise, an image function which extends the finite
61  /// image domain to an infinite lattice is needed, i.e., an instance of a
62  /// subclass of ExtrapolateImageFunction.
63  template <class TOtherImage> typename TOtherImage::VoxelType
64  Get(const TOtherImage *, double, double, double = 0, double = 0) const;
65 
66  /// Get value of given image at arbitrary location (in pixels)
67  ///
68  /// This function is used to only interpolate foreground image values.
69  /// If fully outside the foreground region, the _DefaultValue is returned.
70  ///
71  /// If the location is inside the finite domain of the image, an actual image
72  /// instance can be passed as first argument directly such as an instance of
73  /// GenericImage. Otherwise, an image function which extends the finite
74  /// image domain to an infinite lattice is needed, i.e., an instance of a
75  /// subclass of ExtrapolateImageFunction.
76  template <class TOtherImage> typename TOtherImage::VoxelType
77  GetWithPadding(const TOtherImage *, double, double, double = 0, double = 0) const;
78 
79  /// Evaluate generic image without handling boundary conditions
80  ///
81  /// This version is faster than EvaluateOutside, but is only defined inside
82  /// the domain for which all image values required for interpolation are
83  /// defined and thus require no extrapolation of the finite image.
84  virtual VoxelType GetInside(double, double, double = 0, double = 0) const;
85 
86  /// Evaluate generic image at an arbitrary location (in pixels)
87  virtual VoxelType GetOutside(double, double, double = 0, double = 0) const;
88 
89  /// Evaluate generic image without handling boundary conditions
90  ///
91  /// If the location is partially inside the foreground region of the image,
92  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
93  /// is returned.
94  ///
95  /// This version is faster than GetWithPaddingOutside, but is only defined
96  /// inside the domain for which all image values required for interpolation
97  /// are defined and thus require no extrapolation of the finite image.
98  virtual VoxelType GetWithPaddingInside(double, double, double = 0, double = 0) const;
99 
100  /// Evaluate generic image at an arbitrary location (in pixels)
101  ///
102  /// If the location is partially inside the foreground region of the image,
103  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
104  /// is returned.
105  virtual VoxelType GetWithPaddingOutside(double, double, double = 0, double = 0) const;
106 
107 };
108 
109 /**
110  * Cubic spline interpolation of any 2D image
111  */
114 {
115  mirtkObjectMacro(CSplineInterpolateImageFunction2D);
116 
117 public:
118 
119  /// Constructor
121 
122 };
123 
124 
125 } // namespace mirtk
126 
127 #endif // MIRTK_CSplineInterpolateImageFunction2D_H
virtual VoxelType GetWithPaddingInside(double, double, double=0, double=0) const
virtual VoxelType GetWithPaddingOutside(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
VoxelType Get(double, double, double=0, double=0) const
virtual VoxelType GetOutside(double, double, double=0, double=0) const
Evaluate generic image at an arbitrary location (in pixels)