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: 2009-04-01 14:36:36 $
00007   Version:   $Revision: 1.12 $
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 ) const
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 
00119 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00120 class ITK_EXPORT SymmetricEigenAnalysisImageFilter :
00121     public
00122 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00123                         Functor::SymmetricEigenAnalysisFunction< 
00124                                         typename TInputImage::PixelType,
00125                                         typename TOutputImage::PixelType > >
00126 {
00127 public:
00129   typedef SymmetricEigenAnalysisImageFilter  Self;
00130   typedef UnaryFunctorImageFilter<
00131     TInputImage,TOutputImage, 
00132     Functor::SymmetricEigenAnalysisFunction< 
00133       typename TInputImage::PixelType,
00134       typename TOutputImage::PixelType > >   Superclass;
00135   typedef SmartPointer<Self>                 Pointer;
00136   typedef SmartPointer<const Self>           ConstPointer;
00137 
00138   typedef typename Superclass::OutputImageType    OutputImageType;
00139   typedef typename TOutputImage::PixelType        OutputPixelType;
00140   typedef typename TInputImage::PixelType         InputPixelType;
00141   typedef typename InputPixelType::ValueType      InputValueType;
00142   typedef typename Superclass::FunctorType        FunctorType; 
00143 
00149   typedef typename FunctorType::EigenValueOrderType         EigenValueOrderType;
00150 
00153   void OrderEigenValuesBy( EigenValueOrderType order )
00154     {
00155     this->GetFunctor().OrderEigenValuesBy( order );
00156     }
00157 
00159   itkTypeMacro( SymmetricEigenAnalysisImageFilter, UnaryFunctorImageFilter );
00160 
00162   itkNewMacro(Self);
00163 
00165   void PrintSelf(std::ostream& os, Indent indent) const
00166     { this->Superclass::PrintSelf( os, indent ); }
00167 
00170   void SetDimension( unsigned int p )
00171     {
00172     this->GetFunctor().SetDimension(p);
00173     }
00174 
00175 #ifdef ITK_USE_CONCEPT_CHECKING
00176 
00177   itkConceptMacro(InputHasNumericTraitsCheck,
00178                   (Concept::HasNumericTraits<InputValueType>));
00179 
00181 #endif
00182 
00183 protected:
00184   SymmetricEigenAnalysisImageFilter() {};
00185   virtual ~SymmetricEigenAnalysisImageFilter() {};
00186 
00187 private:
00188   SymmetricEigenAnalysisImageFilter(const Self&); //purposely not implemented
00189   void operator=(const Self&); //purposely not implemented
00190 
00191 };
00192 
00193 
00194   
00195 } // end namespace itk
00196   
00197 #endif
00198 

Generated at Fri Apr 16 19:47:26 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000