ITK  6.0.0
Insight Toolkit
itkBinaryMagnitudeImageFilter.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 itkBinaryMagnitudeImageFilter_h
19 #define itkBinaryMagnitudeImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template <typename TInput1, typename TInput2, typename TOutput>
33 class Modulus2
34 {
35 public:
36  bool
37  operator==(const Modulus2 &) const
38  {
39  return true;
40  }
41 
43 
44  inline TOutput
45  operator()(const TInput1 & A, const TInput2 & B) const
46  {
47  const auto dA = static_cast<double>(A);
48  const auto dB = static_cast<double>(B);
49 
50  return static_cast<TOutput>(std::sqrt(dA * dA + dB * dB));
51  }
52 };
53 } // namespace Functor
54 
81 template <typename TInputImage1, typename TInputImage2, typename TOutputImage>
82 class ITK_TEMPLATE_EXPORT BinaryMagnitudeImageFilter
83  : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
84 {
85 public:
86  ITK_DISALLOW_COPY_AND_MOVE(BinaryMagnitudeImageFilter);
87 
93  using FunctorType = Functor::
94  Modulus2<typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType>;
95 
97  itkNewMacro(Self);
98 
100  itkOverrideGetNameOfClassMacro(BinaryMagnitudeImageFilter);
101 
102 #ifdef ITK_USE_CONCEPT_CHECKING
103  // Begin concept checking
107  // End concept checking
108 #endif
109 
110 protected:
112  {
113 #if !defined(ITK_WRAPPING_PARSER)
114  Superclass::SetFunctor(FunctorType());
115 #endif
116  }
117 
118  ~BinaryMagnitudeImageFilter() override = default;
119 };
120 } // end namespace itk
121 
122 #endif
itk::BinaryMagnitudeImageFilter
Computes the square root of the sum of squares of corresponding input pixels.
Definition: itkBinaryMagnitudeImageFilter.h:82
itk::Functor::Modulus2::ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Modulus2)
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::Modulus2::operator==
bool operator==(const Modulus2 &) const
Definition: itkBinaryMagnitudeImageFilter.h:37
itkBinaryGeneratorImageFilter.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::BinaryMagnitudeImageFilter::BinaryMagnitudeImageFilter
BinaryMagnitudeImageFilter()
Definition: itkBinaryMagnitudeImageFilter.h:111
itk::Functor::Modulus2
Definition: itkBinaryMagnitudeImageFilter.h:33
FunctorType
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
Definition: itkAddImageFilter.h:97
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
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:217
itk::Functor::Modulus2::operator()
TOutput operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkBinaryMagnitudeImageFilter.h:45