ITK  4.13.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:
82 
85 
87  itkNewMacro(Self);
88 
90  typedef typename Superclass::InputImageType InputImageType;
91  typedef typename Superclass::InputImagePointer InputImagePointer;
92  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
93  typedef typename Superclass::OutputImagePointer OutputImagePointer;
94 
96 
98  itkStaticConstMacro(ImageDimension, unsigned int, TInputImage::ImageDimension);
99  itkStaticConstMacro(OutputImageDimension, unsigned int,
100  TOutputImage::ImageDimension);
102 
105 
106  typedef std::vector< double > SplinePolesVectorType;
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  virtual ~BSplineDecompositionImageFilter() ITK_OVERRIDE {}
136  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
137 
138  void GenerateData() ITK_OVERRIDE;
139 
141  void GenerateInputRequestedRegion() ITK_OVERRIDE;
142 
144  void EnlargeOutputRequestedRegion(DataObject *output) ITK_OVERRIDE;
145 
146 private:
147  typedef std::vector< CoeffType > CoefficientsVectorType;
148 
149  ITK_DISALLOW_COPY_AND_ASSIGN(BSplineDecompositionImageFilter);
150 
152  virtual void SetPoles();
153 
155  virtual bool DataToCoefficients1D();
156 
159  void DataToCoefficientsND();
160 
162  virtual void SetInitialCausalCoefficient(double z);
163 
166  virtual void SetInitialAntiCausalCoefficient(double z);
167 
170  void CopyImageToImage();
171 
174  void CopyCoefficientsToScratch(OutputLinearIterator &);
175 
178  void CopyScratchToCoefficients(OutputLinearIterator &);
179 
180  // Variables needed by the smoothing spline routine.
181 
183  CoefficientsVectorType m_Scratch;
184 
186  typename TInputImage::SizeType m_DataLength;
187 
189  unsigned int m_SplineOrder;
190 
191  SplinePolesVectorType m_SplinePoles;
192 
193  int m_NumberOfPoles;
194 
196  double m_Tolerance;
197 
199  unsigned int m_IteratorDirection;
200 };
201 } // namespace itk
202 
203 #ifndef ITK_MANUAL_INSTANTIATION
204 #include "itkBSplineDecompositionImageFilter.hxx"
205 #endif
206 
207 #endif
A multi-dimensional image iterator that visits image pixels within a region in a &quot;scan-line&quot; order...
ImageLinearIteratorWithIndex< TOutputImage > OutputLinearIterator
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Base class for all process objects that output image data.
itk::NumericTraits< typename TOutputImage::PixelType >::RealType CoeffType
Calculates the B-Spline coefficients of an image. Spline order may be from 0 to 5.
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
#define itkConceptMacro(name, concept)
Superclass::InputImageConstPointer InputImageConstPointer
Base class for all data objects in ITK.