Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
itkPolarToCartesianVectorImageFilter.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef __itkPolarToCartesianVectorImageFilter_h
18 #define __itkPolarToCartesianVectorImageFilter_h
19 
20 #include "itkUnaryFunctorImageFilter.h"
21 
22 #define _USE_MATH_DEFINES
23 #include <math.h>
24 
25 #define P2C_PI M_PI
26 
27 namespace itk
28 {
29 
30  namespace Functor {
31 
32  template< typename TInput, typename TOutput, bool symmetric >
34  {
35  public:
38  bool operator!=( const PolarToCartesianFunction & ) const
39  {
40  return false;
41  }
42  bool operator==( const PolarToCartesianFunction & other ) const
43  {
44  return !(*this != other);
45  }
46  inline TOutput operator()( const TInput & x )
47  {
48 
49  TOutput opoint;
50  opoint[0] = x[0] * cos( x[1] ) * sin( x[2] );
51  opoint[1] = x[0] * sin( x[1] ) * sin( x[2] );
52  opoint[2] = x[0] * cos( x[2] );
53 
54  if(symmetric && opoint[2]<0)
55  {
56  opoint[2] = -opoint[2];
57  }
58 
59  return opoint;
60  ;
61  }
62  };
63 
64  } // end namespace functor
65 
66 
70  template <typename TInputImage, typename TOutputImage, bool symmetric>
72  public
73  UnaryFunctorImageFilter<TInputImage,TOutputImage,
74  Functor::PolarToCartesianFunction<
75  typename TInputImage::PixelType,
76  typename TOutputImage::PixelType, symmetric> >
77  {
78  public:
81  typedef UnaryFunctorImageFilter<
82  TInputImage,TOutputImage,
84  typename TInputImage::PixelType,
85  typename TOutputImage::PixelType, symmetric > > Superclass;
88 
89  typedef typename Superclass::OutputImageType OutputImageType;
91  typedef typename TInputImage::PixelType InputPixelType;
93 
95  itkTypeMacro( PolarToCartesianVectorImageFilter, UnaryFunctorImageFilter );
96 
98  itkFactorylessNewMacro(Self)
99  itkCloneMacro(Self)
100 
102  void PrintSelf(std::ostream& os, Indent indent) const
103  { this->Superclass::PrintSelf( os, indent ); }
104 
105 #ifdef ITK_USE_CONCEPT_CHECKING
106 
107  itkConceptMacro(InputHasNumericTraitsCheck,
108  (Concept::HasNumericTraits<InputValueType>));
110 #endif
111 
112  protected:
115 
116  private:
117  PolarToCartesianVectorImageFilter(const Self&); //purposely not implemented
118  void operator=(const Self&); //purposely not implemented
119 
120  };
121 
122 
123 
124 } // end namespace itk
125 
126 #endif // __itkPolarToCartesianVectorImageFilter_h
bool operator!=(const PolarToCartesianFunction &) const
STL namespace.
bool operator==(const PolarToCartesianFunction &other) const
void PrintSelf(std::ostream &os, Indent indent) const
ValueType
Type of the value held by a Value object.
Definition: jsoncpp.h:345
unsigned short PixelType
UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::PolarToCartesianFunction< typename TInputImage::PixelType, typename TOutputImage::PixelType, symmetric > > Superclass