00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkTensorFractionalAnisotropyImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-04-01 14:36:36 $ 00007 Version: $Revision: 1.9 $ 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 __itkTensorFractionalAnisotropyImageFilter_h 00018 #define __itkTensorFractionalAnisotropyImageFilter_h 00019 00020 #include "itkUnaryFunctorImageFilter.h" 00021 00022 namespace itk 00023 { 00024 00025 // This functor class invokes the computation of fractional anisotropy from 00026 // every pixel. 00027 namespace Functor { 00028 00029 template< typename TInput > 00030 class TensorFractionalAnisotropyFunction 00031 { 00032 public: 00033 typedef typename TInput::RealValueType RealValueType; 00034 TensorFractionalAnisotropyFunction() {} 00035 ~TensorFractionalAnisotropyFunction() {} 00036 bool operator!=( const TensorFractionalAnisotropyFunction & ) const 00037 { 00038 return false; 00039 } 00040 bool operator==( const TensorFractionalAnisotropyFunction & other ) const 00041 { 00042 return !(*this != other); 00043 } 00044 inline RealValueType operator()( const TInput & x ) const 00045 { 00046 return x.GetFractionalAnisotropy(); 00047 } 00048 }; 00049 00050 } // end namespace functor 00051 00052 00067 template <typename TInputImage, typename TOutputImage=TInputImage> 00068 class ITK_EXPORT TensorFractionalAnisotropyImageFilter : 00069 public 00070 UnaryFunctorImageFilter<TInputImage,TOutputImage, 00071 Functor::TensorFractionalAnisotropyFunction< 00072 typename TInputImage::PixelType> > 00073 { 00074 public: 00076 typedef TensorFractionalAnisotropyImageFilter Self; 00077 typedef UnaryFunctorImageFilter< 00078 TInputImage,TOutputImage, 00079 Functor::TensorFractionalAnisotropyFunction< 00080 typename TInputImage::PixelType> > Superclass; 00081 typedef SmartPointer<Self> Pointer; 00082 typedef SmartPointer<const Self> ConstPointer; 00083 00084 typedef typename Superclass::OutputImageType OutputImageType; 00085 typedef typename TOutputImage::PixelType OutputPixelType; 00086 typedef typename TInputImage::PixelType InputPixelType; 00087 typedef typename InputPixelType::ValueType InputValueType; 00088 00090 itkTypeMacro( TensorFractionalAnisotropyImageFilter, UnaryFunctorImageFilter ); 00091 00093 itkNewMacro(Self); 00094 00096 void PrintSelf(std::ostream& os, Indent indent) const 00097 { this->Superclass::PrintSelf( os, indent ); } 00098 00099 #ifdef ITK_USE_CONCEPT_CHECKING 00100 00101 itkConceptMacro(InputHasNumericTraitsCheck, 00102 (Concept::HasNumericTraits<InputValueType>)); 00103 00105 #endif 00106 00107 protected: 00108 TensorFractionalAnisotropyImageFilter() {}; 00109 virtual ~TensorFractionalAnisotropyImageFilter() {}; 00110 00111 private: 00112 TensorFractionalAnisotropyImageFilter(const Self&); //purposely not implemented 00113 void operator=(const Self&); //purposely not implemented 00114 00115 }; 00116 00117 00118 00119 } // end namespace itk 00120 00121 #endif 00122