ITK  5.2.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  * 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
44  operator()(const std::vector<TInput> & B) const
45  {
47 
48  for (unsigned int i = 0; i < B.size(); i++)
49  {
50  if (A < static_cast<OutputValueType>(B[i]))
51  {
52  A = static_cast<OutputValueType>(B[i]);
53  }
54  }
55  return A;
56  }
57 
58  bool
59  operator==(const Maximum1 &) const
60  {
61  return true;
62  }
63 
64  bool
65  operator!=(const Maximum1 &) const
66  {
67  return false;
68  }
69 };
70 } // namespace Functor
71 
107 template <typename TInputImage, typename TOutputImage>
109  : public NaryFunctorImageFilter<TInputImage,
110  TOutputImage,
111  Functor::Maximum1<typename TInputImage::PixelType, typename TInputImage::PixelType>>
112 {
113 public:
114  ITK_DISALLOW_COPY_AND_MOVE(NaryMaximumImageFilter);
115 
118  using Superclass =
119  NaryFunctorImageFilter<TInputImage,
120  TOutputImage,
122 
125 
127  itkNewMacro(Self);
128 
131 
132 #ifdef ITK_USE_CONCEPT_CHECKING
133  // Begin concept checking
134  itkConceptMacro(InputConvertibleToOutputCheck,
138  // End concept checking
139 #endif
140 
141 protected:
142  NaryMaximumImageFilter() = default;
143  ~NaryMaximumImageFilter() override = default;
144 };
145 } // end namespace itk
146 
147 #endif
itk::Concept::HasNumericTraits
Definition: itkConceptChecking.h:714
itk::NumericTraits::ValueType
T ValueType
Definition: itkNumericTraits.h:65
itk::NumericTraits::NonpositiveMin
static constexpr T NonpositiveMin()
Definition: itkNumericTraits.h:97
itk::NaryFunctorImageFilter
Perform a generic pixel-wise operation on N images.
Definition: itkNaryFunctorImageFilter.h:42
itk::NaryMaximumImageFilter::~NaryMaximumImageFilter
~NaryMaximumImageFilter() override=default
itk::Functor::Maximum1::~Maximum1
~Maximum1()=default
itk::SmartPointer< Self >
itk::Functor::Maximum1::Maximum1
Maximum1()=default
itk::NaryMaximumImageFilter
Computes the pixel-wise maximum of several images.
Definition: itkNaryMaximumImageFilter.h:108
itk::NaryMaximumImageFilter::NaryMaximumImageFilter
NaryMaximumImageFilter()=default
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::Maximum1
Definition: itkNaryMaximumImageFilter.h:34
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:138
itk::Concept::Convertible
Definition: itkConceptChecking.h:216
itk::Functor::Maximum1< TInputImage::PixelType, TInputImage::PixelType >::OutputValueType
typename NumericTraits< TInputImage::PixelType >::ValueType OutputValueType
Definition: itkNaryMaximumImageFilter.h:37
itkNumericTraits.h
itkNaryFunctorImageFilter.h
itk::Functor::Maximum1::operator==
bool operator==(const Maximum1 &) const
Definition: itkNaryMaximumImageFilter.h:59
itk::Concept::LessThanComparable
Definition: itkConceptChecking.h:262
itk::Functor::Maximum1::operator!=
bool operator!=(const Maximum1 &) const
Definition: itkNaryMaximumImageFilter.h:65
itk::Functor::Maximum1::operator()
TOutput operator()(const std::vector< TInput > &B) const
Definition: itkNaryMaximumImageFilter.h:44