ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkBSplineDecompositionImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
72 template< typename TInputImage, typename TOutputImage >
73 class ITK_TEMPLATE_EXPORT BSplineDecompositionImageFilter:
74  public ImageToImageFilter< TInputImage, TOutputImage >
75 {
76 public:
77  ITK_DISALLOW_COPY_AND_ASSIGN(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 
97  using CoeffType = typename itk::NumericTraits< typename TOutputImage::PixelType >::RealType;
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 SetSplineOrder(unsigned int SplineOrder);
111 
112  itkGetConstMacro(SplineOrder, int);
113 
115  itkGetConstMacro( SplinePoles, SplinePolesVectorType );
116 
118  itkGetConstMacro( NumberOfPoles, int );
119 
120 
121 #ifdef ITK_USE_CONCEPT_CHECKING
122  // Begin concept checking
123  itkConceptMacro( DimensionCheck,
125  itkConceptMacro( InputConvertibleToOutputCheck,
126  ( Concept::Convertible< typename TInputImage::PixelType,
127  typename TOutputImage::PixelType > ) );
128  itkConceptMacro( DoubleConvertibleToOutputCheck,
130  // End concept checking
131 #endif
132 
133 protected:
135  ~BSplineDecompositionImageFilter() override = default;
136  void PrintSelf(std::ostream & os, Indent indent) const override;
137 
138  void GenerateData() override;
139 
141  void GenerateInputRequestedRegion() override;
142 
144  void EnlargeOutputRequestedRegion(DataObject *output) override;
145 
146 private:
147  using CoefficientsVectorType = std::vector< CoeffType >;
148 
150  virtual void SetPoles();
151 
153  virtual bool DataToCoefficients1D();
154 
157  void DataToCoefficientsND();
158 
160  virtual void SetInitialCausalCoefficient(double z);
161 
164  virtual void SetInitialAntiCausalCoefficient(double z);
165 
168  void CopyImageToImage();
169 
172  void CopyCoefficientsToScratch(OutputLinearIterator &);
173 
176  void CopyScratchToCoefficients(OutputLinearIterator &);
177 
178  // Variables needed by the smoothing spline routine.
179 
182 
185 
187  unsigned int m_SplineOrder{ 0 };
188 
190 
192 
194  double m_Tolerance{ 1e-10 };
195 
197  unsigned int m_IteratorDirection{ 0 };
198 };
199 } // namespace itk
200 
201 #ifndef ITK_MANUAL_INSTANTIATION
202 #include "itkBSplineDecompositionImageFilter.hxx"
203 #endif
204 
205 #endif
typename OutputImageType::Pointer OutputImagePointer
A multi-dimensional image iterator that visits image pixels within a region in a &quot;scan-line&quot; order...
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename InputImageType::Pointer InputImagePointer
Calculates the B-Spline coefficients of an image. Spline order may be from 0 to 5.
static constexpr double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:53
Base class for filters that take an image as input and produce an image as output.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename itk::NumericTraits< typename TOutputImage::PixelType >::RealType CoeffType
#define itkConceptMacro(name, concept)
typename InputImageType::ConstPointer InputImageConstPointer
Base class for all data objects in ITK.