ITK  4.3.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< class TInputImage, class TOutputImage >
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 
106  typedef typename TInputImage::IndexType IndexType;
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 
162  void PrintSelf(std::ostream & os, Indent indent) const;
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  BSplineResampleImageFilterBase(const Self &); //purposely not implemented
188  void operator=(const Self &); //purposely not implemented
189 };
190 } // namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 #include "itkBSplineResampleImageFilterBase.hxx"
194 #endif
195 
196 #endif
197