ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkEdgePotentialImageFilter.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 __itkEdgePotentialImageFilter_h
00019 #define __itkEdgePotentialImageFilter_h
00020 
00021 #include "itkUnaryFunctorImageFilter.h"
00022 
00023 namespace itk
00024 {
00037 namespace Functor
00038 {
00039 template< class TInput, class TOutput >
00040 class EdgePotential
00041 {
00042 public:
00043   EdgePotential() {}
00044   ~EdgePotential() {}
00045   bool operator!=(const EdgePotential &) const
00046   {
00047     return false;
00048   }
00049 
00050   bool operator==(const EdgePotential & other) const
00051   {
00052     return !( *this != other );
00053   }
00054 
00055   inline TOutput operator()(const TInput & A) const
00056   {
00057     return static_cast< TOutput >( vcl_exp( -1.0 * A.GetNorm() ) );
00058   }
00059 };
00060 }
00061 
00062 template< class TInputImage, class TOutputImage >
00063 class ITK_EXPORT EdgePotentialImageFilter:
00064   public
00065   UnaryFunctorImageFilter< TInputImage, TOutputImage,
00066                            Functor::EdgePotential<
00067                              typename TInputImage::PixelType,
00068                              typename TOutputImage::PixelType > >
00069 {
00070 public:
00072   typedef EdgePotentialImageFilter Self;
00073   typedef UnaryFunctorImageFilter< TInputImage, TOutputImage,
00074                                    Functor::EdgePotential<
00075                                      typename TInputImage::PixelType,
00076                                      typename TOutputImage::PixelType >
00077                                    >                                 Superclass;
00078 
00079   typedef SmartPointer< Self >       Pointer;
00080   typedef SmartPointer< const Self > ConstPointer;
00081 
00083   itkNewMacro(Self);
00084 
00086   itkTypeMacro(EdgePotentialImageFilter,
00087                UnaryFunctorImageFilter);
00088 
00089 #ifdef ITK_USE_CONCEPT_CHECKING
00090 
00091   itkConceptMacro( InputHasNumericTraitsCheck,
00092                    ( Concept::HasNumericTraits< typename TInputImage::PixelType::ValueType > ) );
00093 
00095 #endif
00096 protected:
00097   EdgePotentialImageFilter() {}
00098   virtual ~EdgePotentialImageFilter() {}
00099 private:
00100   EdgePotentialImageFilter(const Self &); //purposely not implemented
00101   void operator=(const Self &);           //purposely not implemented
00102 };
00103 } // end namespace itk
00105 
00106 #endif
00107