ITK  5.2.0
Insight Toolkit
itkBSplineDecompositionImageFilter.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  * http://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  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkBSplineDecompositionImageFilter_h
29 #define itkBSplineDecompositionImageFilter_h
30 
31 #include <vector>
32 
34 #include "vnl/vnl_matrix.h"
35 
36 #include "itkImageToImageFilter.h"
37 
38 namespace itk
39 {
73 template <typename TInputImage, typename TOutputImage>
74 class ITK_TEMPLATE_EXPORT BSplineDecompositionImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
75 {
76 public:
77  ITK_DISALLOW_COPY_AND_MOVE(BSplineDecompositionImageFilter);
78 
84 
87 
89  itkNewMacro(Self);
90 
92  using InputImageType = typename Superclass::InputImageType;
93  using InputImagePointer = typename Superclass::InputImagePointer;
94  using InputImageConstPointer = typename Superclass::InputImageConstPointer;
95  using OutputImagePointer = typename Superclass::OutputImagePointer;
96 
98 
100  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
101  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
102 
105 
106  using SplinePolesVectorType = std::vector<double>;
107 
110  void
111  SetSplineOrder(unsigned int SplineOrder);
112 
113  itkGetConstMacro(SplineOrder, int);
114 
116  itkGetConstMacro(SplinePoles, SplinePolesVectorType);
117 
119  itkGetConstMacro(NumberOfPoles, int);
120 
121 
122 #ifdef ITK_USE_CONCEPT_CHECKING
123  // Begin concept checking
125  itkConceptMacro(InputConvertibleToOutputCheck,
128  // End concept checking
129 #endif
130 
131 protected:
133  ~BSplineDecompositionImageFilter() override = default;
134  void
135  PrintSelf(std::ostream & os, Indent indent) const override;
136 
137  void
138  GenerateData() override;
139 
141  void
142  GenerateInputRequestedRegion() override;
143 
145  void
146  EnlargeOutputRequestedRegion(DataObject * output) override;
147 
148 private:
149  using CoefficientsVectorType = std::vector<CoeffType>;
150 
152  virtual void
153  SetPoles();
154 
156  virtual bool
157  DataToCoefficients1D();
158 
161  void
162  DataToCoefficientsND();
163 
165  virtual void
166  SetInitialCausalCoefficient(double z);
167 
170  virtual void
171  SetInitialAntiCausalCoefficient(double z);
172 
175  void
176  CopyImageToImage();
177 
180  void
181  CopyCoefficientsToScratch(OutputLinearIterator &);
182 
185  void
186  CopyScratchToCoefficients(OutputLinearIterator &);
187 
188  // Variables needed by the smoothing spline routine.
189 
192 
195 
197  unsigned int m_SplineOrder{ 0 };
198 
200 
202 
204  double m_Tolerance{ 1e-10 };
205 
207  unsigned int m_IteratorDirection{ 0 };
208 };
209 } // namespace itk
210 
211 #ifndef ITK_MANUAL_INSTANTIATION
212 # include "itkBSplineDecompositionImageFilter.hxx"
213 #endif
214 
215 #endif
itk::BSplineDecompositionImageFilter::CoefficientsVectorType
std::vector< CoeffType > CoefficientsVectorType
Definition: itkBSplineDecompositionImageFilter.h:149
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::BSplineDecompositionImageFilter::m_DataLength
TInputImage::SizeType m_DataLength
Definition: itkBSplineDecompositionImageFilter.h:194
itk::BSplineDecompositionImageFilter
Calculates the B-Spline coefficients of an image. Spline order may be from 0 to 5.
Definition: itkBSplineDecompositionImageFilter.h:74
itk::ImageLinearIteratorWithIndex
A multi-dimensional image iterator that visits image pixels within a region in a "scan-line" order.
Definition: itkImageLinearIteratorWithIndex.h:67
itk::BSplineDecompositionImageFilter::m_Scratch
CoefficientsVectorType m_Scratch
Definition: itkBSplineDecompositionImageFilter.h:191
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BSplineDecompositionImageFilter::m_NumberOfPoles
int m_NumberOfPoles
Definition: itkBSplineDecompositionImageFilter.h:201
itk::BSplineDecompositionImageFilter::SplinePolesVectorType
std::vector< double > SplinePolesVectorType
Definition: itkBSplineDecompositionImageFilter.h:106
itk::Concept::SameDimension
Definition: itkConceptChecking.h:694
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itkImageLinearIteratorWithIndex.h
itk::BSplineDecompositionImageFilter::m_SplinePoles
SplinePolesVectorType m_SplinePoles
Definition: itkBSplineDecompositionImageFilter.h:199
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::BSplineDecompositionImageFilter::CoeffType
typename itk::NumericTraits< typename TOutputImage::PixelType >::RealType CoeffType
Definition: itkBSplineDecompositionImageFilter.h:97
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Math::e
static constexpr double e
Definition: itkMath.h:54
itk::NumericTraits::RealType
double RealType
Definition: itkNumericTraits.h:84
itk::ImageToImageFilter::InputImageConstPointer
typename InputImageType::ConstPointer InputImageConstPointer
Definition: itkImageToImageFilter.h:131
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293