ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkBSplineControlPointImageFilter.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 itkBSplineControlPointImageFilter_h
19#define itkBSplineControlPointImageFilter_h
20
24#include "itkFixedArray.h"
25#include "itkPointSet.h"
27#include "itkVector.h"
28#include "itkVectorContainer.h"
29
30#include "vnl/vnl_matrix.h"
31#include "vnl/vnl_vector.h"
32
33namespace itk
34{
35
55
56template <typename TInputImage, typename TOutputImage = TInputImage>
57class ITK_TEMPLATE_EXPORT BSplineControlPointImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
58{
59public:
60 ITK_DISALLOW_COPY_AND_MOVE(BSplineControlPointImageFilter);
61
66
68 itkNewMacro(Self);
69
71 itkOverrideGetNameOfClassMacro(BSplineControlPointImageFilter);
72
74 static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
75
76 using ControlPointLatticeType = TInputImage;
77 using OutputImageType = TOutputImage;
78
80 using PixelType = typename OutputImageType::PixelType;
81 using RegionType = typename OutputImageType::RegionType;
82 using IndexType = typename OutputImageType::IndexType;
83 using PointType = typename OutputImageType::PointType;
84 using OutputImageRegionType = typename OutputImageType::RegionType;
85
86 using SpacingType = typename OutputImageType::SpacingType;
87 using OriginType = typename OutputImageType::PointType;
88 using SizeType = typename OutputImageType::SizeType;
89 using DirectionType = typename OutputImageType::DirectionType;
90
92 using RealType = float;
95
98
105
112
117 void
118 SetSplineOrder(unsigned int);
119
125
129 itkGetConstReferenceMacro(SplineOrder, ArrayType);
130
148 itkSetMacro(CloseDimension, ArrayType);
149 itkGetConstReferenceMacro(CloseDimension, ArrayType);
155 itkSetMacro(Spacing, SpacingType);
156 itkGetConstMacro(Spacing, SpacingType);
162 itkSetMacro(Origin, OriginType);
163 itkGetConstMacro(Origin, OriginType);
169 itkSetMacro(Size, SizeType);
170 itkGetConstMacro(Size, SizeType);
186 itkSetMacro(Direction, DirectionType);
187
191 itkGetConstMacro(Direction, DirectionType);
192
200 typename ControlPointLatticeType::Pointer RefineControlPointLattice(ArrayType);
201
202protected:
205 void
206 PrintSelf(std::ostream & os, Indent indent) const override;
207
209 void
211
213 void
215
217 void
219
220private:
222 void
224
229 unsigned int
230 SplitRequestedRegion(unsigned int, unsigned int, OutputImageRegionType &) override;
231
236 void
238
243
249
250 bool m_DoMultilevel{ false };
251 unsigned int m_MaximumNumberOfLevels{ 1 };
256
258
264
265 RealType m_BSplineEpsilon{ static_cast<RealType>(1e-3) };
266
267 inline typename RealImageType::IndexType
268 NumberToIndex(unsigned int number, typename RealImageType::SizeType size)
269 {
270 typename RealImageType::IndexType k;
271 k[0] = 1;
272
273 for (unsigned int i = 1; i < ImageDimension; ++i)
274 {
275 k[i] = size[ImageDimension - i - 1] * k[i - 1];
276 }
277 typename RealImageType::IndexType index;
278 for (unsigned int i = 0; i < ImageDimension; ++i)
279 {
280 index[ImageDimension - i - 1] = static_cast<unsigned int>(number / k[ImageDimension - i - 1]);
281 number %= k[ImageDimension - i - 1];
282 }
283 return index;
284 }
285};
286
287} // end namespace itk
288
289#ifndef ITK_MANUAL_INSTANTIATION
290# include "itkBSplineControlPointImageFilter.hxx"
291#endif
292
293#endif
FixedArray< unsigned int, Self::ImageDimension > ArrayType
void BeforeThreadedGenerateData() override
void PrintSelf(std::ostream &os, Indent indent) const override
typename OutputImageType::SpacingType SpacingType
unsigned int SplitRequestedRegion(unsigned int, unsigned int, OutputImageRegionType &) override
void GenerateInputRequestedRegion() override
void CollapsePhiLattice(PointDataImageType *, PointDataImageType *, const RealType, const unsigned int)
typename OutputImageType::DirectionType DirectionType
typename OutputImageType::PointType PointType
~BSplineControlPointImageFilter() override=default
FixedArray< RealType, Self::ImageDimension > RealArrayType
RealImageType::IndexType NumberToIndex(unsigned int number, typename RealImageType::SizeType size)
typename OutputImageType::RegionType OutputImageRegionType
typename OutputImageType::PointType OriginType
Image< PointDataType, Self::ImageDimension > PointDataImageType
ControlPointLatticeType::Pointer RefineControlPointLattice(ArrayType)
typename PointSetType::PointDataContainer PointDataContainerType
typename OutputImageType::PixelType PixelType
void DynamicThreadedGenerateData(const OutputImageRegionType &) override
typename OutputImageType::RegionType RegionType
ImageToImageFilter< TInputImage, TOutputImage > Superclass
PointSet< PixelType, Self::ImageDimension > PointSetType
typename OutputImageType::IndexType IndexType
Image< RealType, Self::ImageDimension > RealImageType
typename PointDataImageType::Pointer PointDataImagePointer
BSpline kernel used for density estimation and nonparametric regression.
BSpline kernel used for density estimation and nonparametric regression.
Simulate a standard C array with copy semantics.
Templated n-dimensional image class.
Definition itkImage.h:89
Control indentation during Print() invocation.
Definition itkIndent.h:53
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition itkPointSet.h:82
typename MeshTraits::PixelType PixelType
typename MeshTraits::PointDataContainer PointDataContainer
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition itkSize.h:70