ITK  6.0.0
Insight Toolkit
itkGaussianInterpolateImageFunction.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef itkGaussianInterpolateImageFunction_h
20#define itkGaussianInterpolateImageFunction_h
21
23
24#include "itkConceptChecking.h"
25#include "itkFixedArray.h"
26#include "vnl/vnl_erf.h"
27
28namespace itk
29{
30
53template <typename TInputImage, typename TCoordRep = double>
54class ITK_TEMPLATE_EXPORT GaussianInterpolateImageFunction : public InterpolateImageFunction<TInputImage, TCoordRep>
55{
56public:
57 ITK_DISALLOW_COPY_AND_MOVE(GaussianInterpolateImageFunction);
58
64
66 itkOverrideGetNameOfClassMacro(GaussianInterpolateImageFunction);
67
69 itkNewMacro(Self);
70
72 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
73
74
76 using typename Superclass::OutputType;
77
79 using typename Superclass::InputImageType;
80
82 using typename Superclass::RealType;
83
85 using typename Superclass::IndexType;
86
88 using typename Superclass::SizeType;
89
91 using typename Superclass::ContinuousIndexType;
92
95
97 void
98 SetInputImage(const TInputImage * image) override
99 {
100 Superclass::SetInputImage(image);
101 this->ComputeBoundingBox();
102 }
106 virtual void
108 {
109 if (this->m_Sigma != s)
110 {
111 this->m_Sigma = s;
112 this->ComputeBoundingBox();
113 this->Modified();
114 }
115 }
116 virtual void
118 {
119 ArrayType sigma;
120 for (unsigned int d = 0; d < ImageDimension; ++d)
121 {
122 sigma[d] = s[d];
123 }
124 this->SetSigma(sigma);
125 }
126 itkGetConstMacro(Sigma, ArrayType);
130 virtual void
132 {
133 if (Math::NotExactlyEquals(this->m_Alpha, a))
134 {
135 this->m_Alpha = a;
136 this->ComputeBoundingBox();
137 this->Modified();
138 }
139 }
140 itkGetConstMacro(Alpha, RealType);
144 virtual void
146 {
147 this->SetSigma(sigma);
148 this->SetAlpha(alpha);
149 }
153 OutputType
154 EvaluateAtContinuousIndex(const ContinuousIndexType & cindex) const override
155 {
156 return this->EvaluateAtContinuousIndex(cindex, nullptr);
157 }
158
160 GetRadius() const override;
161
162protected:
165 void
166 PrintSelf(std::ostream & os, Indent indent) const override;
167
168 virtual void
170
172
176
177 virtual void
179 unsigned int dimension,
180 RealType cindex,
181 vnl_vector<RealType> & erfArray,
182 vnl_vector<RealType> & gerfArray,
183 bool evaluateGradient = false) const;
184
186 itkSetMacro(BoundingBoxStart, ArrayType);
187 itkGetConstMacro(BoundingBoxStart, ArrayType);
191 itkSetMacro(BoundingBoxEnd, ArrayType);
192 itkGetConstMacro(BoundingBoxEnd, ArrayType);
196 itkSetMacro(CutOffDistance, ArrayType);
197 itkGetConstMacro(CutOffDistance, ArrayType);
201private:
203 virtual OutputType
205
206 ArrayType m_Sigma{};
207 RealType m_Alpha{};
208
209 ArrayType m_BoundingBoxStart{};
210 ArrayType m_BoundingBoxEnd{};
211 ArrayType m_ScalingFactor{};
212 ArrayType m_CutOffDistance{};
213};
214
215} // end namespace itk
216
217#ifndef ITK_MANUAL_INSTANTIATION
218# include "itkGaussianInterpolateImageFunction.hxx"
219# include "itkMath.h"
220#endif
221
222#endif
Evaluates the Gaussian interpolation of an image.
virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &, OutputType *) const
virtual void ComputeErrorFunctionArray(const RegionType &region, unsigned int dimension, RealType cindex, vnl_vector< RealType > &erfArray, vnl_vector< RealType > &gerfArray, bool evaluateGradient=false) const
SizeType GetRadius() const override
void SetInputImage(const TInputImage *image) override
~GaussianInterpolateImageFunction() override=default
virtual void SetParameters(RealType *sigma, RealType alpha)
RegionType ComputeInterpolationRegion(const ContinuousIndexType &) const
OutputType EvaluateAtContinuousIndex(const ContinuousIndexType &cindex) const override
void PrintSelf(std::ostream &os, Indent indent) const override
An image region represents a structured region of data.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for all image interpolators.
typename NumericTraits< typename TInputImage::PixelType >::RealType RealType
Light weight base class for most itk classes.
bool NotExactlyEquals(const TInput1 &x1, const TInput2 &x2)
Definition: itkMath.h:737
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....