ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTensorFractionalAnisotropyImageFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkTensorFractionalAnisotropyImageFilter_h
00019 #define __itkTensorFractionalAnisotropyImageFilter_h
00020 
00021 #include "itkUnaryFunctorImageFilter.h"
00022 #include "itkImage.h"
00023 
00024 namespace itk
00025 {
00026 // This functor class invokes the computation of fractional anisotropy from
00027 // every pixel.
00028 namespace Functor
00029 {
00030 template< typename TInput >
00031 class TensorFractionalAnisotropyFunction
00032 {
00033 public:
00034   typedef typename TInput::RealValueType RealValueType;
00035   TensorFractionalAnisotropyFunction() {}
00036   ~TensorFractionalAnisotropyFunction() {}
00037   bool operator!=(const TensorFractionalAnisotropyFunction &) const
00038   {
00039     return false;
00040   }
00041 
00042   bool operator==(const TensorFractionalAnisotropyFunction & other) const
00043   {
00044     return !( *this != other );
00045   }
00046 
00047   inline RealValueType operator()(const TInput & x) const
00048   {
00049     return x.GetFractionalAnisotropy();
00050   }
00051 };
00052 }  // end namespace functor
00053 
00069 template< typename  TInputImage,
00070   typename  TOutputImage = Image<
00071     typename NumericTraits< typename TInputImage::PixelType::ValueType >::RealType,
00072     TInputImage::Dimension > >
00073 class ITK_EXPORT TensorFractionalAnisotropyImageFilter:
00074   public
00075   UnaryFunctorImageFilter< TInputImage, TOutputImage,
00076                            Functor::TensorFractionalAnisotropyFunction<
00077                              typename TInputImage::PixelType > >
00078 {
00079 public:
00081   typedef TensorFractionalAnisotropyImageFilter Self;
00082   typedef UnaryFunctorImageFilter<
00083     TInputImage, TOutputImage,
00084     Functor::TensorFractionalAnisotropyFunction<
00085       typename TInputImage::PixelType > >         Superclass;
00086 
00087   typedef SmartPointer< Self >       Pointer;
00088   typedef SmartPointer< const Self > ConstPointer;
00089 
00090   typedef typename Superclass::OutputImageType OutputImageType;
00091   typedef typename TOutputImage::PixelType     OutputPixelType;
00092   typedef typename TInputImage::PixelType      InputPixelType;
00093   typedef typename InputPixelType::ValueType   InputValueType;
00094 
00096   itkTypeMacro(TensorFractionalAnisotropyImageFilter, UnaryFunctorImageFilter);
00097 
00099   itkNewMacro(Self);
00100 
00102   void PrintSelf(std::ostream & os, Indent indent) const
00103   { this->Superclass::PrintSelf(os, indent); }
00104 
00105 #ifdef ITK_USE_CONCEPT_CHECKING
00106 
00107   itkConceptMacro( InputHasNumericTraitsCheck,
00108                    ( Concept::HasNumericTraits< InputValueType > ) );
00109 
00111 #endif
00112 protected:
00113   TensorFractionalAnisotropyImageFilter() {}
00114   virtual ~TensorFractionalAnisotropyImageFilter() {}
00115 private:
00116   TensorFractionalAnisotropyImageFilter(const Self &); //purposely not
00117                                                        // implemented
00118   void operator=(const Self &);                        //purposely not
00120 
00121   // implemented
00122 };
00123 } // end namespace itk
00124 
00125 #endif
00126