Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkSymmetricEigenAnalysisImageFilter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkSymmetricEigenAnalysisImageFilter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-18 16:11:14 $
00007   Version:   $Revision: 1.10 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkSymmetricEigenAnalysisImageFilter_h
00018 #define __itkSymmetricEigenAnalysisImageFilter_h
00019 
00020 #include "itkUnaryFunctorImageFilter.h"
00021 #include "itkSymmetricEigenAnalysis.h"
00022 
00023 
00024 namespace itk
00025 {
00026 
00027 // This functor class invokes the computation of Eigen Analysis for
00028 // every pixel. The input pixel type must provide the API for the [][]
00029 // operator, while the output pixel type must provide the API for the
00030 // [] operator. Input pixel matrices should be symmetric.
00031 // 
00032 // The default operation is to order eigen values in ascending order.
00033 // You may also use OrderEigenValuesBy( ) to order eigen values by
00034 // magnitude as is common with use of tensors in vessel extraction.
00035 namespace Functor {  
00036  
00037 template< typename TInput, typename TOutput >
00038 class SymmetricEigenAnalysisFunction
00039 {
00040 public:
00041   typedef typename TInput::RealValueType  RealValueType;
00042   SymmetricEigenAnalysisFunction() {}
00043   ~SymmetricEigenAnalysisFunction() {}
00044   typedef SymmetricEigenAnalysis< TInput, TOutput > CalculatorType;
00045   bool operator!=( const SymmetricEigenAnalysisFunction & ) const
00046     {
00047     return false;
00048     }
00049   bool operator==( const SymmetricEigenAnalysisFunction & other ) const
00050     {
00051     return !(*this != other);
00052     }
00053 
00054   inline TOutput operator()( const TInput & x )
00055     {
00056     TOutput eigenValues;
00057     m_Calculator.ComputeEigenValues( x, eigenValues );
00058     return eigenValues;
00059     }
00060 
00062   void SetDimension( unsigned int n )
00063     {
00064     m_Calculator.SetDimension(n);
00065     }
00066 
00072   typedef enum {
00073     OrderByValue=1,
00074     OrderByMagnitude,
00075     DoNotOrder
00076   } EigenValueOrderType;
00077 
00080   void OrderEigenValuesBy( EigenValueOrderType order )
00081     {
00082     if( order == OrderByMagnitude )
00083       {
00084       m_Calculator.SetOrderEigenMagnitudes( true );
00085       }
00086     else if( order == DoNotOrder )
00087       {
00088       m_Calculator.SetOrderEigenValues( false );
00089       }
00090     }
00092 
00093 private:
00094   CalculatorType m_Calculator;
00095 }; 
00096 
00097 }  // end namespace functor
00098 
00099 
00123 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00124 class ITK_EXPORT SymmetricEigenAnalysisImageFilter :
00125     public
00126 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00127                         Functor::SymmetricEigenAnalysisFunction< 
00128                                         typename TInputImage::PixelType,
00129                                         typename TOutputImage::PixelType > >
00130 {
00131 public:
00133   typedef SymmetricEigenAnalysisImageFilter  Self;
00134   typedef UnaryFunctorImageFilter<
00135     TInputImage,TOutputImage, 
00136     Functor::SymmetricEigenAnalysisFunction< 
00137       typename TInputImage::PixelType,
00138       typename TOutputImage::PixelType > >   Superclass;
00139   typedef SmartPointer<Self>                 Pointer;
00140   typedef SmartPointer<const Self>           ConstPointer;
00141 
00142   typedef typename Superclass::OutputImageType    OutputImageType;
00143   typedef typename TOutputImage::PixelType        OutputPixelType;
00144   typedef typename TInputImage::PixelType         InputPixelType;
00145   typedef typename InputPixelType::ValueType      InputValueType;
00146   typedef typename Superclass::FunctorType        FunctorType; 
00147 
00153   typedef typename FunctorType::EigenValueOrderType         EigenValueOrderType;
00154 
00157   void OrderEigenValuesBy( EigenValueOrderType order )
00158     {
00159     this->GetFunctor().OrderEigenValuesBy( order );
00160     }
00161 
00163   itkTypeMacro( SymmetricEigenAnalysisImageFilter, UnaryFunctorImageFilter );
00164 
00166   itkNewMacro(Self);
00167 
00169   void PrintSelf(std::ostream& os, Indent indent) const
00170     { this->Superclass::PrintSelf( os, indent ); }
00171 
00174   void SetDimension( unsigned int p )
00175     {
00176     this->GetFunctor().SetDimension(p);
00177     }
00178 
00179 #ifdef ITK_USE_CONCEPT_CHECKING
00180 
00181   itkConceptMacro(InputHasNumericTraitsCheck,
00182                   (Concept::HasNumericTraits<InputValueType>));
00183 
00185 #endif
00186 
00187 protected:
00188   SymmetricEigenAnalysisImageFilter() {};
00189   virtual ~SymmetricEigenAnalysisImageFilter() {};
00190 
00191 private:
00192   SymmetricEigenAnalysisImageFilter(const Self&); //purposely not implemented
00193   void operator=(const Self&); //purposely not implemented
00194 
00195 };
00196 
00197 
00198   
00199 } // end namespace itk
00200   
00201 #endif
00202 

Generated at Thu Nov 6 00:22:56 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000