ITK  5.2.0
Insight Toolkit
itkBSplineResampleImageFilterBase.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 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 {
82 template <typename TInputImage, typename TOutputImage>
83 class ITK_TEMPLATE_EXPORT BSplineResampleImageFilterBase : public ImageToImageFilter<TInputImage, TOutputImage>
84 {
85 public:
86  ITK_DISALLOW_COPY_AND_ASSIGN(BSplineResampleImageFilterBase);
87 
93 
96 
98  // Must be instantiated through another class. itkNewMacro( Self );
99 
101  using InputImageType = typename Superclass::InputImageType;
102 
104  static constexpr unsigned int ImageDimension = TInputImage::ImageDimension;
105 
108 
110  using SizeType = typename TInputImage::SizeType;
111 
114 
116  using OutputImagePixelType = typename Superclass::OutputImagePixelType;
117 
120 
123 
126 
129  void
130  SetSplineOrder(int SplineOrder);
131 
133  itkGetConstMacro(SplineOrder, int);
134 
135 protected:
137  void
138  ReduceNDImage(OutputImageIterator & OutItr);
139 
141  void
142  ExpandNDImage(OutputImageIterator & OutItr);
143 
146  virtual void
147  InitializePyramidSplineFilter(int SplineOrder);
148 
150  virtual void
151  Reduce1DImage(const std::vector<double> & In,
152  OutputImageIterator & Iter,
153  unsigned int traverseSize,
154  ProgressReporter & progress);
155 
157  virtual void
158  Expand1DImage(const std::vector<double> & In,
159  OutputImageIterator & Iter,
160  unsigned int traverseSize,
161  ProgressReporter & progress);
162 
164  ~BSplineResampleImageFilterBase() override = default;
165  void
166  PrintSelf(std::ostream & os, Indent indent) const override;
167 
168  int m_SplineOrder; // User specified spline order
169  int m_GSize; // downsampling filter size
170  int m_HSize; // upsampling filter size
171 
172  std::vector<double> m_G; // downsampling filter coefficients
173  std::vector<double> m_H; // upsampling filter coefficients
174 
175 private:
176  // Resizes m_Scratch Variable based on image sizes
177  void
178  InitializeScratch(SizeType DataLength);
179 
180  // Copies a line of data from the input to the m_Scratch for subsequent
181  // processing
182  void
183  CopyInputLineToScratch(ConstInputImageIterator & Iter);
184 
185  void
186  CopyOutputLineToScratch(ConstOutputImageIterator & Iter);
187 
188  void
189  CopyLineToScratch(ConstInputImageIterator & Iter);
190 
191  std::vector<double> m_Scratch; // temp storage for processing
192  // of Coefficients
193 };
194 } // namespace itk
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 # include "itkBSplineResampleImageFilterBase.hxx"
198 #endif
199 
200 #endif
itk::BSplineResampleImageFilterBase
Uses the "l2" spline pyramid implementation of B-Spline Filters to up/down sample an image by a facto...
Definition: itkBSplineResampleImageFilterBase.h:83
itk::ImageLinearIteratorWithIndex
A multi-dimensional image iterator that visits image pixels within a region in a "scan-line" order.
Definition: itkImageLinearIteratorWithIndex.h:67
itkProgressReporter.h
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itkImageRegionIterator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::BSplineResampleImageFilterBase::RegionType
typename TInputImage::RegionType RegionType
Definition: itkBSplineResampleImageFilterBase.h:113
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
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::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkImageLinearIteratorWithIndex.h
itk::BSplineResampleImageFilterBase::IndexType
typename TInputImage::IndexType IndexType
Definition: itkBSplineResampleImageFilterBase.h:107
itk::BSplineResampleImageFilterBase::m_GSize
int m_GSize
Definition: itkBSplineResampleImageFilterBase.h:169
itk::BSplineResampleImageFilterBase::m_Scratch
std::vector< double > m_Scratch
Definition: itkBSplineResampleImageFilterBase.h:191
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::BSplineResampleImageFilterBase::m_HSize
int m_HSize
Definition: itkBSplineResampleImageFilterBase.h:170
itk::BSplineResampleImageFilterBase::m_H
std::vector< double > m_H
Definition: itkBSplineResampleImageFilterBase.h:173
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::BSplineResampleImageFilterBase::m_SplineOrder
int m_SplineOrder
Definition: itkBSplineResampleImageFilterBase.h:168
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::BSplineResampleImageFilterBase::m_G
std::vector< double > m_G
Definition: itkBSplineResampleImageFilterBase.h:172
itk::ProgressReporter
Implements progress tracking for a filter.
Definition: itkProgressReporter.h:60
itk::BSplineResampleImageFilterBase::SizeType
typename TInputImage::SizeType SizeType
Definition: itkBSplineResampleImageFilterBase.h:110
itk::ImageLinearConstIteratorWithIndex
A multi-dimensional image iterator that visits image pixels within a region in a "scan-line" order.
Definition: itkImageLinearConstIteratorWithIndex.h:101