ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkDisplacementFieldToBSplineImageFilter.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#ifndef itkDisplacementFieldToBSplineImageFilter_h
19#define itkDisplacementFieldToBSplineImageFilter_h
20
22
24#include "itkPointSet.h"
25#include "itkVector.h"
26
27namespace itk
28{
29
40
41template <typename TInputImage,
43 typename TOutputImage = TInputImage>
44class ITK_TEMPLATE_EXPORT DisplacementFieldToBSplineImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
45{
46public:
47 ITK_DISALLOW_COPY_AND_MOVE(DisplacementFieldToBSplineImageFilter);
48
53
55 itkNewMacro(Self);
56
58 itkOverrideGetNameOfClassMacro(DisplacementFieldToBSplineImageFilter);
59
61 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
62
63 using InputFieldType = TInputImage;
64 using InputPointSetType = TInputPointSet;
65 using OutputFieldType = TOutputImage;
66
69 using InputFieldPointType = typename InputFieldType::PointType;
70
72 using PixelType = typename OutputFieldType::PixelType;
73 using VectorType = typename OutputFieldType::PixelType;
74 using RegionType = typename OutputFieldType::RegionType;
75 using IndexType = typename OutputFieldType::IndexType;
76
77 using SpacingType = typename OutputFieldType::SpacingType;
78 using OriginType = typename OutputFieldType::PointType;
79 using SizeType = typename OutputFieldType::SizeType;
80 using DirectionType = typename OutputFieldType::DirectionType;
81
82 using RealType = typename VectorType::RealValueType;
84
90
96
98 itkSetInputMacro(DisplacementField, InputFieldType);
99
101 itkGetInputMacro(DisplacementField, InputFieldType);
102
111
112 void
114 {
115 this->SetConfidenceImage(image);
116 }
117
118
120
125 void
127 {
128 this->SetPointSet(points);
129 }
130
131
133 void
135
137 void
139
141 void
143 {
144 this->SetBSplineDomainFromImage(const_cast<RealImageType *>(image));
145 }
146
148 void
150
152 void
154 {
155 this->SetBSplineDomainFromImage(const_cast<InputFieldType *>(field));
156 }
157
160
161 /* Set/Get b-spline domain origin. */
162 itkGetConstMacro(BSplineDomainOrigin, OriginType);
163
164 /* Set/Get b-spline domain spacing. */
165 itkGetConstMacro(BSplineDomainSpacing, SpacingType);
166
167 /* Set/Get b-spline domain size. */
168 itkGetConstMacro(BSplineDomainSize, SizeType);
169
170 /* Set/Get b-spline domain direction. */
171 itkGetConstMacro(BSplineDomainDirection, DirectionType);
172
173 /* Use input field to define the B-spline domain. */
174 itkSetMacro(UseInputFieldToDefineTheBSplineDomain, bool);
175 itkGetConstMacro(UseInputFieldToDefineTheBSplineDomain, bool);
176 itkBooleanMacro(UseInputFieldToDefineTheBSplineDomain);
177
181 itkSetMacro(SplineOrder, unsigned int);
182
186 itkGetConstMacro(SplineOrder, unsigned int);
187
195 itkSetMacro(NumberOfControlPoints, ArrayType);
196
204 itkGetConstMacro(NumberOfControlPoints, ArrayType);
205
212 itkSetMacro(NumberOfFittingLevels, ArrayType);
213
220 void
222 {
223 auto nlevels = MakeFilled<ArrayType>(n);
224 this->SetNumberOfFittingLevels(nlevels);
225 }
226
233 itkGetConstMacro(NumberOfFittingLevels, ArrayType);
234
239 itkBooleanMacro(EstimateInverse);
240 itkSetMacro(EstimateInverse, bool);
241 itkGetConstMacro(EstimateInverse, bool);
243
248 itkBooleanMacro(EnforceStationaryBoundary);
249 itkSetMacro(EnforceStationaryBoundary, bool);
250 itkGetConstMacro(EnforceStationaryBoundary, bool);
252
253protected:
256
259
261 void
262 PrintSelf(std::ostream & os, Indent indent) const override;
263
264 void
265 VerifyPreconditions() const override;
266
268 void
269 GenerateData() override;
270
271private:
272 bool m_EstimateInverse{ false };
274 unsigned int m_SplineOrder{ 3 };
277
278 typename WeightsContainerType::Pointer m_PointWeights{};
279 bool m_UsePointWeights{ false };
280
285
288};
289
290} // end namespace itk
291
292#ifndef ITK_MANUAL_INSTANTIATION
293# include "itkDisplacementFieldToBSplineImageFilter.hxx"
294#endif
295
296#endif
Image filter which provides a B-spline output approximation.
itkSetInputMacro(DisplacementField, InputFieldType)
void SetPointSetConfidenceWeights(WeightsContainerType *weights)
PointSet< typename ConstantVelocityFieldType::PixelType, ConstantVelocityFieldType::ImageDimension > InputPointSetType
ImageToImageFilter< ConstantVelocityFieldType, ConstantVelocityFieldType > Superclass
itkGetInputMacro(DisplacementField, InputFieldType)
itkGetInputMacro(PointSet, InputPointSetType)
void PrintSelf(std::ostream &os, Indent indent) const override
void SetBSplineDomain(OriginType, SpacingType, SizeType, DirectionType)
itkSetInputMacro(PointSet, InputPointSetType)
void VerifyPreconditions() const override
Verifies that the process object has been configured correctly, that all required inputs are set,...
void SetBSplineDomainFromImage(InputFieldType *)
itkSetInputMacro(ConfidenceImage, RealImageType)
void SetBSplineDomainFromImage(RealImageType *)
BSplineScatteredDataPointSetToImageFilter< InputPointSetType, OutputFieldType > BSplineFilterType
~DisplacementFieldToBSplineImageFilter() override=default
itkGetInputMacro(ConfidenceImage, RealImageType)
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:50
TPointsContainer PointsContainer
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition itkPointSet.h:82
typename MeshTraits::PixelType PixelType
typename MeshTraits::PointType PointType
typename MeshTraits::PointDataContainer PointDataContainer
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
constexpr TContainer MakeFilled(typename TContainer::const_reference value)