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_SincInterpolateImageFunction2D_HXX
21 #define MIRTK_SincInterpolateImageFunction2D_HXX
22 
23 #include "mirtk/SincInterpolateImageFunction2D.h"
24 #include "mirtk/SincInterpolateImageFunction.hxx"
25 
26 
27 namespace mirtk {
28 
29 
30 // -----------------------------------------------------------------------------
31 template <class TImage>
32 GenericSincInterpolateImageFunction2D<TImage>
GenericSincInterpolateImageFunction2D()33 ::GenericSincInterpolateImageFunction2D()
34 {
35   this->NumberOfDimensions(2);
36 }
37 
38 // -----------------------------------------------------------------------------
39 template <class TImage>
40 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
41 GenericSincInterpolateImageFunction2D<TImage>
Get(double x,double y,double z,double t) const42 ::Get(double x, double y, double z, double t) const
43 {
44   return this->Get2D(x, y, z, t);
45 }
46 
47 // -----------------------------------------------------------------------------
48 template <class TImage>
49 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
50 GenericSincInterpolateImageFunction2D<TImage>
GetWithPadding(double x,double y,double z,double t) const51 ::GetWithPadding(double x, double y, double z, double t) const
52 {
53   return this->GetWithPadding2D(x, y, z, t);
54 }
55 
56 // -----------------------------------------------------------------------------
57 template <class TImage> template <class TOtherImage>
58 inline typename TOtherImage::VoxelType
59 GenericSincInterpolateImageFunction2D<TImage>
Get(const TOtherImage * input,double x,double y,double z,double t) const60 ::Get(const TOtherImage *input, double x, double y, double z, double t) const
61 {
62   return this->Get2D(input, x, y, z, t);
63 }
64 
65 // -----------------------------------------------------------------------------
66 template <class TImage> template <class TOtherImage>
67 inline typename TOtherImage::VoxelType
68 GenericSincInterpolateImageFunction2D<TImage>
GetWithPadding(const TOtherImage * input,double x,double y,double z,double t) const69 ::GetWithPadding(const TOtherImage *input, double x, double y, double z, double t) const
70 {
71   return this->GetWithPadding2D(input, x, y, z, t);
72 }
73 
74 // -----------------------------------------------------------------------------
75 template <class TImage>
76 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
77 GenericSincInterpolateImageFunction2D<TImage>
GetInside(double x,double y,double z,double t) const78 ::GetInside(double x, double y, double z, double t) const
79 {
80   return Get(this->Input(), x, y, z, t);
81 }
82 
83 // -----------------------------------------------------------------------------
84 template <class TImage>
85 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
86 GenericSincInterpolateImageFunction2D<TImage>
GetOutside(double x,double y,double z,double t) const87 ::GetOutside(double x, double y, double z, double t) const
88 {
89   if (this->Extrapolator()) {
90     return Get(this->Extrapolator(), x, y, z, t);
91   } else {
92     return Get(x, y, z, t);
93   }
94 }
95 
96 // -----------------------------------------------------------------------------
97 template <class TImage>
98 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
99 GenericSincInterpolateImageFunction2D<TImage>
GetWithPaddingInside(double x,double y,double z,double t) const100 ::GetWithPaddingInside(double x, double y, double z, double t) const
101 {
102   return GetWithPadding(this->Input(), x, y, z, t);
103 }
104 
105 // -----------------------------------------------------------------------------
106 template <class TImage>
107 inline typename GenericSincInterpolateImageFunction2D<TImage>::VoxelType
108 GenericSincInterpolateImageFunction2D<TImage>
GetWithPaddingOutside(double x,double y,double z,double t) const109 ::GetWithPaddingOutside(double x, double y, double z, double t) const
110 {
111   if (this->Extrapolator()) {
112     return GetWithPadding(this->Extrapolator(), x, y, z, t);
113   } else {
114     return GetWithPadding(x, y, z, t);
115   }
116 }
117 
118 
119 } // namespace mirtk
120 
121 #endif // MIRTK_SincInterpolateImageFunction2D_HXX
122