ANIMA  4.0
animaExpTensorImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <itkImageToImageFilter.h>
5 #include <itkVectorImage.h>
6 
7 #include <animaBaseTensorTools.h>
8 
9 namespace anima
10 {
11 
12 template <class TScalarType, unsigned int NDimensions = 3>
14 public itk::ImageToImageFilter< itk::VectorImage <TScalarType, NDimensions> , itk::VectorImage <TScalarType, NDimensions> >
15 {
16 public:
19  typedef itk::VectorImage <TScalarType, NDimensions> TInputImage;
20  typedef itk::VectorImage <TScalarType, NDimensions> TOutputImage;
21 
22  typedef itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass;
23  typedef itk::SmartPointer<Self> Pointer;
24  typedef itk::SmartPointer<const Self> ConstPointer;
25 
27  itkNewMacro(Self)
28 
29 
30  itkTypeMacro(ExpTensorImageFilter, ImageToImageFilter)
31 
32  typedef typename TOutputImage::PixelType OutputPixelType;
33  typedef typename TInputImage::PixelType InputPixelType;
34  typedef typename TInputImage::IndexType InputIndexType;
35  typedef typename TInputImage::PointType InputPointType;
36 
38  typedef typename TInputImage::Pointer InputImagePointer;
39  typedef typename TOutputImage::Pointer OutputImagePointer;
40 
42  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
43 
45  using LECalculatorPointer = typename LECalculatorType::Pointer;
46 
47  itkSetMacro(ScaleNonDiagonal, bool)
48 
49 protected:
51  {
52  m_ScaleNonDiagonal = true;
53 
54  m_TensorDimension = 3;
55  m_VectorSize = m_TensorDimension * (m_TensorDimension + 1) / 2;
56  }
57 
58  virtual ~ExpTensorImageFilter() {}
59 
60  void GenerateOutputInformation() ITK_OVERRIDE;
61  void BeforeThreadedGenerateData() ITK_OVERRIDE;
62  void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE;
63 
64 private:
65  ITK_DISALLOW_COPY_AND_ASSIGN(ExpTensorImageFilter);
66 
67  bool isZero(const InputPixelType &tensVec)
68  {
69  bool testZero = true;
70 
71  for (unsigned int i = 0;i < m_VectorSize;++i)
72  {
73  if (tensVec[i] != 0)
74  {
75  testZero = false;
76  break;
77  }
78  }
79 
80  return testZero;
81  }
82 
83  bool m_ScaleNonDiagonal;
84  unsigned int m_TensorDimension;
85  unsigned int m_VectorSize;
86 };
87 
88 } // end of namespace anima
89 
TOutputImage::Pointer OutputImagePointer
TOutputImage::PixelType OutputPixelType
Superclass::OutputImageRegionType OutputImageRegionType
TInputImage::PixelType InputPixelType
itk::VectorImage< TScalarType, NDimensions > TInputImage
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
void BeforeThreadedGenerateData() ITK_OVERRIDE
typename LECalculatorType::Pointer LECalculatorPointer
itk::SmartPointer< Self > Pointer
TInputImage::IndexType InputIndexType
TInputImage::PointType InputPointType
itk::VectorImage< TScalarType, NDimensions > TOutputImage
itk::SmartPointer< const Self > ConstPointer
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass