ITK  5.2.0
Insight Toolkit
itkAbsoluteValueDifferenceImageFilter.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 itkAbsoluteValueDifferenceImageFilter_h
19 #define itkAbsoluteValueDifferenceImageFilter_h
20 
22 #include "itkConceptChecking.h"
23 
24 namespace itk
25 {
55 namespace Functor
56 {
57 template <typename TInput1, typename TInput2, typename TOutput>
59 {
60 public:
61  AbsoluteValueDifference2() = default;
62  ~AbsoluteValueDifference2() = default;
63  bool
65  {
66  return false;
67  }
69 
70  bool
71  operator==(const AbsoluteValueDifference2 & other) const
72  {
73  return !(*this != other);
74  }
75 
76  inline TOutput
77  operator()(const TInput1 & A, const TInput2 & B) const
78  {
79  const auto dA = static_cast<double>(A);
80  const auto dB = static_cast<double>(B);
81  const double diff = dA - dB;
82  const double absdiff = (diff > 0.0) ? diff : -diff;
83 
84  return static_cast<TOutput>(absdiff);
85  }
86 };
87 } // namespace Functor
88 
89 template <typename TInputImage1, typename TInputImage2, typename TOutputImage>
90 class AbsoluteValueDifferenceImageFilter : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
91 {
92 public:
93  ITK_DISALLOW_COPY_AND_MOVE(AbsoluteValueDifferenceImageFilter);
94 
98 
101 
102 
103  using FunctorType = Functor::AbsoluteValueDifference2<typename TInputImage1::PixelType,
104  typename TInputImage2::PixelType,
105  typename TOutputImage::PixelType>;
106 
108  itkNewMacro(Self);
109 
112 
113 #ifdef ITK_USE_CONCEPT_CHECKING
114  // Begin concept checking
118  // End concept checking
119 #endif
120 
121 protected:
123  {
124 #if !defined(ITK_WRAPPING_PARSER)
126 #endif
127  }
128  ~AbsoluteValueDifferenceImageFilter() override = default;
129 };
130 } // end namespace itk
131 
132 #endif
itk::AbsoluteValueDifferenceImageFilter::~AbsoluteValueDifferenceImageFilter
~AbsoluteValueDifferenceImageFilter() override=default
itkConceptChecking.h
itk::Functor::AbsoluteValueDifference2::AbsoluteValueDifference2
AbsoluteValueDifference2()=default
itk::BinaryGeneratorImageFilter
Implements pixel-wise generic operation of two images, or of an image and a constant.
Definition: itkBinaryGeneratorImageFilter.h:56
itk::SmartPointer< Self >
itkBinaryGeneratorImageFilter.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::AbsoluteValueDifference2
Definition: itkAbsoluteValueDifferenceImageFilter.h:58
itk::Functor::AbsoluteValueDifference2::operator()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkAbsoluteValueDifferenceImageFilter.h:77
itk::Functor::AbsoluteValueDifference2::operator!=
bool operator!=(const AbsoluteValueDifference2 &) const
Definition: itkAbsoluteValueDifferenceImageFilter.h:64
itk::Functor::AbsoluteValueDifference2::~AbsoluteValueDifference2
~AbsoluteValueDifference2()=default
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::AbsoluteValueDifferenceImageFilter
Implements pixel-wise the computation of absolute value difference.
Definition: itkAbsoluteValueDifferenceImageFilter.h:90
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::AbsoluteValueDifference2::operator==
bool operator==(const AbsoluteValueDifference2 &other) const
Definition: itkAbsoluteValueDifferenceImageFilter.h:71
itk::AbsoluteValueDifferenceImageFilter::FunctorType
Functor::AbsoluteValueDifference2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAbsoluteValueDifferenceImageFilter.h:105
itk::BinaryGeneratorImageFilter::SetFunctor
void SetFunctor(const std::function< ConstRefFunctionType > &f)
Definition: itkBinaryGeneratorImageFilter.h:150
itk::AbsoluteValueDifferenceImageFilter::AbsoluteValueDifferenceImageFilter
AbsoluteValueDifferenceImageFilter()
Definition: itkAbsoluteValueDifferenceImageFilter.h:122