ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkGaussianKernelFunction_h 00019 #define __itkGaussianKernelFunction_h 00020 00021 #include "itkKernelFunctionBase.h" 00022 #include "vnl/vnl_math.h" 00023 #include <math.h> 00024 00025 namespace itk 00026 { 00040 template< typename TRealValueType = double > 00041 class ITK_EXPORT GaussianKernelFunction:public KernelFunctionBase<TRealValueType> 00042 { 00043 public: 00045 typedef GaussianKernelFunction Self; 00046 typedef KernelFunctionBase<TRealValueType> Superclass; 00047 typedef SmartPointer< Self > Pointer; 00048 00049 typedef typename Superclass::RealType RealType; 00051 itkNewMacro(Self); 00052 00054 itkTypeMacro(GaussianKernelFunction, KernelFunctionBase); 00055 00057 inline TRealValueType Evaluate(const TRealValueType & u) const 00058 { return ( vcl_exp( static_cast< TRealValueType >(-0.5) * vnl_math_sqr(u) ) * m_Factor ); } 00059 protected: 00060 GaussianKernelFunction(): m_Factor( NumericTraits< TRealValueType >::One / vcl_sqrt(static_cast< TRealValueType >(2.0 * vnl_math::pi )) ) {}; 00061 virtual ~GaussianKernelFunction() {}; 00062 void PrintSelf(std::ostream & os, Indent indent) const 00063 { Superclass::PrintSelf(os, indent); } 00064 private: 00065 GaussianKernelFunction(const Self &); //purposely not implemented 00066 void operator=(const Self &); //purposely not implemented 00068 00069 const TRealValueType m_Factor; 00070 }; 00071 } // end namespace itk 00072 00073 #endif 00074