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: 2006/04/03 15:07:52 $
00007   Version:   $Revision: 1.8 $
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 
00079   void OrderEigenValuesBy( EigenValueOrderType order )
00080     {
00081     if( order == OrderByMagnitude )
00082       {
00083       m_Calculator.SetOrderEigenMagnitudes( true );
00084       }
00085     else if( order == DoNotOrder )
00086       {
00087       m_Calculator.SetOrderEigenValues( false );
00088       }
00089     }
00091 
00092 private:
00093   CalculatorType m_Calculator;
00094 }; 
00095 
00096 }  // end namespace functor
00097 
00098 
00122 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00123 class ITK_EXPORT SymmetricEigenAnalysisImageFilter :
00124     public
00125 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00126                         Functor::SymmetricEigenAnalysisFunction< 
00127                                         typename TInputImage::PixelType,
00128                                         typename TOutputImage::PixelType > >
00129 {
00130 public:
00132   typedef SymmetricEigenAnalysisImageFilter  Self;
00133   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00134                                   Functor::SymmetricEigenAnalysisFunction< 
00135                                         typename TInputImage::PixelType,
00136                                         typename TOutputImage::PixelType > >
00137                                                                       Superclass;
00138 
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 
00156   void OrderEigenValuesBy( EigenValueOrderType order )
00157     {
00158     this->GetFunctor().OrderEigenValuesBy( order );
00159     }
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 Sun Sep 23 14:22:53 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000