ITK  6.0.0
Insight Toolkit
itkBSplineScatteredDataPointSetToImageFilter.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 itkBSplineScatteredDataPointSetToImageFilter_h
19#define itkBSplineScatteredDataPointSetToImageFilter_h
20
22
25#include "itkVectorContainer.h"
26
27#include "vnl/vnl_matrix.h"
28
29namespace itk
30{
131template <typename TInputPointSet, typename TOutputImage>
133 : public PointSetToImageFilter<TInputPointSet, TOutputImage>
134{
135public:
136 ITK_DISALLOW_COPY_AND_MOVE(BSplineScatteredDataPointSetToImageFilter);
137
143
145 itkNewMacro(Self);
146
148 itkOverrideGetNameOfClassMacro(BSplineScatteredDataPointSetToImageFilter);
149
151 static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
152
153 using ImageType = TOutputImage;
154 using PointSetType = TInputPointSet;
155
157 using PixelType = typename ImageType::PixelType;
162
166 using PointDataType = typename PointSetType::PixelType;
167 using PointDataContainerType = typename PointSetType::PointDataContainer;
169
171 using RealType = float;
173
181
188
189
194 void
195 SetSplineOrder(unsigned int);
196
200 void
202
206 itkGetConstReferenceMacro(SplineOrder, ArrayType);
207
212 itkSetMacro(NumberOfControlPoints, ArrayType);
213 itkGetConstReferenceMacro(NumberOfControlPoints, ArrayType);
220 itkGetConstReferenceMacro(CurrentNumberOfControlPoints, ArrayType);
221
226 void
227 SetNumberOfLevels(unsigned int);
228
233 void
235
240 itkGetConstReferenceMacro(NumberOfLevels, ArrayType);
241
248 itkSetMacro(BSplineEpsilon, RealType);
249 itkGetConstMacro(BSplineEpsilon, RealType);
268 itkSetMacro(CloseDimension, ArrayType);
269 itkGetConstReferenceMacro(CloseDimension, ArrayType);
274 void
276
280 itkSetMacro(GenerateOutputImage, bool);
281 itkGetConstReferenceMacro(GenerateOutputImage, bool);
282 itkBooleanMacro(GenerateOutputImage);
288 {
289 return static_cast<PointDataImageType *>(this->ProcessObject::GetOutput(1));
290 }
291
292protected:
295
296 void
297 PrintSelf(std::ostream & os, Indent indent) const override;
298
299 void
301
302 void
304 {
305 itkExceptionMacro("This class requires threadId so it must use classic multi-threading model");
306 }
307
308 void
310
311 void
313
314 unsigned int
315 SplitRequestedRegion(unsigned int, unsigned int, RegionType &) override;
316
317 void
318 GenerateData() override;
319
320private:
323 void
325
328 void
330
332 void
334
336 void
338
340 void
342
345 void
347
350 void
352
356 NumberToIndex(const unsigned int, const SizeType);
357
358 bool m_DoMultilevel{ false };
359 bool m_GenerateOutputImage{ true };
360 bool m_UsePointWeights{ false };
361 unsigned int m_MaximumNumberOfLevels{ 1 };
362 unsigned int m_CurrentLevel{ 0 };
363 ArrayType m_NumberOfControlPoints{};
364 ArrayType m_CurrentNumberOfControlPoints{};
365 ArrayType m_CloseDimension{};
366 ArrayType m_SplineOrder{};
367 ArrayType m_NumberOfLevels{};
368
369 typename WeightsContainerType::Pointer m_PointWeights{};
370
371 typename PointDataImageType::Pointer m_PhiLattice{};
372 typename PointDataImageType::Pointer m_PsiLattice{};
373
374 vnl_matrix<RealType> m_RefinedLatticeCoefficients[ImageDimension]{};
375
376 PointDataContainerPointer m_ResidualPointSetValues{};
377
378 typename KernelType::Pointer m_Kernel[ImageDimension]{};
379
380 typename KernelOrder0Type::Pointer m_KernelOrder0{};
381 typename KernelOrder1Type::Pointer m_KernelOrder1{};
382 typename KernelOrder2Type::Pointer m_KernelOrder2{};
383 typename KernelOrder3Type::Pointer m_KernelOrder3{};
384
385 std::vector<RealImagePointer> m_OmegaLatticePerThread{};
386 std::vector<PointDataImagePointer> m_DeltaLatticePerThread{};
387
388 RealType m_BSplineEpsilon{ static_cast<RealType>(1e-3) };
389 bool m_IsFittingComplete{ false };
390 bool m_DoUpdateResidualValues{ false };
391};
392} // end namespace itk
393
394#ifndef ITK_MANUAL_INSTANTIATION
395# include "itkBSplineScatteredDataPointSetToImageFilter.hxx"
396#endif
397
398#endif
BSpline kernel used for density estimation and nonparametric regression.
Image filter which provides a B-spline output approximation.
void ThreadedGenerateDataForReconstruction(const RegionType &, ThreadIdType)
void PrintSelf(std::ostream &os, Indent indent) const override
IndexType NumberToIndex(const unsigned int, const SizeType)
void SetPointWeights(WeightsContainerType *weights)
unsigned int SplitRequestedRegion(unsigned int, unsigned int, RegionType &) override
void ThreadedGenerateDataForUpdatingResidualValues(const RegionType &, ThreadIdType)
void CollapsePhiLattice(PointDataImageType *, PointDataImageType *, const RealType, const unsigned int)
~BSplineScatteredDataPointSetToImageFilter() override=default
void ThreadedGenerateDataForFitting(const RegionType &, ThreadIdType)
void ThreadedGenerateData(const RegionType &, ThreadIdType) override
BSpline kernel used for density estimation and nonparametric regression.
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
Templated n-dimensional image class.
Definition: itkImage.h:89
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for filters that take a PointSet as input and produce an image as output....
typename TOutputImage::SizeType SizeType
typename TOutputImage::PointType PointType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
DataObject * GetOutput(const DataObjectIdentifierType &key)
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
SmartPointer< Self > Pointer
static constexpr double e
Definition: itkMath.h:56
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:102