RTK  2.6.0
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  * 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 rtkDeconstructImageFilter_h
20 #define rtkDeconstructImageFilter_h
21 
22 // Includes
23 #include <itkImageToImageFilter.h>
24 #include <itkMacro.h>
26 
29 
30 namespace rtk
31 {
32 
127 template <class TImage>
128 class ITK_TEMPLATE_EXPORT DeconstructImageFilter : public itk::ImageToImageFilter<TImage, TImage>
129 {
130 public:
131  ITK_DISALLOW_COPY_AND_MOVE(DeconstructImageFilter);
133 
139 
141  itkNewMacro(Self);
142 
144 #ifdef itkOverrideGetNameOfClassMacro
145  itkOverrideGetNameOfClassMacro(DeconstructImageFilter);
146 #else
148 #endif
149 
150 
152  static constexpr unsigned int ImageDimension = TImage::ImageDimension;
153 
155  using InputImageType = typename Superclass::InputImageType;
156  using OutputImageType = typename Superclass::OutputImageType;
157  using InputImagePointer = typename Superclass::InputImagePointer;
158  using OutputImagePointer = typename Superclass::OutputImagePointer;
159  using InputImageConstPointer = typename Superclass::InputImageConstPointer;
160  using PixelType = typename TImage::PixelType;
161  using InternalPixelType = typename TImage::InternalPixelType;
162 
167 
169  virtual void
170  SetNumberOfLevels(unsigned int levels)
171  {
172  this->m_NumberOfLevels = levels;
173  this->ModifyInputOutputStorage();
174  }
176 
178  virtual unsigned int
180  {
181  return this->m_NumberOfLevels;
182  }
183 
188  void
189  GenerateOutputInformation() override;
190 
191  void
192  GenerateInputRequestedRegion() override;
193 
195  itkGetMacro(Order, unsigned int);
196  itkSetMacro(Order, unsigned int);
198 
206  typename InputImageType::SizeType *
208  {
209  return m_Sizes.data();
210  }
211 
219  typename InputImageType::IndexType *
221  {
222  return m_Indices.data();
223  }
224 
225 protected:
227  ~DeconstructImageFilter() override = default;
228  void
229  PrintSelf(std::ostream & os, itk::Indent indent) const override;
230 
234  void
235  ModifyInputOutputStorage();
236 
238  void
239  GenerateData() override;
240 
242  virtual unsigned int
243  CalculateNumberOfOutputs();
244 
246  void
247  GeneratePassVectors();
248 
249 private:
250  unsigned int m_NumberOfLevels{ 5 }; // Holds the number of deconstruction levels
251  unsigned int m_Order{ 3 }; // Holds the order of the wavelet filters
252  bool m_PipelineConstructed{
253  false
254  }; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
255 
256  typename std::vector<typename InputImageType::SizeType> m_Sizes; // Holds the size of sub-images at each level
257  typename std::vector<typename InputImageType::IndexType> m_Indices; // Holds the size of sub-images at each level
258  typename std::vector<typename PadFilterType::Pointer> m_PadFilters; // Holds a vector of padding filters
259  typename std::vector<typename ConvolutionFilterType::Pointer>
260  m_ConvolutionFilters; // Holds a vector of convolution filters
261  typename std::vector<typename DownsampleImageFilterType::Pointer>
262  m_DownsampleFilters; // Holds a vector of downsample filters
263  // Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
264  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
265 };
266 
267 } // namespace rtk
268 
269 // Include CXX
270 #ifndef rtk_MANUAL_INSTANTIATION
271 # include "rtkDeconstructImageFilter.hxx"
272 #endif
273 
274 #endif
typename OutputImageType::Pointer OutputImagePointer
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
std::vector< typename ConvolutionFilterType::Pointer > m_ConvolutionFilters
std::vector< typename PadFilterType::Pointer > m_PadFilters
#define itkSetMacro(name, type)
InputImageType::IndexType * GetIndices()
TOutputImage OutputImageType
typename TImage::InternalPixelType InternalPixelType
typename TImage::PixelType PixelType
virtual unsigned int GetNumberOfLevels()
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.