RTK  2.1.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 {
32 
122 template <class TImage>
123 class ReconstructImageFilter : public itk::ImageToImageFilter<TImage, TImage>
124 {
125 public:
126  ITK_DISALLOW_COPY_AND_ASSIGN(ReconstructImageFilter);
128 
134 
136  itkNewMacro(Self);
137 
140 
142  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
143 
145  using InputImageType = typename Superclass::InputImageType;
147  using InputImagePointer = typename Superclass::InputImagePointer;
149  using InputImageConstPointer = typename Superclass::InputImageConstPointer;
150  using PixelType = typename TImage::PixelType;
151  using InternalPixelType = typename TImage::InternalPixelType;
152 
157 
159  virtual void
160  SetNumberOfLevels(unsigned int levels)
161  {
162  this->m_NumberOfLevels = levels;
163  this->ModifyInputOutputStorage();
164  }
166 
168  virtual unsigned int
170  {
171  return this->m_NumberOfLevels;
172  }
173 
178  void
179  GenerateOutputInformation() override;
180 
181 
184  void
185  GenerateInputRequestedRegion() override;
186 
190  void
191  VerifyInputInformation() const override
192  {}
193 
194  void
195  SetSizes(typename InputImageType::SizeType * sizesVector)
196  {
197  m_Sizes = sizesVector;
198  }
199 
200  void
201  SetIndices(typename InputImageType::IndexType * indicesVector)
202  {
203  m_Indices = indicesVector;
204  }
205 
207  itkGetMacro(Order, unsigned int);
208  itkSetMacro(Order, unsigned int);
210 
211 protected:
213  ~ReconstructImageFilter() override = default;
214 
215  void
216  PrintSelf(std::ostream & os, itk::Indent indent) const override;
217 
221  void
223 
225  void
226  GenerateData() override;
227 
229  virtual unsigned int
231 
233  void
235 
236 private:
237  unsigned int m_NumberOfLevels{ 5 }; // Holds the number of Reconstruction levels
238  unsigned int m_Order{ 3 }; // Holds the order of the wavelet filters
240  false
241  }; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
242 
243  typename InputImageType::SizeType * m_Sizes; // Holds the size of sub-images at each level
244  typename InputImageType::IndexType * m_Indices; // Holds the size of sub-images at each level
245  typename std::vector<typename AddFilterType::Pointer> m_AddFilters; // Holds a vector of add filters
246  typename std::vector<typename ConvolutionFilterType::Pointer>
247  m_ConvolutionFilters; // Holds a vector of convolution filters
248  typename std::vector<typename UpsampleImageFilterType::Pointer>
249  m_UpsampleFilters; // Holds a vector of Upsample filters
250  // Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
251  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
252 };
253 
254 } // namespace rtk
255 
256 // Include CXX
257 #ifndef rtk_MANUAL_INSTANTIATION
258 # include "rtkReconstructImageFilter.hxx"
259 #endif
260 
261 #endif
typename Superclass::InputImageConstPointer InputImageConstPointer
void SetSizes(typename InputImageType::SizeType *sizesVector)
void VerifyInputInformation() const override
typename OutputImageType::Pointer OutputImagePointer
virtual void SetNumberOfLevels(unsigned int levels)
static constexpr unsigned int ImageDimension
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
#define itkSetMacro(name, type)
~ReconstructImageFilter() override=default
void PrintSelf(std::ostream &os, itk::Indent indent) const override
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)