ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkSquaredDifferenceImageFilter.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 itkSquaredDifferenceImageFilter_h
19#define itkSquaredDifferenceImageFilter_h
20
22
23namespace itk
24{
54namespace Functor
55{
56template <typename TInput1, typename TInput2, typename TOutput>
58{
59public:
60 bool
62 {
63 return true;
64 }
65
66
68
69 inline TOutput
70 operator()(const TInput1 & A, const TInput2 & B) const
71 {
72 const auto dA = static_cast<double>(A);
73 const auto dB = static_cast<double>(B);
74 const double diff = dA - dB;
75
76 return static_cast<TOutput>(diff * diff);
77 }
78};
79} // namespace Functor
80
81template <typename TInputImage1, typename TInputImage2, typename TOutputImage>
82class ITK_TEMPLATE_EXPORT SquaredDifferenceImageFilter
83 : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
84{
85public:
86 ITK_DISALLOW_COPY_AND_MOVE(SquaredDifferenceImageFilter);
87
91
94
95 using FunctorType = Functor::SquaredDifference2<typename TInputImage1::PixelType,
96 typename TInputImage2::PixelType,
97 typename TOutputImage::PixelType>;
98
100 itkNewMacro(Self);
101
103 itkOverrideGetNameOfClassMacro(SquaredDifferenceImageFilter);
104
108
109protected:
111 {
112#if !defined(ITK_WRAPPING_PARSER)
114#endif
115 }
116 ~SquaredDifferenceImageFilter() override = default;
117};
118} // end namespace itk
119
120#endif
void SetFunctor(const std::function< ConstRefFunctionType > &f)
TOutput operator()(const TInput1 &A, const TInput2 &B) const
bool operator==(const SquaredDifference2 &) const
ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(SquaredDifference2)
Implements transparent reference counting.
Functor::SquaredDifference2< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType > FunctorType
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
~SquaredDifferenceImageFilter() override=default
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....