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