ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkAzimuthElevationToCartesianTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkAzimuthElevationToCartesianTransform_h
00019 #define __itkAzimuthElevationToCartesianTransform_h
00020 
00021 #include "itkAffineTransform.h"
00022 #include "vnl/vnl_math.h"
00023 
00024 namespace itk
00025 {
00079 template< class TScalarType = float,  // Data type for scalars
00080           unsigned int NDimensions = 3 >
00081 // (e.g. float or double)
00082 class ITK_EXPORT AzimuthElevationToCartesianTransform:
00083   public AffineTransform< TScalarType, NDimensions >
00084 {
00085 public:
00087   typedef AzimuthElevationToCartesianTransform         Self;
00088   typedef AffineTransform<  TScalarType, NDimensions > Superclass;
00089   typedef SmartPointer< Self >                         Pointer;
00090   typedef SmartPointer< const Self >                   ConstPointer;
00091 
00093   itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
00094   itkStaticConstMacro( ParametersDimension, unsigned int,
00095                        NDimensions * ( NDimensions + 1 ) );
00097 
00099   itkTypeMacro(AzimuthElevationToCartesianTransform, AffineTransform);
00100 
00102   itkNewMacro(Self);
00103 
00105   typedef typename Superclass::ParametersType ParametersType;
00106 
00108   typedef typename Superclass::JacobianType JacobianType;
00109 
00111   typedef typename Superclass::ScalarType ScalarType;
00112 
00114   typedef  typename Superclass::InputPointType  InputPointType;
00115   typedef  typename Superclass::OutputPointType OutputPointType;
00116 
00118   typedef Matrix< TScalarType, itkGetStaticConstMacro(SpaceDimension),
00119                   itkGetStaticConstMacro(SpaceDimension) > MatrixType;
00120 
00122   void SetAzimuthElevationToCartesianParameters(
00123     const double sampleSize,
00124     const double blanking,
00125     const long maxAzimuth,
00126     const long maxElevation,
00127     const double azimuthAngleSeparation,
00128     const double elevationAngleSeparation);
00129 
00130   void SetAzimuthElevationToCartesianParameters(const double sampleSize,
00131                                                 const double blanking,
00132                                                 const long maxAzimuth,
00133                                                 const long maxElevation);
00134 
00136   OutputPointType     TransformPoint(const InputPointType  & point) const;
00137 
00139   inline InputPointType  BackTransform(const OutputPointType  & point) const
00140   {
00141     InputPointType result;
00142 
00143     if ( m_ForwardAzimuthElevationToPhysical )
00144       {
00145       result = static_cast< InputPointType >( TransformCartesianToAzEl(point) );
00146       }
00147     else
00148       {
00149       result = static_cast< InputPointType >( TransformAzElToCartesian(point) );
00150       }
00151     return result;
00152   }
00153 
00154   inline InputPointType  BackTransformPoint(const OutputPointType  & point) const
00155   {
00156     return BackTransform(point);
00157   }
00158 
00161   void SetForwardAzimuthElevationToCartesian();
00162 
00165   void SetForwardCartesianToAzimuthElevation();
00166 
00169   OutputPointType TransformAzElToCartesian(const InputPointType & point) const;
00170 
00173   OutputPointType TransformCartesianToAzEl(const OutputPointType & point) const;
00174 
00179   itkSetMacro(MaxAzimuth, long);
00180 
00185   itkSetMacro(MaxElevation, long);
00186 
00188   itkSetMacro(RadiusSampleSize, double);
00189 
00191   itkSetMacro(AzimuthAngularSeparation, double);
00192 
00194   itkSetMacro(ElevationAngularSeparation, double);
00195 
00197   itkSetMacro(FirstSampleDistance, double);
00198 protected:
00199 
00201   AzimuthElevationToCartesianTransform();
00202 
00204   virtual ~AzimuthElevationToCartesianTransform();
00205 
00207   void PrintSelf(std::ostream & s, Indent indent) const;
00208 
00209 private:
00210   AzimuthElevationToCartesianTransform(const Self &); // purposely not
00211                                                       // implemented
00212   void operator=(const Self &);                       //purposely not
00213 
00214   // implemented
00215 
00216   long   m_MaxAzimuth;
00217   long   m_MaxElevation;
00218   double m_RadiusSampleSize;
00219   double m_AzimuthAngularSeparation;
00220   double m_ElevationAngularSeparation;
00221   double m_FirstSampleDistance;
00222   bool   m_ForwardAzimuthElevationToPhysical;
00223 }; //class AzimuthElevationToCartesianTransform
00224 }  // namespace itk
00225 
00226 // Define instantiation macro for this template.
00227 #define ITK_TEMPLATE_AzimuthElevationToCartesianTransform(_, EXPORT, TypeX, TypeY)     \
00228   namespace itk                                                                        \
00229   {                                                                                    \
00230   _( 2 ( class EXPORT AzimuthElevationToCartesianTransform< ITK_TEMPLATE_2 TypeX > ) ) \
00231   namespace Templates                                                                  \
00232   {                                                                                    \
00233   typedef AzimuthElevationToCartesianTransform< ITK_TEMPLATE_2 TypeX >                 \
00234   AzimuthElevationToCartesianTransform##TypeY;                                       \
00235   }                                                                                    \
00236   }
00237 
00238 #if ITK_TEMPLATE_EXPLICIT
00239 #include "Templates/itkAzimuthElevationToCartesianTransform+-.h"
00240 #endif
00241 
00242 #if ITK_TEMPLATE_TXX
00243 #include "itkAzimuthElevationToCartesianTransform.hxx"
00244 #endif
00245 
00246 #endif /* __itkAzimuthElevationToCartesianTransform_h */
00247