ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkBSplineResampleImageFilterBase.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 itkBSplineResampleImageFilterBase_h
29 #define itkBSplineResampleImageFilterBase_h
30 
31 #include <vector>
32 
34 #include "itkImageRegionIterator.h" // Used for the output iterator needs to
35  // match filter program
36 #include "itkProgressReporter.h"
37 #include "itkImageToImageFilter.h"
38 
39 namespace itk
40 {
81 template< typename TInputImage, typename TOutputImage >
82 class ITK_TEMPLATE_EXPORT BSplineResampleImageFilterBase:
83  public ImageToImageFilter< TInputImage, TOutputImage >
84 {
85 public:
91 
94 
96  // Must be sustantiated through another class. itkNewMacro( Self );
97 
99  typedef typename Superclass::InputImageType InputImageType;
100 
102  itkStaticConstMacro(ImageDimension, unsigned int,
103  TInputImage::ImageDimension);
104 
107 
109  typedef typename TInputImage::SizeType SizeType;
110 
112  typedef typename TInputImage::RegionType RegionType;
113 
115  typedef typename Superclass::OutputImagePixelType OutputImagePixelType;
116 
119 
122 
125 
128  void SetSplineOrder(int SplineOrder);
129 
131  itkGetConstMacro(SplineOrder, int);
132 
133 protected:
135  void ReduceNDImage(OutputImageIterator & OutItr);
136 
138  void ExpandNDImage(OutputImageIterator & OutItr);
139 
142  virtual void InitializePyramidSplineFilter(int SplineOrder);
143 
145  virtual void Reduce1DImage(
146  const std::vector< double > & In,
147  OutputImageIterator & Iter,
148  unsigned int traverseSize,
149  ProgressReporter & progress
150  );
151 
153  virtual void Expand1DImage(
154  const std::vector< double > & In,
155  OutputImageIterator & Iter,
156  unsigned int traverseSize,
157  ProgressReporter & progress
158  );
159 
161  virtual ~BSplineResampleImageFilterBase() ITK_OVERRIDE {}
162  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
163 
164  int m_SplineOrder; // User specified spline order
165  int m_GSize; // downsampling filter size
166  int m_HSize; // upsampling filter size
167 
168  std::vector< double > m_G; // downsampling filter coefficients
169  std::vector< double > m_H; // upsampling filter coefficients
170 
171 private:
172 
173  // Resizes m_Scratch Variable based on image sizes
174  void InitializeScratch(SizeType DataLength);
175 
176  // Copies a line of data from the input to the m_Scratch for subsequent
177  // processing
178  void CopyInputLineToScratch(ConstInputImageIterator & Iter);
179 
180  void CopyOutputLineToScratch(ConstOutputImageIterator & Iter);
181 
182  void CopyLineToScratch(ConstInputImageIterator & Iter);
183 
184  std::vector< double > m_Scratch; // temp storage for processing
185  // of Coefficients
186 
187  ITK_DISALLOW_COPY_AND_ASSIGN(BSplineResampleImageFilterBase);
188 };
189 } // namespace itk
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 #include "itkBSplineResampleImageFilterBase.hxx"
193 #endif
194 
195 #endif
A multi-dimensional image iterator that visits image pixels within a region in a &quot;scan-line&quot; order...
itk::ImageLinearIteratorWithIndex< TOutputImage > OutputImageIterator
A multi-dimensional image iterator that visits image pixels within a region in a &quot;scan-line&quot; order...
Superclass::OutputImagePixelType OutputImagePixelType
Uses the &quot;l2&quot; spline pyramid implementation of B-Spline Filters to up/down sample an image by a facto...
itk::ImageLinearConstIteratorWithIndex< TOutputImage > ConstOutputImageIterator
ImageToImageFilter< TInputImage, TOutputImage > Superclass
Implements progress tracking for a filter.
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
itk::ImageLinearConstIteratorWithIndex< TInputImage > ConstInputImageIterator