RTK  2.0.1
Reconstruction Toolkit
rtkDeconstructImageFilter.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 rtkDeconstructImageFilter_h
20 #define rtkDeconstructImageFilter_h
21 
22 //Includes
23 #include <itkImageToImageFilter.h>
24 #include <itkMacro.h>
26 
29 
30 namespace rtk {
31 
118 template <class TImage>
120  : public itk::ImageToImageFilter<TImage, TImage>
121 {
122 public:
123  ITK_DISALLOW_COPY_AND_ASSIGN(DeconstructImageFilter);
125 
131 
133  itkNewMacro(Self)
134 
135 
137 
139  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
140 
147  using PixelType = typename TImage::PixelType;
148  using InternalPixelType = typename TImage::InternalPixelType;
149 
151  using PadFilterType = itk::MirrorPadImageFilter<InputImageType, InputImageType>;
154 
156  virtual void SetNumberOfLevels(unsigned int levels)
157  {
158  this->m_NumberOfLevels = levels;
159  this->ModifyInputOutputStorage();
160  }
162 
164  virtual unsigned int GetNumberOfLevels()
165  {
166  return this->m_NumberOfLevels;
167  }
168 
173  void GenerateOutputInformation() override;
174 
175  void GenerateInputRequestedRegion() override;
176 
178  itkGetMacro(Order, unsigned int)
179  itkSetMacro(Order, unsigned int)
180 
181 
189  {
190  return m_Sizes.data();
191  }
192 
200  typename InputImageType::IndexType* GetIndices()
201  {
202  return m_Indices.data();
203  }
204 
205 protected:
207  ~DeconstructImageFilter() override = default;
208  void PrintSelf(std::ostream&os, itk::Indent indent) const override;
209 
214 
216  void GenerateData() override;
217 
219  virtual unsigned int CalculateNumberOfOutputs();
220 
222  void GeneratePassVectors();
223 
224 private:
225  unsigned int m_NumberOfLevels{5}; // Holds the number of deconstruction levels
226  unsigned int m_Order{3}; // Holds the order of the wavelet filters
227  bool m_PipelineConstructed{false}; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
228 
229  typename std::vector<typename InputImageType::SizeType> m_Sizes; //Holds the size of sub-images at each level
230  typename std::vector<typename InputImageType::IndexType> m_Indices; //Holds the size of sub-images at each level
231  typename std::vector<typename PadFilterType::Pointer> m_PadFilters; //Holds a vector of padding filters
232  typename std::vector<typename ConvolutionFilterType::Pointer> m_ConvolutionFilters; //Holds a vector of convolution filters
233  typename std::vector<typename DownsampleImageFilterType::Pointer> m_DownsampleFilters; //Holds a vector of downsample 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 }// namespace rtk
239 
240 //Include CXX
241 #ifndef rtk_MANUAL_INSTANTIATION
242 #include "rtkDeconstructImageFilter.hxx"
243 #endif
244 
245 #endif
std::vector< typename ConvolutionFilterType::PassVector > m_PassVectors
virtual void SetNumberOfLevels(unsigned int levels)
typename Superclass::InputImagePointer InputImagePointer
typename Superclass::InputImageConstPointer InputImageConstPointer
std::vector< typename InputImageType::IndexType > m_Indices
virtual unsigned int CalculateNumberOfOutputs()
~DeconstructImageFilter() override=default
std::vector< typename ConvolutionFilterType::Pointer > m_ConvolutionFilters
void GenerateOutputInformation() override
typename Superclass::OutputImageType OutputImageType
void GenerateInputRequestedRegion() override
std::vector< typename PadFilterType::Pointer > m_PadFilters
typename Superclass::OutputImagePointer OutputImagePointer
void PrintSelf(std::ostream &os, itk::Indent indent) const override
ImageBaseType::SizeType SizeType
InputImageType::IndexType * GetIndices()
typename TImage::InternalPixelType InternalPixelType
typename TImage::PixelType PixelType
virtual unsigned int GetNumberOfLevels()
void GenerateData() override
static constexpr unsigned int ImageDimension
std::vector< typename DownsampleImageFilterType::Pointer > m_DownsampleFilters
InputImageType::SizeType * GetSizes()
typename Superclass::InputImageType InputImageType
Creates a Daubechies wavelets kernel image with the requested attributes (order, type, pass along each dimension)
An image filter that deconstructs an image using Daubechies wavelets.
std::vector< typename InputImageType::SizeType > m_Sizes
Downsamples an image by a factor in each dimension.
#define itkSetMacro(name, type)