ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkMinimumImageFilter.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 __itkMinimumImageFilter_h
00019 #define __itkMinimumImageFilter_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 Minimum
00034 {
00035 public:
00036   Minimum() {}
00037   ~Minimum() {}
00038   bool operator!=(const Minimum &) const
00039   {
00040     return false;
00041   }
00043 
00044   bool operator==(const Minimum & other) const
00045   {
00046     return !( *this != other );
00047   }
00048 
00049   inline TOutput operator()(const TInput1 & A, const TInput2 & B) const
00050   { return static_cast< TOutput >( ( A < B ) ? A : B ); }
00051 };
00052 }
00071 template< class TInputImage1, class TInputImage2 = TInputImage1, class TOutputImage = TInputImage1 >
00072 class ITK_EXPORT MinimumImageFilter:
00073   public
00074   BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
00075                             Functor::Minimum<
00076                               typename TInputImage1::PixelType,
00077                               typename TInputImage2::PixelType,
00078                               typename TOutputImage::PixelType >   >
00079 {
00080 public:
00082   typedef MinimumImageFilter Self;
00083   typedef BinaryFunctorImageFilter<
00084     TInputImage1, TInputImage2, TOutputImage,
00085     Functor::Minimum<
00086       typename TInputImage1::PixelType,
00087       typename TInputImage2::PixelType,
00088       typename TOutputImage::PixelType >
00089     >                               Superclass;
00090 
00091   typedef SmartPointer< Self >       Pointer;
00092   typedef SmartPointer< const Self > ConstPointer;
00093 
00095   itkNewMacro(Self);
00096 
00098   itkTypeMacro(MinimumImageFilter,
00099                BinaryFunctorImageFilter);
00100 
00101 #ifdef ITK_USE_CONCEPT_CHECKING
00102 
00103   itkConceptMacro( Input1ConvertibleToInput2Check,
00104                    ( Concept::Convertible< typename TInputImage1::PixelType,
00105                                            typename TInputImage2::PixelType > ) );
00106   itkConceptMacro( Input2ConvertibleToOutputCheck,
00107                    ( Concept::Convertible< typename TInputImage2::PixelType,
00108                                            typename TOutputImage::PixelType > ) );
00109   itkConceptMacro( Input1LessThanInput2Check,
00110                    ( Concept::LessThanComparable< typename TInputImage1::PixelType,
00111                                                   typename TInputImage2::PixelType > ) );
00112 
00114 #endif
00115 protected:
00116   MinimumImageFilter() {}
00117   virtual ~MinimumImageFilter() {}
00118 private:
00119   MinimumImageFilter(const Self &); //purposely not implemented
00120   void operator=(const Self &);     //purposely not implemented
00121 };
00122 } // end namespace itk
00124 
00125 #endif
00126