RTK  1.4.0
Reconstruction Toolkit
rtkReconstructImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK 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 #ifndef rtkReconstructImageFilter_h
20 #define rtkReconstructImageFilter_h
21 
22 //Includes
23 #include <itkImageToImageFilter.h>
24 #include <itkMacro.h>
25 #include <itkNaryAddImageFilter.h>
26 
28 #include "rtkUpsampleImageFilter.h"
29 
30 namespace rtk {
31 
113 template <class TImage>
115  : public itk::ImageToImageFilter<TImage, TImage>
116 {
117 public:
118 
124 
126  itkNewMacro(Self)
127 
128 
130 
132  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
133 
135  typedef typename Superclass::InputImageType InputImageType;
136  typedef typename Superclass::OutputImageType OutputImageType;
137  typedef typename Superclass::InputImagePointer InputImagePointer;
138  typedef typename Superclass::OutputImagePointer OutputImagePointer;
139  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
140  typedef typename TImage::PixelType PixelType;
141  typedef typename TImage::InternalPixelType InternalPixelType;
142 
144  typedef itk::NaryAddImageFilter<InputImageType, InputImageType> AddFilterType;
147 
149  virtual void SetNumberOfLevels(unsigned int levels)
150  {
151  this->m_NumberOfLevels = levels;
152  this->ModifyInputOutputStorage();
153  }
155 
157  virtual unsigned int GetNumberOfLevels()
158  {
159  return this->m_NumberOfLevels;
160  }
161 
166  void GenerateOutputInformation() ITK_OVERRIDE;
167 
168 
171  void GenerateInputRequestedRegion() ITK_OVERRIDE;
172 
176 #if ITK_VERSION_MAJOR<5
177 #if ITK_VERSION_MAJOR<5
178  void VerifyInputInformation() ITK_OVERRIDE {}
179 #else
180  void VerifyInputInformation() const ITK_OVERRIDE {}
181 #endif
182 #else
183  void VerifyInputInformation() const ITK_OVERRIDE {}
184 #endif
185 
186 
187  void SetSizes(typename InputImageType::SizeType *sizesVector)
188  {
189  m_Sizes = sizesVector;
190  }
191 
192  void SetIndices(typename InputImageType::IndexType *indicesVector)
193  {
194  m_Indices = indicesVector;
195  }
196 
198  itkGetMacro(Order, unsigned int)
199  itkSetMacro(Order, unsigned int)
200 
201 protected:
203  virtual ~ReconstructImageFilter() ITK_OVERRIDE {}
204 
205  void PrintSelf(std::ostream&os, itk::Indent indent) const ITK_OVERRIDE;
206 
211 
213  void GenerateData() ITK_OVERRIDE;
214 
216  virtual unsigned int CalculateNumberOfInputs();
217 
219  void GeneratePassVectors();
220 
221 private:
222  ReconstructImageFilter(const Self&); //purposely not implemented
223  void operator=(const Self&); //purposely not implemented
224 
225  unsigned int m_NumberOfLevels; // Holds the number of Reconstruction levels
226  unsigned int m_Order; // Holds the order of the wavelet filters
227  bool m_PipelineConstructed; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
228 
229  typename InputImageType::SizeType *m_Sizes; //Holds the size of sub-images at each level
230  typename InputImageType::IndexType *m_Indices; //Holds the size of sub-images at each level
231  typename std::vector<typename AddFilterType::Pointer> m_AddFilters; //Holds a vector of add filters
232  typename std::vector<typename ConvolutionFilterType::Pointer> m_ConvolutionFilters; //Holds a vector of convolution filters
233  typename std::vector<typename UpsampleImageFilterType::Pointer> m_UpsampleFilters; //Holds a vector of Upsample filters
234  //Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
235  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
236 
237 
238 };
239 
240 }// namespace rtk
241 
242 //Include CXX
243 #ifndef rtk_MANUAL_INSTANTIATION
244 #include "rtkReconstructImageFilter.hxx"
245 #endif
246 
247 #endif
void SetSizes(typename InputImageType::SizeType *sizesVector)
itk::ImageToImageFilter< TImage, TImage > Superclass
virtual void SetNumberOfLevels(unsigned int levels)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Superclass::InputImageConstPointer InputImageConstPointer
Superclass::OutputImageType OutputImageType
Superclass::OutputImagePointer OutputImagePointer
InputImageType::SizeType * m_Sizes
Upsamples an image by the given factor for each dimension.
static const unsigned int ImageDimension
itk::SmartPointer< const Self > ConstPointer
An image filter that reconstructs an image using Daubechies wavelets.
std::vector< typename ConvolutionFilterType::PassVector > m_PassVectors
std::vector< typename ConvolutionFilterType::Pointer > m_ConvolutionFilters
std::vector< typename UpsampleImageFilterType::Pointer > m_UpsampleFilters
virtual unsigned int CalculateNumberOfInputs()
void GenerateInputRequestedRegion() override
itk::SmartPointer< Self > Pointer
TImage::InternalPixelType InternalPixelType
void GenerateData() override
Superclass::InputImageType InputImageType
Creates a Daubechies wavelets kernel image with the requested attributes (order, type, pass along each dimension)
void operator=(const Self &)
InputImageType::IndexType * m_Indices
std::vector< typename AddFilterType::Pointer > m_AddFilters
virtual unsigned int GetNumberOfLevels()
void GenerateOutputInformation() override
void SetIndices(typename InputImageType::IndexType *indicesVector)
#define itkSetMacro(name, type)
Superclass::InputImagePointer InputImagePointer