RTK  2.0.1
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  ITK_DISALLOW_COPY_AND_ASSIGN(ReconstructImageFilter);
120 
126 
128  itkNewMacro(Self)
129 
130 
132 
134  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
135 
142  using PixelType = typename TImage::PixelType;
143  using InternalPixelType = typename TImage::InternalPixelType;
144 
146  using AddFilterType = itk::NaryAddImageFilter<InputImageType, InputImageType>;
149 
151  virtual void SetNumberOfLevels(unsigned int levels)
152  {
153  this->m_NumberOfLevels = levels;
154  this->ModifyInputOutputStorage();
155  }
157 
159  virtual unsigned int GetNumberOfLevels()
160  {
161  return this->m_NumberOfLevels;
162  }
163 
168  void GenerateOutputInformation() override;
169 
170 
173  void GenerateInputRequestedRegion() override;
174 
178 #if ITK_VERSION_MAJOR<5
179  void VerifyInputInformation() override {}
180 #else
181  void VerifyInputInformation() const override {}
182 #endif
183 
184 
185  void SetSizes(typename InputImageType::SizeType *sizesVector)
186  {
187  m_Sizes = sizesVector;
188  }
189 
190  void SetIndices(typename InputImageType::IndexType *indicesVector)
191  {
192  m_Indices = indicesVector;
193  }
194 
196  itkGetMacro(Order, unsigned int)
197  itkSetMacro(Order, unsigned int)
198 
199 protected:
201  ~ReconstructImageFilter() override = default;
202 
203  void PrintSelf(std::ostream&os, itk::Indent indent) const override;
204 
209 
211  void GenerateData() override;
212 
214  virtual unsigned int CalculateNumberOfInputs();
215 
217  void GeneratePassVectors();
218 
219 private:
220  unsigned int m_NumberOfLevels{5}; // Holds the number of Reconstruction levels
221  unsigned int m_Order{3}; // Holds the order of the wavelet filters
222  bool m_PipelineConstructed{false};// Filters instantiated by GenerateOutputInformation() should be instantiated only once
223 
224  typename InputImageType::SizeType *m_Sizes; //Holds the size of sub-images at each level
225  typename InputImageType::IndexType *m_Indices; //Holds the size of sub-images at each level
226  typename std::vector<typename AddFilterType::Pointer> m_AddFilters; //Holds a vector of add filters
227  typename std::vector<typename ConvolutionFilterType::Pointer> m_ConvolutionFilters; //Holds a vector of convolution filters
228  typename std::vector<typename UpsampleImageFilterType::Pointer> m_UpsampleFilters; //Holds a vector of Upsample filters
229  //Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
230  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
231 
232 
233 };
234 
235 }// namespace rtk
236 
237 //Include CXX
238 #ifndef rtk_MANUAL_INSTANTIATION
239 #include "rtkReconstructImageFilter.hxx"
240 #endif
241 
242 #endif
typename Superclass::InputImageConstPointer InputImageConstPointer
void SetSizes(typename InputImageType::SizeType *sizesVector)
typename OutputImageType::Pointer OutputImagePointer
virtual void SetNumberOfLevels(unsigned int levels)
static constexpr unsigned int ImageDimension
void PrintSelf(std::ostream &os, itk::Indent indent) const override
typename Superclass::InputImageType InputImageType
InputImageType::SizeType * m_Sizes
Upsamples an image by the given factor for each dimension.
typename Superclass::InputImagePointer InputImagePointer
typename TImage::PixelType PixelType
An image filter that reconstructs an image using Daubechies wavelets.
std::vector< typename ConvolutionFilterType::PassVector > m_PassVectors
std::vector< typename ConvolutionFilterType::Pointer > m_ConvolutionFilters
~ReconstructImageFilter() override=default
TOutputImage OutputImageType
std::vector< typename UpsampleImageFilterType::Pointer > m_UpsampleFilters
virtual unsigned int CalculateNumberOfInputs()
typename TImage::InternalPixelType InternalPixelType
void GenerateInputRequestedRegion() override
void GenerateData() override
Creates a Daubechies wavelets kernel image with the requested attributes (order, type, pass along each dimension)
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)