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 
25 namespace itk
26 {
27 namespace Functor
28 {
34 template <typename TInput, typename TOutput>
35 class Maximum1
36 {
37 public:
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 
99 template <typename TInputImage, typename TOutputImage>
101  : public NaryFunctorImageFilter<TInputImage,
102  TOutputImage,
103  Functor::Maximum1<typename TInputImage::PixelType, typename TInputImage::PixelType>>
104 {
105 public:
106  ITK_DISALLOW_COPY_AND_MOVE(NaryMaximumImageFilter);
107 
110  using Superclass =
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 
133 protected:
134  NaryMaximumImageFilter() = default;
135  ~NaryMaximumImageFilter() override = default;
136 };
137 } // end namespace itk
138 
139 #endif
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:714
itk::NumericTraits::ValueType
T ValueType
Definition: itkNumericTraits.h:66
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:98
itk::NaryFunctorImageFilter
Perform a generic pixel-wise operation on N images.
Definition: itkNaryFunctorImageFilter.h:42
itk::NaryMaximumImageFilter::~NaryMaximumImageFilter
~NaryMaximumImageFilter() override=default
itk::SmartPointer< Self >
itk::NaryMaximumImageFilter
Computes the pixel-wise maximum of several images.
Definition: itkNaryMaximumImageFilter.h:100
itk::NaryMaximumImageFilter::NaryMaximumImageFilter
NaryMaximumImageFilter()=default
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::Maximum1::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Maximum1)
itk::Functor::Maximum1
Definition: itkNaryMaximumImageFilter.h:35
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Functor::Maximum1< TInputImage::PixelType, TInputImage::PixelType >::OutputValueType
typename NumericTraits< TInputImage::PixelType >::ValueType OutputValueType
Definition: itkNaryMaximumImageFilter.h:38
itkNumericTraits.h
itkNaryFunctorImageFilter.h
itk::Functor::Maximum1::operator==
bool operator==(const Maximum1 &) const
Definition: itkNaryMaximumImageFilter.h:55
itk::Concept::LessThanComparable
Definition: itkConceptChecking.h:262
itk::Functor::Maximum1::operator()
TOutput operator()(const std::vector< TInput > &B) const
Definition: itkNaryMaximumImageFilter.h:43