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 __itkOrImageFilter_h 00019 #define __itkOrImageFilter_h 00020 00021 #include "itkBinaryFunctorImageFilter.h" 00022 #include "itkNumericTraits.h" 00023 00024 namespace itk 00025 { 00026 namespace Functor 00027 { 00033 template< class TInput1, class TInput2 = TInput1, class TOutput = TInput1 > 00034 class OR 00035 { 00036 public: 00037 OR() {} 00038 ~OR() {} 00039 bool operator!=(const OR &) const 00040 { 00041 return false; 00042 } 00044 00045 bool operator==(const OR & 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 >( A | B ); 00053 } 00054 }; 00055 } 00083 template< class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1 > 00084 class ITK_EXPORT OrImageFilter: 00085 public 00086 BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, 00087 Functor::OR< 00088 typename TInputImage1::PixelType, 00089 typename TInputImage2::PixelType, 00090 typename TOutputImage::PixelType > > 00091 00092 { 00093 public: 00095 typedef OrImageFilter Self; 00096 typedef BinaryFunctorImageFilter< 00097 TInputImage1, TInputImage2, TOutputImage, 00098 Functor::OR< typename TInputImage1::PixelType, 00099 typename TInputImage2::PixelType, 00100 typename TOutputImage::PixelType > > Superclass; 00101 00102 typedef SmartPointer< Self > Pointer; 00103 typedef SmartPointer< const Self > ConstPointer; 00104 00106 itkNewMacro(Self); 00107 00109 itkTypeMacro(OrImageFilter, 00110 BinaryFunctorImageFilter); 00111 00112 #ifdef ITK_USE_CONCEPT_CHECKING 00113 00114 itkConceptMacro( Input1Input2OutputLogicalOperatorsCheck, 00115 ( Concept::LogicalOperators< typename TInputImage1::PixelType, 00116 typename TInputImage2::PixelType, 00117 typename TOutputImage::PixelType > ) ); 00118 00120 #endif 00121 protected: 00122 OrImageFilter() {} 00123 virtual ~OrImageFilter() {} 00124 private: 00125 OrImageFilter(const Self &); //purposely not implemented 00126 void operator=(const Self &); //purposely not implemented 00127 }; 00128 } // end namespace itk 00130 00131 #endif 00132