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 __itkMaximumImageFilter_h 00019 #define __itkMaximumImageFilter_h 00020 00021 #include "itkBinaryFunctorImageFilter.h" 00022 00023 namespace itk 00024 { 00025 namespace Functor 00026 { 00032 template< class TInput1, class TInput2 = TInput1, class TOutput = TInput1 > 00033 class Maximum 00034 { 00035 public: 00036 Maximum() {} 00037 ~Maximum() {} 00038 bool operator!=(const Maximum &) const 00039 { 00040 return false; 00041 } 00043 00044 bool operator==(const Maximum & other) const 00045 { 00046 return !( *this != other ); 00047 } 00048 00049 inline TOutput operator()(const TInput1 & A, const TInput2 & B) const 00050 { 00051 if ( A > B ) 00052 { 00053 return static_cast< TOutput >( A ); 00054 } 00055 else 00056 { 00057 return static_cast< TOutput >( B ); 00058 } 00059 } 00060 }; 00061 } 00080 template< class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1 > 00081 class ITK_EXPORT MaximumImageFilter: 00082 public 00083 BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, 00084 Functor::Maximum< 00085 typename TInputImage1::PixelType, 00086 typename TInputImage2::PixelType, 00087 typename TOutputImage::PixelType > > 00088 { 00089 public: 00091 typedef MaximumImageFilter Self; 00092 typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, 00093 Functor::Maximum< 00094 typename TInputImage1::PixelType, 00095 typename TInputImage2::PixelType, 00096 typename TOutputImage::PixelType > 00097 > Superclass; 00098 00099 typedef SmartPointer< Self > Pointer; 00100 typedef SmartPointer< const Self > ConstPointer; 00101 00103 itkNewMacro(Self); 00104 00106 itkTypeMacro(MaximumImageFilter, 00107 BinaryFunctorImageFilter); 00108 00109 #ifdef ITK_USE_CONCEPT_CHECKING 00110 00111 itkConceptMacro( Input1ConvertibleToOutputCheck, 00112 ( Concept::Convertible< typename TInputImage1::PixelType, 00113 typename TOutputImage::PixelType > ) ); 00114 itkConceptMacro( Input2ConvertibleToOutputCheck, 00115 ( Concept::Convertible< typename TInputImage2::PixelType, 00116 typename TOutputImage::PixelType > ) ); 00117 itkConceptMacro( Input1GreaterThanInput2Check, 00118 ( Concept::GreaterThanComparable< typename TInputImage1::PixelType, 00119 typename TInputImage2::PixelType > ) ); 00120 00122 #endif 00123 protected: 00124 MaximumImageFilter() {} 00125 virtual ~MaximumImageFilter() {} 00126 private: 00127 MaximumImageFilter(const Self &); //purposely not implemented 00128 void operator=(const Self &); //purposely not implemented 00129 }; 00130 } // end namespace itk 00132 00133 #endif 00134