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 __itkLog10ImageFilter_h 00019 #define __itkLog10ImageFilter_h 00020 00021 #include "itkUnaryFunctorImageFilter.h" 00022 #include "vnl/vnl_math.h" 00023 00024 namespace itk 00025 { 00026 namespace Functor 00027 { 00033 template< class TInput, class TOutput > 00034 class Log10 00035 { 00036 public: 00037 Log10() {} 00038 ~Log10() {} 00039 bool operator!=(const Log10 &) const 00040 { 00041 return false; 00042 } 00044 00045 bool operator==(const Log10 & other) const 00046 { 00047 return !( *this != other ); 00048 } 00049 00050 inline TOutput operator()(const TInput & A) const 00051 { 00052 return static_cast< TOutput >( vcl_log10( static_cast< double >( A ) ) ); 00053 } 00054 }; 00055 } 00065 template< class TInputImage, class TOutputImage > 00066 class ITK_EXPORT Log10ImageFilter: 00067 public 00068 UnaryFunctorImageFilter< TInputImage, TOutputImage, 00069 Functor::Log10< 00070 typename TInputImage::PixelType, 00071 typename TOutputImage::PixelType > > 00072 { 00073 public: 00075 typedef Log10ImageFilter Self; 00076 typedef UnaryFunctorImageFilter< 00077 TInputImage, TOutputImage, 00078 Functor::Log10< typename TInputImage::PixelType, 00079 typename TOutputImage::PixelType > > Superclass; 00080 00081 typedef SmartPointer< Self > Pointer; 00082 typedef SmartPointer< const Self > ConstPointer; 00083 00085 itkNewMacro(Self); 00086 00088 itkTypeMacro(Log10ImageFilter, 00089 UnaryFunctorImageFilter); 00090 00091 #ifdef ITK_USE_CONCEPT_CHECKING 00092 00093 itkConceptMacro( InputConvertibleToDoubleCheck, 00094 ( Concept::Convertible< typename TInputImage::PixelType, double > ) ); 00095 itkConceptMacro( DoubleConvertibleToOutputCheck, 00096 ( Concept::Convertible< double, typename TOutputImage::PixelType > ) ); 00097 00099 #endif 00100 protected: 00101 Log10ImageFilter() {} 00102 virtual ~Log10ImageFilter() {} 00103 private: 00104 Log10ImageFilter(const Self &); //purposely not implemented 00105 void operator=(const Self &); //purposely not implemented 00106 }; 00107 } // end namespace itk 00109 00110 #endif 00111