VMTK
Loading...
Searching...
No Matches
itkSymmetricEigenVectorAnalysisImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Insight Segmentation & Registration Toolkit
4
5 Copyright (c) Insight Software Consortium. All rights reserved.
6 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
7
8 This software is distributed WITHOUT ANY WARRANTY; without even
9 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 PURPOSE. See the above copyright notices for more information.
11
12=========================================================================*/
13#ifndef __itkSymmetricEigenVectorAnalysisImageFilter_h
14#define __itkSymmetricEigenVectorAnalysisImageFilter_h
15
16#include "itkUnaryFunctorImageFilter.h"
17#include "itkSymmetricEigenAnalysis.h"
18
19
20namespace itk
21{
22
23// This functor class invokes the computation of Eigen Analysis for
24// every pixel. The input pixel type must provide the API for the [][]
25// operator, while the output pixel type must provide the API for the
26// [] operator. Input pixel matrices should be symmetric.
27//
28// The default operation is to order eigen values in ascending order.
29// You may also use OrderEigenValuesBy( ) to order eigen values by
30// magnitude as is common with use of tensors in vessel extraction.
31namespace Functor {
32
33template< typename TInput, typename TOutput, typename TMatrix >
35{
36public:
39 typedef SymmetricEigenAnalysis< TInput, TOutput, TMatrix > CalculatorType;
41 {
42 return false;
43 }
45 {
46 return !(*this != other);
47 }
48
49 inline TMatrix operator()( const TInput & x )
50 {
51 TOutput eigenValues;
52 TMatrix eigenVectorMatrix;
53 m_Calculator.ComputeEigenValuesAndVectors( x, eigenValues, eigenVectorMatrix );
54 return eigenVectorMatrix;
55 }
56
58 void SetDimension( unsigned int n )
59 {
60 m_Calculator.SetDimension(n);
61 }
62
73
76 {
77 if( order == OrderByMagnitude )
78 {
79 m_Calculator.SetOrderEigenMagnitudes( true );
80 }
81 else if( order == DoNotOrder )
82 {
83 m_Calculator.SetOrderEigenValues( false );
84 }
85 }
86
87private:
88 CalculatorType m_Calculator;
89};
90
91} // end namespace functor
92
93
102template <typename TInputImage, typename TOutputImage, typename TOutputMatrix>
104 public
105UnaryFunctorImageFilter<TInputImage,TOutputMatrix,
106 Functor::SymmetricEigenVectorAnalysisFunction<
107 typename TInputImage::PixelType,
108 typename TOutputImage::PixelType,
109 typename TOutputMatrix::PixelType > >
110{
111public:
114 typedef UnaryFunctorImageFilter<TInputImage,TOutputMatrix,
116 typename TInputImage::PixelType,
117 typename TOutputImage::PixelType,
118 typename TOutputMatrix::PixelType > >
120
121 typedef SmartPointer<Self> Pointer;
122 typedef SmartPointer<const Self> ConstPointer;
123
124 typedef typename Superclass::OutputImageType OutputImageType;
125 typedef typename TOutputImage::PixelType OutputPixelType;
126 typedef typename TInputImage::PixelType InputPixelType;
127 typedef typename Superclass::FunctorType FunctorType;
128
134 typedef typename FunctorType::EigenValueOrderType EigenValueOrderType;
135
138 {
139 this->GetFunctor().OrderEigenValuesBy( order );
140 }
141
144
146 void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE
147 { this->Superclass::PrintSelf( os, indent ); }
148
151 void SetDimension( unsigned int p )
152 {
153 this->GetFunctor().SetDimension(p);
154 }
155
156protected:
159
160private:
161 SymmetricEigenVectorAnalysisImageFilter(const Self&); //purposely not implemented
162 void operator=(const Self&); //purposely not implemented
163
164};
165
166
167
168} // end namespace itk
169
170#endif
bool operator!=(const SymmetricEigenVectorAnalysisFunction &) const
SymmetricEigenAnalysis< TInput, TOutput, TMatrix > CalculatorType
bool operator==(const SymmetricEigenVectorAnalysisFunction &other) const
Computes, at every pixel, the eigenvectors of a symmetric matrix input via a unary functor image filt...
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
UnaryFunctorImageFilter< TensorImageType, OutputMatrixImageType, Functor::SymmetricEigenVectorAnalysisFunction< typename TensorImageType::PixelType, typename EigenAnalysisOutputImageType::PixelType, typename OutputMatrixImageType::PixelType > > Superclass