ITK  5.4.0
Insight Toolkit
itkNaryMaximumImageFilter.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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#include <algorithm> // For max.
24
25namespace itk
26{
27namespace Functor
28{
34template <typename TInput, typename TOutput>
36{
37public:
39 // not sure if this type alias really makes things more clear... could just use
40 // TOutput?
41
42 inline TOutput
43 operator()(const std::vector<TInput> & B) const
44 {
46
47 for (unsigned int i = 0; i < B.size(); ++i)
48 {
49 A = std::max(A, static_cast<OutputValueType>(B[i]));
50 }
51 return A;
52 }
53
54 bool
55 operator==(const Maximum1 &) const
56 {
57 return true;
58 }
59
61};
62} // namespace Functor
63
99template <typename TInputImage, typename TOutputImage>
101 : public NaryFunctorImageFilter<TInputImage,
102 TOutputImage,
103 Functor::Maximum1<typename TInputImage::PixelType, typename TInputImage::PixelType>>
104{
105public:
106 ITK_DISALLOW_COPY_AND_MOVE(NaryMaximumImageFilter);
107
111 NaryFunctorImageFilter<TInputImage,
112 TOutputImage,
114
117
119 itkNewMacro(Self);
120
122 itkOverrideGetNameOfClassMacro(NaryMaximumImageFilter);
123
124#ifdef ITK_USE_CONCEPT_CHECKING
125 // Begin concept checking
126 itkConceptMacro(InputConvertibleToOutputCheck,
130 // End concept checking
131#endif
132
133protected:
135 ~NaryMaximumImageFilter() override = default;
136};
137} // end namespace itk
138
139#endif
bool operator==(const Maximum1 &) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Maximum1)
TOutput operator()(const std::vector< TInput > &B) const
typename NumericTraits< TOutput >::ValueType OutputValueType
Base class for all process objects that output image data.
Perform a generic pixel-wise operation on N images.
Computes the pixel-wise maximum of several images.
~NaryMaximumImageFilter() override=default
static constexpr T NonpositiveMin()
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....