ANIMA  4.0
animaJacobianMatrixImageFilter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <iostream>
4 #include <itkImageToImageFilter.h>
5 #include <itkVectorLinearInterpolateNearestNeighborExtrapolateImageFunction.h>
6 #include <itkImage.h>
7 
8 namespace anima
9 {
10 
18 template <typename TPixelType, typename TOutputPixelType, unsigned int Dimension>
20 public itk::ImageToImageFilter< itk::Image <itk::Vector <TPixelType, Dimension>, Dimension> ,
21  itk::Image <itk::Vector <TOutputPixelType, Dimension * Dimension>, Dimension> >
22 {
23 public:
25  typedef typename itk::Image <itk::Vector <TPixelType, Dimension>, Dimension> InputImageType;
26  typedef typename itk::Image <itk::Vector <TOutputPixelType, Dimension * Dimension>, Dimension> OutputImageType;
27  typedef typename itk::Image <TOutputPixelType, Dimension> DeterminantImageType;
28  typedef itk::ImageToImageFilter <InputImageType, OutputImageType> Superclass;
29  typedef itk::SmartPointer<Self> Pointer;
30  typedef itk::SmartPointer<const Self> ConstPointer;
31 
32  itkNewMacro(Self)
33 
34  itkTypeMacro(JacobianMatrixImageFilter, itk::ImageToImageFilter)
35 
36  typedef typename InputImageType::IndexType IndexType;
37  typedef typename InputImageType::RegionType RegionType;
38  typedef typename InputImageType::PointType PointType;
39  typedef typename InputImageType::PixelType InputPixelType;
40  typedef typename OutputImageType::PixelType OutputPixelType;
41 
42  typedef typename InputImageType::Pointer InputImagePointer;
43  typedef typename OutputImageType::Pointer OutputImagePointer;
44 
45  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
46 
47  typedef itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction <InputImageType> InterpolatorType;
48  typedef typename InterpolatorType::Pointer InterpolatorPointer;
49 
50  itkSetMacro(NoIdentity, bool)
51  itkSetMacro(ComputeDeterminant, bool)
52  itkGetObjectMacro(DeterminantImage, DeterminantImageType)
53 
54  void SetNeighborhood(unsigned int val);
55 
56 protected:
58  {
59  m_NoIdentity = false;
60  m_Neighborhood = 1;
61  m_OnlySixConnectivity = true;
62 
63  m_ComputeDeterminant = false;
64  m_DeterminantImage = 0;
65  }
66 
68 
69  void BeforeThreadedGenerateData() ITK_OVERRIDE;
70  void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE;
71 
72  bool CheckFaceConnectivity(const IndexType &internalIndex, const IndexType &currentIndex);
73 
74 private:
75  ITK_DISALLOW_COPY_AND_ASSIGN(JacobianMatrixImageFilter);
76 
78  bool m_NoIdentity;
79 
81  unsigned int m_Neighborhood;
82  bool m_OnlySixConnectivity;
83 
84  typename DeterminantImageType::Pointer m_DeterminantImage;
85  bool m_ComputeDeterminant;
86 
87  InterpolatorPointer m_FieldInterpolator;
88 };
89 
90 } // end namespace anima
91 
itkGetObjectMacro(DeterminantImage, DeterminantImageType) void SetNeighborhood(unsigned int val)
itk::Image< TOutputPixelType, Dimension > DeterminantImageType
Compute the Jacobian matrix in real coordinates of a displacement field.
itk::Image< itk::Vector< TOutputPixelType, Dimension *Dimension >, Dimension > OutputImageType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) ITK_OVERRIDE
itk::SmartPointer< const Self > ConstPointer
itk::Image< itk::Vector< TPixelType, Dimension >, Dimension > InputImageType
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
itk::VectorLinearInterpolateNearestNeighborExtrapolateImageFunction< InputImageType > InterpolatorType
Superclass::OutputImageRegionType OutputImageRegionType
bool CheckFaceConnectivity(const IndexType &internalIndex, const IndexType &currentIndex)