ITK  4.13.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< typename TInput, typename 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< typename TInputImage, typename TOutputImage >
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  // Begin concept checking
130  itkConceptMacro( InputConvertibleToOutputCheck,
131  ( Concept::Convertible< typename TInputImage::PixelType,
132  typename TOutputImage::PixelType > ) );
133  itkConceptMacro( InputLessThanComparableCheck,
135  itkConceptMacro( InputHasNumericTraitsCheck,
137  // End concept checking
138 #endif
139 
140 protected:
142  virtual ~NaryMaximumImageFilter() ITK_OVERRIDE {}
143 
144 private:
145  ITK_DISALLOW_COPY_AND_ASSIGN(NaryMaximumImageFilter);
146 };
147 } // end namespace itk
148 
149 #endif
NaryFunctorImageFilter< TInputImage, TOutputImage, Functor::Maximum1< typename TInputImage::PixelType, typename TInputImage::PixelType > > Superclass
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
bool operator!=(const Maximum1 &) const
NumericTraits< TOutput >::ValueType OutputValueType
Perform a generic pixel-wise operation on N images.
static ITK_CONSTEXPR_FUNC T NonpositiveMin()
TOutput operator()(const std::vector< TInput > &B) const
bool operator==(const Maximum1 &) const
#define itkConceptMacro(name, concept)
Computes the pixel-wise maximum of several images.