ANIMA  4.0
animaPyramidImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <itkImageToImageFilter.h>
4 #include <itkVectorImage.h>
5 
6 namespace anima
7 {
8 
16 template <class TInputImage, class TOutputImage>
18 public itk::ImageToImageFilter< TInputImage, TOutputImage >
19 {
20 public:
23  typedef itk::ImageToImageFilter<TInputImage,TOutputImage> Superclass;
24  typedef itk::SmartPointer<Self> Pointer;
25  typedef itk::SmartPointer<const Self> ConstPointer;
26 
28  itkNewMacro(Self)
29 
30 
31  itkTypeMacro(PyramidImageFilter, ImageToImageFilter)
32 
33  typedef TInputImage InputImageType;
34  typedef typename InputImageType::IOPixelType InputInternalScalarType;
35  typedef typename InputImageType::RegionType RegionType;
36  typedef typename InputImageType::SpacingType SpacingType;
37 
38  typedef TOutputImage OutputImageType;
39  typedef typename OutputImageType::Pointer OutputImagePointer;
40  typedef typename OutputImageType::IOPixelType OutputInternalScalarType;
41 
42  typedef itk::Image <typename TInputImage::IOPixelType,TInputImage::ImageDimension> ScalarInputImageType;
43  typedef itk::VectorImage <typename TInputImage::IOPixelType,TInputImage::ImageDimension> VectorInputImageType;
44 
45  typedef itk::Image <typename TInputImage::IOPixelType,TInputImage::ImageDimension> ScalarOutputImageType;
46  typedef typename ScalarOutputImageType::Pointer ScalarOutputImagePointer;
47 
48  typedef itk::VectorImage <typename TInputImage::IOPixelType,TInputImage::ImageDimension> VectorOutputImageType;
49  typedef typename VectorOutputImageType::Pointer VectorOutputImagePointer;
50 
51  typedef itk::ImageToImageFilter <TInputImage,TOutputImage> BaseResamplerType;
52  typedef typename BaseResamplerType::Pointer BaseResamplerPointer;
53 
55  itkSetMacro(NumberOfLevels, unsigned int)
56  itkGetConstMacro(NumberOfLevels, unsigned int)
57 
58  itkSetObjectMacro(ImageResampler, BaseResamplerType)
59 
60 protected:
62  virtual ~PyramidImageFilter() {}
63 
64  void GenerateData() ITK_OVERRIDE;
65 
66  void CheckNumberOfLevels();
67  double AnisotropyMeasure(SpacingType &sp, std::vector <bool> &changeableSizes);
68 
69  void CreateLevelVectorImage(unsigned int level);
70  void CreateLevelImage(unsigned int level);
71 
72 private:
73  ITK_DISALLOW_COPY_AND_ASSIGN(PyramidImageFilter);
74 
75  unsigned int m_NumberOfLevels;
76 
78  BaseResamplerPointer m_ImageResampler;
79 
80  // Internal variables to compute images
81  std::vector <RegionType> m_LevelRegions;
82  std::vector <SpacingType> m_LevelSpacings;
83 };
84 
85 } //end of namespace anima
86 
itk::ImageToImageFilter< TInputImage, TOutputImage > BaseResamplerType
Computes a pyramid of images using the provided resampler to perform resampling.
itk::VectorImage< typename TInputImage::IOPixelType, TInputImage::ImageDimension > VectorOutputImageType
InputImageType::RegionType RegionType
VectorOutputImageType::Pointer VectorOutputImagePointer
itk::Image< typename TInputImage::IOPixelType, TInputImage::ImageDimension > ScalarOutputImageType
OutputImageType::IOPixelType OutputInternalScalarType
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
BaseResamplerType::Pointer BaseResamplerPointer
void CreateLevelVectorImage(unsigned int level)
itk::Image< typename TInputImage::IOPixelType, TInputImage::ImageDimension > ScalarInputImageType
itk::VectorImage< typename TInputImage::IOPixelType, TInputImage::ImageDimension > VectorInputImageType
InputImageType::IOPixelType InputInternalScalarType
itk::SmartPointer< const Self > ConstPointer
double AnisotropyMeasure(SpacingType &sp, std::vector< bool > &changeableSizes)
ScalarOutputImageType::Pointer ScalarOutputImagePointer
itk::SmartPointer< Self > Pointer
void CreateLevelImage(unsigned int level)
InputImageType::SpacingType SpacingType
OutputImageType::Pointer OutputImagePointer