ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTensorRelativeAnisotropyImageFilter.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 __itkTensorRelativeAnisotropyImageFilter_h
00019 #define __itkTensorRelativeAnisotropyImageFilter_h
00020 
00021 #include "itkUnaryFunctorImageFilter.h"
00022 #include "itkImage.h"
00023 
00024 namespace itk
00025 {
00026 // This functor class invokes the computation of relative anisotropy from
00027 // every pixel.
00028 namespace Functor
00029 {
00030 template< typename TInput >
00031 class TensorRelativeAnisotropyFunction
00032 {
00033 public:
00034   typedef typename TInput::RealValueType RealValueType;
00035   TensorRelativeAnisotropyFunction() {}
00036   ~TensorRelativeAnisotropyFunction() {}
00037   bool operator!=(const TensorRelativeAnisotropyFunction &) const
00038   {
00039     return false;
00040   }
00041 
00042   bool operator==(const TensorRelativeAnisotropyFunction & other) const
00043   {
00044     return !( *this != other );
00045   }
00046 
00047   inline RealValueType operator()(const TInput & x) const
00048   {
00049     return x.GetRelativeAnisotropy();
00050   }
00051 };
00052 }  // end namespace functor
00053 
00069 template< typename  TInputImage, typename  TOutputImage = Image<
00070     typename NumericTraits< typename TInputImage::PixelType::ValueType >::RealType,
00071     TInputImage::Dimension > >
00072 class ITK_EXPORT TensorRelativeAnisotropyImageFilter:
00073   public
00074   UnaryFunctorImageFilter< TInputImage, TOutputImage,
00075                            Functor::TensorRelativeAnisotropyFunction<
00076                              typename TInputImage::PixelType > >
00077 {
00078 public:
00080   typedef TensorRelativeAnisotropyImageFilter Self;
00081   typedef UnaryFunctorImageFilter<
00082     TInputImage, TOutputImage,
00083     Functor::TensorRelativeAnisotropyFunction<
00084       typename TInputImage::PixelType > >       Superclass;
00085 
00086   typedef SmartPointer< Self >       Pointer;
00087   typedef SmartPointer< const Self > ConstPointer;
00088 
00089   typedef typename Superclass::OutputImageType OutputImageType;
00090   typedef typename TOutputImage::PixelType     OutputPixelType;
00091   typedef typename TInputImage::PixelType      InputPixelType;
00092   typedef typename InputPixelType::ValueType   InputValueType;
00093 
00095   itkTypeMacro(TensorRelativeAnisotropyImageFilter, UnaryFunctorImageFilter);
00096 
00098   itkNewMacro(Self);
00099 
00101   void PrintSelf(std::ostream & os, Indent indent) const
00102   { this->Superclass::PrintSelf(os, indent); }
00103 
00104 #ifdef ITK_USE_CONCEPT_CHECKING
00105 
00106   itkConceptMacro( InputHasNumericTraitsCheck,
00107                    ( Concept::HasNumericTraits< InputValueType > ) );
00108 
00110 #endif
00111 protected:
00112   TensorRelativeAnisotropyImageFilter() {}
00113   virtual ~TensorRelativeAnisotropyImageFilter() {}
00114 private:
00115   TensorRelativeAnisotropyImageFilter(const Self &); //purposely not implemented
00116   void operator=(const Self &);                      //purposely not implemented
00117 };
00118 } // end namespace itk
00120 
00121 #endif
00122