RTK  1.4.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  * 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 
129 
131  itkNewMacro(Self)
132 
133 
135 
137  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
138 
140  typedef typename Superclass::InputImageType InputImageType;
141  typedef typename Superclass::OutputImageType OutputImageType;
142  typedef typename Superclass::InputImagePointer InputImagePointer;
143  typedef typename Superclass::OutputImagePointer OutputImagePointer;
144  typedef typename Superclass::InputImageConstPointer InputImageConstPointer;
145  typedef typename TImage::PixelType PixelType;
146  typedef typename TImage::InternalPixelType InternalPixelType;
147 
149  typedef itk::MirrorPadImageFilter<InputImageType, InputImageType> PadFilterType;
152 
154  virtual void SetNumberOfLevels(unsigned int levels)
155  {
156  this->m_NumberOfLevels = levels;
157  this->ModifyInputOutputStorage();
158  }
160 
162  virtual unsigned int GetNumberOfLevels()
163  {
164  return this->m_NumberOfLevels;
165  }
166 
171  void GenerateOutputInformation() ITK_OVERRIDE;
172 
173  void GenerateInputRequestedRegion() ITK_OVERRIDE;
174 
176  itkGetMacro(Order, unsigned int)
177  itkSetMacro(Order, unsigned int)
178 
179 
187  {
188  return m_Sizes.data();
189  }
190 
198  typename InputImageType::IndexType* GetIndices()
199  {
200  return m_Indices.data();
201  }
202 
203 protected:
205  virtual ~DeconstructImageFilter() ITK_OVERRIDE {}
206  void PrintSelf(std::ostream&os, itk::Indent indent) const ITK_OVERRIDE;
207 
212 
214  void GenerateData() ITK_OVERRIDE;
215 
217  virtual unsigned int CalculateNumberOfOutputs();
218 
220  void GeneratePassVectors();
221 
222 private:
223  DeconstructImageFilter(const Self&); //purposely not implemented
224  void operator=(const Self&); //purposely not implemented
225 
226  unsigned int m_NumberOfLevels; // Holds the number of deconstruction levels
227  unsigned int m_Order; // Holds the order of the wavelet filters
228  bool m_PipelineConstructed; // Filters instantiated by GenerateOutputInformation() should be instantiated only once
229 
230  typename std::vector<typename InputImageType::SizeType> m_Sizes; //Holds the size of sub-images at each level
231  typename std::vector<typename InputImageType::IndexType> m_Indices; //Holds the size of sub-images at each level
232  typename std::vector<typename PadFilterType::Pointer> m_PadFilters; //Holds a vector of padding filters
233  typename std::vector<typename ConvolutionFilterType::Pointer> m_ConvolutionFilters; //Holds a vector of convolution filters
234  typename std::vector<typename DownsampleImageFilterType::Pointer> m_DownsampleFilters; //Holds a vector of downsample filters
235  //Holds a vector of PassVectors. A PassVector has Dimension components, each one storing either "High" or "Low"
236  typename std::vector<typename ConvolutionFilterType::PassVector> m_PassVectors;
237 };
238 
239 }// namespace rtk
240 
241 //Include CXX
242 #ifndef rtk_MANUAL_INSTANTIATION
243 #include "rtkDeconstructImageFilter.hxx"
244 #endif
245 
246 #endif
void operator=(const Self &)
std::vector< typename ConvolutionFilterType::PassVector > m_PassVectors
virtual void SetNumberOfLevels(unsigned int levels)
typename FixedImageType::SizeType SizeType
std::vector< typename InputImageType::IndexType > m_Indices
virtual unsigned int CalculateNumberOfOutputs()
std::vector< typename ConvolutionFilterType::Pointer > m_ConvolutionFilters
void GenerateOutputInformation() override
void GenerateInputRequestedRegion() override
std::vector< typename PadFilterType::Pointer > m_PadFilters
itk::SmartPointer< Self > Pointer
Superclass::OutputImageType OutputImageType
static const unsigned int ImageDimension
void PrintSelf(std::ostream &os, itk::Indent indent) const override
InputImageType::IndexType * GetIndices()
Superclass::InputImagePointer InputImagePointer
virtual unsigned int GetNumberOfLevels()
void GenerateData() override
std::vector< typename DownsampleImageFilterType::Pointer > m_DownsampleFilters
InputImageType::SizeType * GetSizes()
Creates a Daubechies wavelets kernel image with the requested attributes (order, type, pass along each dimension)
Superclass::InputImageConstPointer InputImageConstPointer
An image filter that deconstructs an image using Daubechies wavelets.
itk::ImageToImageFilter< TImage, TImage > Superclass
Superclass::InputImageType InputImageType
itk::SmartPointer< const Self > ConstPointer
std::vector< typename InputImageType::SizeType > m_Sizes
TImage::InternalPixelType InternalPixelType
Downsamples an image by a factor in each dimension.
#define itkSetMacro(name, type)
Superclass::OutputImagePointer OutputImagePointer