FastLinearImageGradientFunction2D.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_FastLinearImageGradientFunction2D_HXX
21 #define MIRTK_FastLinearImageGradientFunction2D_HXX
22 
23 #include "mirtk/FastLinearImageGradientFunction2D.h"
24 #include "mirtk/FastLinearImageGradientFunction.hxx"
25 
26 
27 namespace mirtk {
28 
29 
30 // -----------------------------------------------------------------------------
31 template <class TImage>
34 {
35  this->NumberOfDimensions(2);
36 }
37 
38 // -----------------------------------------------------------------------------
39 template <class TImage>
42 ::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>
51 ::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>
60 ::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>
69 ::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>
78 ::GetInside(double x, double y, double z, double t) const
79 {
80  return this->Get(this->Input(), x, y, z, t);
81 }
82 
83 // -----------------------------------------------------------------------------
84 template <class TImage>
87 ::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>
100 ::GetWithPaddingInside(double x, double y, double z, double t) const
101 {
102  return this->GetWithPadding(this->Input(), x, y, z, t);
103 }
104 
105 // -----------------------------------------------------------------------------
106 template <class TImage>
109 ::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_FastLinearImageGradientFunction2D_HXX
GradientType GetWithPadding(double, double, double=0, double=0) const
string Get(const ParameterList &params, string name)
Get parameter value from parameters list.
Definition: Object.h:202
virtual GradientType GetInside(double, double, double=0, double=0) const
virtual GradientType GetWithPaddingInside(double, double, double=0, double=0) const
virtual GradientType GetOutside(double, double, double=0, double=0) const
Evaluate image gradient at an arbitrary location (in pixels)
Definition: IOConfig.h:41
GradientType Get(double, double, double=0, double=0) const
virtual GradientType GetWithPaddingOutside(double, double, double=0, double=0) const