Orfeo Toolbox  4.0
itkMaximumImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkMaximumImageFilter_h
19 #define __itkMaximumImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput1, typename TInput2 = TInput1, typename TOutput = TInput1 >
33 class Maximum
34 {
35 public:
36  Maximum() {}
37  ~Maximum() {}
38  bool operator!=(const Maximum &) const
39  {
40  return false;
41  }
42 
43  bool operator==(const Maximum & other) const
44  {
45  return !( *this != other );
46  }
47 
48  inline TOutput operator()(const TInput1 & A, const TInput2 & B) const
49  {
50  if ( A > B )
51  {
52  return static_cast< TOutput >( A );
53  }
54  else
55  {
56  return static_cast< TOutput >( B );
57  }
58  }
59 };
60 }
79 template< typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1 >
81  public
82  BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
83  Functor::Maximum<
84  typename TInputImage1::PixelType,
85  typename TInputImage2::PixelType,
86  typename TOutputImage::PixelType > >
87 {
88 public:
91  typedef BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage,
93  typename TInputImage1::PixelType,
94  typename TInputImage2::PixelType,
95  typename TOutputImage::PixelType >
97 
100 
102  itkNewMacro(Self);
103 
105  itkTypeMacro(MaximumImageFilter,
107 
108 #ifdef ITK_USE_CONCEPT_CHECKING
109  // Begin concept checking
110  itkConceptMacro( Input1ConvertibleToOutputCheck,
111  ( Concept::Convertible< typename TInputImage1::PixelType,
112  typename TOutputImage::PixelType > ) );
113  itkConceptMacro( Input2ConvertibleToOutputCheck,
114  ( Concept::Convertible< typename TInputImage2::PixelType,
115  typename TOutputImage::PixelType > ) );
116  itkConceptMacro( Input1GreaterThanInput2Check,
117  ( Concept::GreaterThanComparable< typename TInputImage1::PixelType,
118  typename TInputImage2::PixelType > ) );
119  // End concept checking
120 #endif
121 
122 protected:
124  virtual ~MaximumImageFilter() {}
125 
126 private:
127  MaximumImageFilter(const Self &); //purposely not implemented
128  void operator=(const Self &); //purposely not implemented
129 };
130 } // end namespace itk
131 
132 #endif

Generated at Sat Mar 8 2014 15:11:46 for Orfeo Toolbox with doxygen 1.8.3.1