ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkSinImageFilter.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 __itkSinImageFilter_h
00019 #define __itkSinImageFilter_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 Sin
00035 {
00036 public:
00037   Sin() {}
00038   ~Sin() {}
00039   bool operator!=(const Sin &) const
00040   {
00041     return false;
00042   }
00044 
00045   bool operator==(const Sin & other) const
00046   {
00047     return !( *this != other );
00048   }
00049 
00050   inline TOutput operator()(const TInput & A) const
00051   { return (TOutput)vcl_sin( (double)A ); }
00052 };
00053 }
00067 template< class TInputImage, class TOutputImage >
00068 class ITK_EXPORT SinImageFilter:
00069   public
00070   UnaryFunctorImageFilter< TInputImage, TOutputImage,
00071                            Functor::Sin<
00072                              typename TInputImage::PixelType,
00073                              typename TOutputImage::PixelType >   >
00074 {
00075 public:
00077   typedef SinImageFilter Self;
00078   typedef UnaryFunctorImageFilter<
00079     TInputImage, TOutputImage,
00080     Functor::Sin< typename TInputImage::PixelType,
00081                   typename TOutputImage::PixelType > >  Superclass;
00082 
00083   typedef SmartPointer< Self >       Pointer;
00084   typedef SmartPointer< const Self > ConstPointer;
00085 
00087   itkNewMacro(Self);
00088 
00090   itkTypeMacro(SinImageFilter,
00091                UnaryFunctorImageFilter);
00092 
00093 #ifdef ITK_USE_CONCEPT_CHECKING
00094 
00095   itkConceptMacro( InputConvertibleToDoubleCheck,
00096                    ( Concept::Convertible< typename TInputImage::PixelType, double > ) );
00097   itkConceptMacro( DoubleConvertibleToOutputCheck,
00098                    ( Concept::Convertible< double, typename TOutputImage::PixelType > ) );
00099 
00101 #endif
00102 protected:
00103   SinImageFilter() {}
00104   virtual ~SinImageFilter() {}
00105 private:
00106   SinImageFilter(const Self &); //purposely not implemented
00107   void operator=(const Self &); //purposely not implemented
00108 };
00109 } // end namespace itk
00111 
00112 #endif
00113