ITK  5.2.0
Insight Toolkit
itkMaximumImageFilter.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 itkMaximumImageFilter_h
19 #define itkMaximumImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template <typename TInput1, typename TInput2 = TInput1, typename TOutput = TInput1>
33 class Maximum
34 {
35 public:
36  Maximum() = default;
37  ~Maximum() = default;
38  bool
39  operator!=(const Maximum &) const
40  {
41  return false;
42  }
44 
45  bool
46  operator==(const Maximum & other) const
47  {
48  return !(*this != other);
49  }
50 
51  inline TOutput
52  operator()(const TInput1 & A, const TInput2 & B) const
53  {
54  if (A > B)
55  {
56  return static_cast<TOutput>(A);
57  }
58  else
59  {
60  return static_cast<TOutput>(B);
61  }
62  }
63 };
64 } // namespace Functor
65 
85 template <typename TInputImage1, typename TInputImage2 = TInputImage1, typename TOutputImage = TInputImage1>
86 class MaximumImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
87 {
88 public:
89  ITK_DISALLOW_COPY_AND_MOVE(MaximumImageFilter);
90 
94 
97  using FunctorType = Functor::
98  Maximum<typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType>;
99 
101  itkNewMacro(Self);
102 
105 
106 #ifdef ITK_USE_CONCEPT_CHECKING
107  // Begin concept checking
108  itkConceptMacro(Input1ConvertibleToOutputCheck,
110  itkConceptMacro(Input2ConvertibleToOutputCheck,
112  itkConceptMacro(Input1GreaterThanInput2Check,
114  // End concept checking
115 #endif
116 
117 protected:
119  {
120 #if !defined(ITK_WRAPPING_PARSER)
122 #endif
123  }
124 
125  ~MaximumImageFilter() override = default;
126 };
127 } // end namespace itk
128 
129 #endif
itk::Functor::Maximum::operator!=
bool operator!=(const Maximum &) const
Definition: itkMaximumImageFilter.h:39
itk::Concept::GreaterThanComparable
Definition: itkConceptChecking.h:284
itk::MaximumImageFilter::FunctorType
Functor::Maximum< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkMaximumImageFilter.h:98
itk::BinaryGeneratorImageFilter
Implements pixel-wise generic operation of two images, or of an image and a constant.
Definition: itkBinaryGeneratorImageFilter.h:56
itk::SmartPointer< Self >
itk::Functor::Maximum::Maximum
Maximum()=default
itkBinaryGeneratorImageFilter.h
itk::MaximumImageFilter::~MaximumImageFilter
~MaximumImageFilter() override=default
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::Maximum::operator==
bool operator==(const Maximum &other) const
Definition: itkMaximumImageFilter.h:46
itk::Functor::Maximum
Definition: itkMaximumImageFilter.h:33
itk::MaximumImageFilter
Implements a pixel-wise operator Max(a,b) between two images.
Definition: itkMaximumImageFilter.h:86
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::Functor::Maximum::operator()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkMaximumImageFilter.h:52
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::MaximumImageFilter::MaximumImageFilter
MaximumImageFilter()
Definition: itkMaximumImageFilter.h:118
itk::Functor::Maximum::~Maximum
~Maximum()=default
itk::BinaryGeneratorImageFilter::SetFunctor
void SetFunctor(const std::function< ConstRefFunctionType > &f)
Definition: itkBinaryGeneratorImageFilter.h:150