ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkNaryMaximumImageFilter.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 __itkNaryMaximumImageFilter_h
19 #define __itkNaryMaximumImageFilter_h
20 
22 #include "itkNumericTraits.h"
23 
24 namespace itk
25 {
26 namespace Functor
27 {
33 template< class TInput, class TOutput >
34 class Maximum1
35 {
36 public:
38  // not sure if this typedef really makes things more clear... could just use
39  // TOutput?
40 
41  Maximum1() {}
42  ~Maximum1() {}
43  inline TOutput operator()(const std::vector< TInput > & B) const
44  {
46 
47  for ( unsigned int i = 0; i < B.size(); i++ )
48  {
49  if ( A < static_cast< OutputValueType >( B[i] ) )
50  {
51  A = static_cast< OutputValueType >( B[i] );
52  }
53  }
54  return A;
55  }
56 
57  bool operator==(const Maximum1 &) const
58  {
59  return true;
60  }
61 
62  bool operator!=(const Maximum1 &) const
63  {
64  return false;
65  }
66 };
67 }
103 template< class TInputImage, class TOutputImage >
104 class ITK_EXPORT NaryMaximumImageFilter:
105  public
106  NaryFunctorImageFilter< TInputImage, TOutputImage,
107  Functor::Maximum1< typename TInputImage::PixelType,
108  typename TInputImage::PixelType > >
109 {
110 public:
113  typedef NaryFunctorImageFilter<
114  TInputImage, TOutputImage,
115  Functor::Maximum1< typename TInputImage::PixelType,
116  typename TInputImage::PixelType > > Superclass;
117 
120 
122  itkNewMacro(Self);
123 
125  itkTypeMacro(NaryMaximumImageFilter,
127 
128 #ifdef ITK_USE_CONCEPT_CHECKING
129 
130  itkConceptMacro( InputConvertibleToOutputCheck,
131  ( Concept::Convertible< typename TInputImage::PixelType,
132  typename TOutputImage::PixelType > ) );
133  itkConceptMacro( InputLessThanComparableCheck,
135  itkConceptMacro( InputHasNumericTraitsCheck,
137 
139 #endif
140 protected:
143 private:
144  NaryMaximumImageFilter(const Self &); //purposely not implemented
145  void operator=(const Self &); //purposely not implemented
146 };
147 } // end namespace itk
149 
150 #endif
151