ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkTernaryMagnitudeImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkTernaryMagnitudeImageFilter_h
19 #define itkTernaryMagnitudeImageFilter_h
20 
22 
23 namespace itk
24 {
25 namespace Functor
26 {
32 template< typename TInput1, typename TInput2, typename TInput3, typename TOutput >
33 class Modulus3
34 {
35 public:
36  Modulus3() = default;
37  ~Modulus3() = default;
38  bool operator!=(const Modulus3 &) const
39  {
40  return false;
41  }
43 
44  bool operator==(const Modulus3 & other) const
45  {
46  return !( *this != other );
47  }
48 
49  inline TOutput operator()(const TInput1 & A,
50  const TInput2 & B,
51  const TInput3 & C) const
52  { return static_cast<TOutput>(std::sqrt( static_cast<double>( A * A + B * B + C * C ) ) ); }
53 };
54 }
55 
66 template< typename TInputImage1, typename TInputImage2,
67  typename TInputImage3, typename TOutputImage >
69  public
70  TernaryFunctorImageFilter< TInputImage1, TInputImage2,
71  TInputImage3, TOutputImage,
72  Functor::Modulus3<
73  typename TInputImage1::PixelType,
74  typename TInputImage2::PixelType,
75  typename TInputImage3::PixelType,
76  typename TOutputImage::PixelType > >
77 {
78 public:
79  ITK_DISALLOW_COPY_AND_ASSIGN(TernaryMagnitudeImageFilter);
80 
84  TInputImage1, TInputImage2,
85  TInputImage3, TOutputImage,
87  typename TInputImage1::PixelType,
88  typename TInputImage2::PixelType,
89  typename TInputImage3::PixelType,
90  typename TOutputImage::PixelType > >;
91 
94 
96  itkNewMacro(Self);
97 
99  itkTypeMacro(TernaryMagnitudeImageFilter,
101 
102 protected:
103  TernaryMagnitudeImageFilter() = default;
104  ~TernaryMagnitudeImageFilter() override = default;
105 };
106 } // end namespace itk
107 
108 #endif
Compute the pixel-wise magnitude of three images.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Implements pixel-wise generic operation of three images.
Base class for all process objects that output image data.
bool operator==(const Modulus3 &other) const
bool operator!=(const Modulus3 &) const
TOutput operator()(const TInput1 &A, const TInput2 &B, const TInput3 &C) const
~TernaryMagnitudeImageFilter() override=default