GaussianInterpolateImageFunction3D.hxx
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_GaussianInterpolateImageFunction3D_HXX
22 #define MIRTK_GaussianInterpolateImageFunction3D_HXX
23 
24 #include "mirtk/GaussianInterpolateImageFunction3D.h"
25 #include "mirtk/GaussianInterpolateImageFunction.hxx"
26 
27 
28 namespace mirtk {
29 
30 
31 // -----------------------------------------------------------------------------
32 template <class TImage>
35 :
37 {
38  this->NumberOfDimensions(3);
39 }
40 
41 // -----------------------------------------------------------------------------
42 template <class TImage>
43 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
45 ::Get(double x, double y, double z, double t) const
46 {
47  return this->Get3D(x, y, z, t);
48 }
49 
50 // -----------------------------------------------------------------------------
51 template <class TImage>
52 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
54 ::GetWithPadding(double x, double y, double z, double t) const
55 {
56  return this->GetWithPadding3D(x, y, z, t);
57 }
58 
59 // -----------------------------------------------------------------------------
60 template <class TImage> template <class TOtherImage>
61 inline typename TOtherImage::VoxelType
63 ::Get(const TOtherImage *input, double x, double y, double z, double t) const
64 {
65  return this->Get3D(input, x, y, z, t);
66 }
67 
68 // -----------------------------------------------------------------------------
69 template <class TImage> template <class TOtherImage>
70 inline typename TOtherImage::VoxelType
72 ::GetWithPadding(const TOtherImage *input, double x, double y, double z, double t) const
73 {
74  return this->GetWithPadding3D(input, x, y, z, t);
75 }
76 
77 // -----------------------------------------------------------------------------
78 template <class TImage>
79 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
81 ::GetInside(double x, double y, double z, double t) const
82 {
83  return Get(this->Input(), x, y, z, t);
84 }
85 
86 // -----------------------------------------------------------------------------
87 template <class TImage>
88 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
90 ::GetOutside(double x, double y, double z, double t) const
91 {
92  if (this->Extrapolator()) {
93  return Get(this->Extrapolator(), x, y, z, t);
94  } else {
95  return Get(x, y, z, t);
96  }
97 }
98 
99 // -----------------------------------------------------------------------------
100 template <class TImage>
101 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
103 ::GetWithPaddingInside(double x, double y, double z, double t) const
104 {
105  return GetWithPadding(this->Input(), x, y, z, t);
106 }
107 
108 // -----------------------------------------------------------------------------
109 template <class TImage>
110 inline typename GenericGaussianInterpolateImageFunction3D<TImage>::VoxelType
112 ::GetWithPaddingOutside(double x, double y, double z, double t) const
113 {
114  if (this->Extrapolator()) {
115  return GetWithPadding(this->Extrapolator(), x, y, z, t);
116  } else {
117  return GetWithPadding(x, y, z, t);
118  }
119 }
120 
121 
122 } // namespace mirtk
123 
124 #endif // MIRTK_GaussianInterpolateImageFunction3D_HXX
VoxelType GetWithPadding(double, double, double, double=0) const
string Get(const ParameterList &params, string name)
Get parameter value from parameters list.
Definition: Object.h:202
GenericGaussianInterpolateImageFunction3D(double sigma=1.0)
Default constructor.
virtual VoxelType GetWithPaddingInside(double, double, double, double=0) const
VoxelType Get(double, double, double, double=0) const
Definition: IOConfig.h:41
virtual VoxelType GetWithPaddingOutside(double, double, double, double=0) const
virtual VoxelType GetInside(double, double, double, double=0) const
virtual VoxelType GetOutside(double, double, double, double=0) const
Evaluate generic image at an arbitrary location (in pixels)