ITK  5.2.0
Insight Toolkit
itkMagnitudeAndPhaseToComplexImageFilter.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 itkMagnitudeAndPhaseToComplexImageFilter_h
19 #define itkMagnitudeAndPhaseToComplexImageFilter_h
20 
22 
23 namespace itk
24 {
55 namespace Functor
56 {
57 template <typename TInput1, typename TInput2, typename TOutput>
59 {
60 public:
61  MagnitudeAndPhaseToComplex() = default;
62  ~MagnitudeAndPhaseToComplex() = default;
63  bool
65  {
66  return false;
67  }
68 
69  bool
71  {
72  return !(*this != other);
73  }
74 
75  inline std::complex<TOutput>
76  operator()(const TInput1 & A, const TInput2 & B) const
77  {
78  return std::complex<TOutput>(std::polar(static_cast<TOutput>(A), static_cast<TOutput>(B)));
79  }
80 };
81 } // namespace Functor
82 
83 template <typename TInputImage1,
84  typename TInputImage2 = TInputImage1,
85  typename TOutputImage =
86  itk::Image<std::complex<typename TInputImage1::PixelType>, TInputImage1::ImageDimension>>
88  : public BinaryGeneratorImageFilter<TInputImage1, TInputImage2, TOutputImage>
89 {
90 public:
91  ITK_DISALLOW_COPY_AND_MOVE(MagnitudeAndPhaseToComplexImageFilter);
92 
95 
97 
98  using InputPixel1Type = typename TInputImage1::PixelType;
99  using InputPixel2Type = typename TInputImage2::PixelType;
100  using OutputPixelType = typename TOutputImage::PixelType;
101 
104 
105  using FunctorType = Functor::MagnitudeAndPhaseToComplex<typename TInputImage1::PixelType,
106  typename TInputImage2::PixelType,
107  typename TOutputImage::PixelType::value_type>;
108 
110  itkNewMacro(Self);
111 
114 
115 #ifdef ITK_USE_CONCEPT_CHECKING
116  // Begin concept checking
117  itkConceptMacro(Input1ConvertibleToDoubleCheck, (Concept::Convertible<InputPixel1Type, double>));
118  itkConceptMacro(Input2ConvertibleToDoubleCheck, (Concept::Convertible<InputPixel2Type, double>));
119  itkConceptMacro(DoubleConvertibleToOutputCheck, (Concept::Convertible<double, OutputPixelType>));
120  // End concept checking
121 #endif
122 
123 protected:
125  {
126 #if !defined(ITK_WRAPPING_PARSER)
128 #endif
129  }
130 
131  ~MagnitudeAndPhaseToComplexImageFilter() override = default;
132 };
133 } // end namespace itk
134 
135 #endif
itk::MagnitudeAndPhaseToComplexImageFilter::~MagnitudeAndPhaseToComplexImageFilter
~MagnitudeAndPhaseToComplexImageFilter() override=default
itk::Functor::MagnitudeAndPhaseToComplex::operator!=
bool operator!=(const MagnitudeAndPhaseToComplex &) const
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:64
itk::MagnitudeAndPhaseToComplexImageFilter::MagnitudeAndPhaseToComplexImageFilter
MagnitudeAndPhaseToComplexImageFilter()
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:124
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::MagnitudeAndPhaseToComplexImageFilter
Implements pixel-wise conversion of magnitude and phase data into complex voxels.
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:87
itk::Functor::MagnitudeAndPhaseToComplex
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:58
itk::MagnitudeAndPhaseToComplexImageFilter::InputPixel2Type
typename TInputImage2::PixelType InputPixel2Type
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:99
itk::Functor::MagnitudeAndPhaseToComplex::~MagnitudeAndPhaseToComplex
~MagnitudeAndPhaseToComplex()=default
itkBinaryGeneratorImageFilter.h
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::Functor::MagnitudeAndPhaseToComplex::operator()
std::complex< TOutput > operator()(const TInput1 &A, const TInput2 &B) const
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:76
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition: itkConceptChecking.h:65
itk::Functor::MagnitudeAndPhaseToComplex::MagnitudeAndPhaseToComplex
MagnitudeAndPhaseToComplex()=default
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::MagnitudeAndPhaseToComplexImageFilter::FunctorType
Functor::MagnitudeAndPhaseToComplex< typename TInputImage1::PixelType, typename TInputImage2::PixelType, typename TOutputImage::PixelType::value_type > FunctorType
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:107
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::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::MagnitudeAndPhaseToComplexImageFilter::InputPixel1Type
typename TInputImage1::PixelType InputPixel1Type
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:98
itk::MagnitudeAndPhaseToComplexImageFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:100
itk::Functor::MagnitudeAndPhaseToComplex::operator==
bool operator==(const MagnitudeAndPhaseToComplex &other) const
Definition: itkMagnitudeAndPhaseToComplexImageFilter.h:70
itk::BinaryGeneratorImageFilter::SetFunctor
void SetFunctor(const std::function< ConstRefFunctionType > &f)
Definition: itkBinaryGeneratorImageFilter.h:150