RTK  2.5.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  * https://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 ITK_TEMPLATE_EXPORT ReconstructImageFilter : public itk::ImageToImageFilter<TImage, TImage>
124 {
125 public:
126  ITK_DISALLOW_COPY_AND_MOVE(ReconstructImageFilter);
128 
134 
136  itkNewMacro(Self);
137 
139 #ifdef itkOverrideGetNameOfClassMacro
140  itkOverrideGetNameOfClassMacro(ReconstructImageFilter);
141 #else
143 #endif
144 
145 
147  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
148 
150  using InputImageType = typename Superclass::InputImageType;
151  using OutputImageType = typename Superclass::OutputImageType;
152  using InputImagePointer = typename Superclass::InputImagePointer;
153  using OutputImagePointer = typename Superclass::OutputImagePointer;
154  using InputImageConstPointer = typename Superclass::InputImageConstPointer;
155  using PixelType = typename TImage::PixelType;
156  using InternalPixelType = typename TImage::InternalPixelType;
157 
162 
164  virtual void
165  SetNumberOfLevels(unsigned int levels)
166  {
167  this->m_NumberOfLevels = levels;
168  this->ModifyInputOutputStorage();
169  }
171 
173  virtual unsigned int
175  {
176  return this->m_NumberOfLevels;
177  }
178 
183  void
184  GenerateOutputInformation() override;
185 
186 
189  void
190  GenerateInputRequestedRegion() override;
191 
195  void
196  VerifyInputInformation() const override
197  {}
198 
199  void
200  SetSizes(typename InputImageType::SizeType * sizesVector)
201  {
202  m_Sizes = sizesVector;
203  }
204 
205  void
206  SetIndices(typename InputImageType::IndexType * indicesVector)
207  {
208  m_Indices = indicesVector;
209  }
210 
212  itkGetMacro(Order, unsigned int);
213  itkSetMacro(Order, unsigned int);
215 
216 protected:
218  ~ReconstructImageFilter() override = default;
219 
220  void
221  PrintSelf(std::ostream & os, itk::Indent indent) const override;
222 
226  void
227  ModifyInputOutputStorage();
228 
230  void
231  GenerateData() override;
232 
234  virtual unsigned int
235  CalculateNumberOfInputs();
236 
238  void
239  GeneratePassVectors();
240 
241 private:
242  unsigned int m_NumberOfLevels{ 5 }; // Holds the number of Reconstruction levels
243  unsigned int m_Order{ 3 }; // Holds the order of the wavelet filters
244  bool m_PipelineConstructed{
245  false
246  }; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
247 
248  typename InputImageType::SizeType * m_Sizes; // Holds the size of sub-images at each level
249  typename InputImageType::IndexType * m_Indices; // Holds the size of sub-images at each level
250  typename std::vector<typename AddFilterType::Pointer> m_AddFilters; // Holds a vector of add filters
251  typename std::vector<typename ConvolutionFilterType::Pointer>
252  m_ConvolutionFilters; // Holds a vector of convolution filters
253  typename std::vector<typename UpsampleImageFilterType::Pointer>
254  m_UpsampleFilters; // Holds a vector of Upsample filters
255  // Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
256  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
257 };
258 
259 } // namespace rtk
260 
261 // Include CXX
262 #ifndef rtk_MANUAL_INSTANTIATION
263 # include "rtkReconstructImageFilter.hxx"
264 #endif
265 
266 #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)
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)
TOutputImage OutputImageType
std::vector< typename UpsampleImageFilterType::Pointer > m_UpsampleFilters
typename TImage::InternalPixelType InternalPixelType
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 SetIndices(typename InputImageType::IndexType *indicesVector)