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 __itkAtan2ImageFilter_h 00019 #define __itkAtan2ImageFilter_h 00020 00021 #include "itkBinaryFunctorImageFilter.h" 00022 #include "vnl/vnl_math.h" 00023 00024 namespace itk 00025 { 00026 namespace Functor 00027 { 00033 template< class TInput1, class TInput2, class TOutput > 00034 class Atan2 00035 { 00036 public: 00037 Atan2() {} 00038 ~Atan2() {} 00039 bool operator!=(const Atan2 &) const 00040 { 00041 return false; 00042 } 00044 00045 bool operator==(const Atan2 & other) const 00046 { 00047 return !( *this != other ); 00048 } 00049 00050 inline TOutput operator()(const TInput1 & A, const TInput2 & B) const 00051 { 00052 return static_cast< TOutput >( 00053 vcl_atan2( 00054 static_cast< double >( A ), 00055 static_cast< double >( B ) ) 00056 ); 00057 } 00058 }; 00059 } 00084 template< class TInputImage1, class TInputImage2, class TOutputImage > 00085 class ITK_EXPORT Atan2ImageFilter: 00086 public 00087 BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, 00088 Functor::Atan2< 00089 typename TInputImage1::PixelType, 00090 typename TInputImage2::PixelType, 00091 typename TOutputImage::PixelType > > 00092 { 00093 public: 00095 typedef Atan2ImageFilter Self; 00096 typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, 00097 Functor::Atan2< 00098 typename TInputImage1::PixelType, 00099 typename TInputImage2::PixelType, 00100 typename TOutputImage::PixelType > 00101 > Superclass; 00102 00103 typedef SmartPointer< Self > Pointer; 00104 typedef SmartPointer< const Self > ConstPointer; 00105 00107 itkNewMacro(Self); 00108 00110 itkTypeMacro(Atan2ImageFilter, 00111 BinaryFunctorImageFilter); 00112 00113 #ifdef ITK_USE_CONCEPT_CHECKING 00114 00115 itkConceptMacro( Input1ConvertibleToDoubleCheck, 00116 ( Concept::Convertible< typename TInputImage1::PixelType, double > ) ); 00117 itkConceptMacro( Input2ConvertibleToDoubleCheck, 00118 ( Concept::Convertible< typename TInputImage2::PixelType, double > ) ); 00119 itkConceptMacro( DoubleConvertibleToOutputCheck, 00120 ( Concept::Convertible< double, typename TOutputImage::PixelType > ) ); 00121 00123 #endif 00124 protected: 00125 Atan2ImageFilter() {} 00126 virtual ~Atan2ImageFilter() {} 00127 private: 00128 Atan2ImageFilter(const Self &); //purposely not implemented 00129 void operator=(const Self &); //purposely not implemented 00130 }; 00131 } // end namespace itk 00133 00134 #endif 00135