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