GaussianInterpolateImageFunction4D.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_GaussianInterpolateImageFunction4D_H
22 #define MIRTK_GaussianInterpolateImageFunction4D_H
23 
24 #include "mirtk/GaussianInterpolateImageFunction.h"
25 
26 
27 namespace mirtk {
28 
29 
30 /**
31  * Gaussian interpolation of generic 4D image
32  */
33 
34 template <class TImage>
37 {
39  mirtkGenericInterpolatorTypes(GenericGaussianInterpolateImageFunction);
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> typename TOtherImage::VoxelType
79  GetWithPadding(const TOtherImage *, double, double, double, double) const;
80 
81  /// Evaluate generic image without handling boundary conditions
82  ///
83  /// This version is faster than EvaluateOutside, but is only defined inside
84  /// the domain for which all image values required for interpolation are
85  /// defined and thus require no extrapolation of the finite image.
86  virtual VoxelType GetInside(double, double, double, double) const;
87 
88  /// Evaluate generic image at an arbitrary location (in pixels)
89  virtual VoxelType GetOutside(double, double, double, double) const;
90 
91  /// Evaluate generic image without handling boundary conditions
92  ///
93  /// If the location is partially inside the foreground region of the image,
94  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
95  /// 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  /// If the location is partially inside the foreground region of the image,
105  /// only the foreground values are interpolated. Otherwise, the _DefaultValue
106  /// is returned.
107  virtual VoxelType GetWithPaddingOutside(double, double, double, double) const;
108 
109 };
110 
111 
112 /**
113  * Gaussian interpolation of any 4D image
114  */
117 {
118  mirtkObjectMacro(GaussianInterpolateImageFunction4D);
119 
120 public:
121 
122  /// Constructor
124  :
126  {}
127 
128 };
129 
130 
131 } // namespace mirtk
132 
133 #endif // MIRTK_GaussianInterpolateImageFunction4D_H
virtual VoxelType GetOutside(double, double, double, double) const
Evaluate generic image at an arbitrary location (in pixels)
VoxelType Get(double, double, double, double) const
Definition: IOConfig.h:41
virtual VoxelType GetWithPaddingOutside(double, double, double, double) const
GenericGaussianInterpolateImageFunction4D(double sigma=1.0)
Default constructor.
virtual VoxelType GetWithPaddingInside(double, double, double, double) const
VoxelType GetWithPadding(double, double, double, double) const
virtual VoxelType GetInside(double, double, double, double) const