ITK  5.4.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
23namespace itk
24{
25namespace Functor
26{
32template <typename TInput1, typename TInput2, typename TOutput>
34{
35public:
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
81template <typename TInputImage1, typename TInputImage2, typename TOutputImage>
82class ITK_TEMPLATE_EXPORT BinaryMagnitudeImageFilter
83 : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
84{
85public:
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
110protected:
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
Implements pixel-wise generic operation of two images, or of an image and a constant.
Computes the square root of the sum of squares of corresponding input pixels.
~BinaryMagnitudeImageFilter() override=default
bool operator==(const Modulus2 &) const
TOutput operator()(const TInput1 &A, const TInput2 &B) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(Modulus2)
Base class for all process objects that output image data.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Functor::Add2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
#define itkConceptMacro(name, concept)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....