ITK  5.0.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 type alias really makes things more clear... could just use
39  // TOutput?
40 
41  Maximum1() = default;
42  ~Maximum1() = default;
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 }
68 
104 template< typename TInputImage, typename TOutputImage >
106  public
107  NaryFunctorImageFilter< TInputImage, TOutputImage,
108  Functor::Maximum1< typename TInputImage::PixelType,
109  typename TInputImage::PixelType > >
110 {
111 public:
112  ITK_DISALLOW_COPY_AND_ASSIGN(NaryMaximumImageFilter);
113 
117  TInputImage, TOutputImage,
118  Functor::Maximum1< typename TInputImage::PixelType,
119  typename TInputImage::PixelType > >;
120 
123 
125  itkNewMacro(Self);
126 
128  itkTypeMacro(NaryMaximumImageFilter,
130 
131 #ifdef ITK_USE_CONCEPT_CHECKING
132  // Begin concept checking
133  itkConceptMacro( InputConvertibleToOutputCheck,
134  ( Concept::Convertible< typename TInputImage::PixelType,
135  typename TOutputImage::PixelType > ) );
136  itkConceptMacro( InputLessThanComparableCheck,
138  itkConceptMacro( InputHasNumericTraitsCheck,
140  // End concept checking
141 #endif
142 
143 protected:
144  NaryMaximumImageFilter() = default;
145  ~NaryMaximumImageFilter() override = default;
146 };
147 } // end namespace itk
148 
149 #endif
Define numeric traits for std::vector.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
~NaryMaximumImageFilter() override=default
bool operator!=(const Maximum1 &) const
Perform a generic pixel-wise operation on N images.
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.
typename NumericTraits< TInputImage::PixelType >::ValueType OutputValueType