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: 2005/06/09 19:04:51 $
00007   Version:   $Revision: 1.5 $
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   inline TOutput operator()( const TInput & x )
00046     {
00047     TOutput eigenValues;
00048     m_Calculator.ComputeEigenValues( x, eigenValues );
00049     return eigenValues;
00050     }
00051 
00053   void SetDimension( unsigned int n )
00054     {
00055     m_Calculator.SetDimension(n);
00056     }
00057 
00063   typedef enum {
00064     OrderByValue=1,
00065     OrderByMagnitude,
00066     DoNotOrder
00067   }EigenValueOrderType;
00068  
00070   void OrderEigenValuesBy( EigenValueOrderType order )
00071     {
00072     if( order == OrderByMagnitude )
00073       {
00074       m_Calculator.SetOrderEigenMagnitudes( true );
00075       }
00076     else if( order == DoNotOrder )
00077       {
00078       m_Calculator.SetOrderEigenValues( false );
00079       }
00080     }
00081 
00082 private:
00083   CalculatorType m_Calculator;
00084 }; 
00085 
00086 }  // end namespace functor
00087 
00088 
00112 template <typename  TInputImage, typename  TOutputImage=TInputImage>
00113 class ITK_EXPORT SymmetricEigenAnalysisImageFilter :
00114     public
00115 UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00116                         Functor::SymmetricEigenAnalysisFunction< 
00117                                         typename TInputImage::PixelType,
00118                                         typename TOutputImage::PixelType > >
00119 {
00120 public:
00122   typedef SymmetricEigenAnalysisImageFilter  Self;
00123   typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 
00124                                   Functor::SymmetricEigenAnalysisFunction< 
00125                                         typename TInputImage::PixelType,
00126                                         typename TOutputImage::PixelType > >
00127                                                                       Superclass;
00128 
00129   typedef SmartPointer<Self>   Pointer;
00130   typedef SmartPointer<const Self>  ConstPointer;
00131 
00132   typedef typename Superclass::OutputImageType    OutputImageType;
00133   typedef typename TOutputImage::PixelType        OutputPixelType;
00134   typedef typename TInputImage::PixelType         InputPixelType;
00135   typedef typename InputPixelType::ValueType      InputValueType;
00136   typedef typename Superclass::FunctorType        FunctorType; 
00137 
00143   typedef typename FunctorType::EigenValueOrderType         EigenValueOrderType;
00144  
00146   void OrderEigenValuesBy( EigenValueOrderType order )
00147     {
00148     this->GetFunctor().OrderEigenValuesBy( order );
00149     }
00150 
00152   itkNewMacro(Self);
00153   
00155   void PrintSelf(std::ostream& os, Indent indent) const
00156     { this->Superclass::PrintSelf( os, indent ); }
00157   
00160   void SetDimension( unsigned int p )
00161     {
00162     this->GetFunctor().SetDimension(p);
00163     }
00164 
00165     
00166 protected:
00167   SymmetricEigenAnalysisImageFilter() {};
00168   virtual ~SymmetricEigenAnalysisImageFilter() {};
00169 
00170 private:
00171   SymmetricEigenAnalysisImageFilter(const Self&); //purposely not implemented
00172   void operator=(const Self&); //purposely not implemented
00173 
00174 };
00175 
00176 
00177   
00178 } // end namespace itk
00179   
00180 #endif

Generated at Thu May 25 00:07:24 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000