#ifndef __itkPermuteAxesTransform_h #define __itkPermuteAxesTransform_h #include #include "itkTransform.h" #include "itkExceptionObject.h" #include "itkMatrix.h" namespace itk { /** \class PermuteAxesTransform * \brief Permutes the image axes according to a user specified order. * * PermuteAxesTransform permutes the image axes according to a * user specified order. The permutation order is set via method * SetOrder( order ) where the input is an array of SpaceDimension * number of unsigned int. The elements of the array must be a rearrangment * of the numbers from 0 to SpaceDimension - 1. * * The i-th axis of the output image corresponds with the order[i]-th * axis of the input image. * * \author Jakub Bican, Department of Image Processing, Institute of Information Theory and Automation, Academy of Sciences of the Czech Republic. * * \ingroup Transforms */ template < class TScalarType=double, // Data type for scalars (float or double) unsigned int NDimensions=3> // Number of dimensions class ITK_EXPORT PermuteAxesTransform : public Transform< TScalarType, NDimensions, NDimensions > { public: /** Standard class typedefs. */ typedef PermuteAxesTransform Self; typedef Transform< TScalarType, NDimensions, NDimensions > Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; /** New macro for creation of through the object factory.*/ itkNewMacro( Self ); /** Run-time type information (and related methods). */ itkTypeMacro( PermuteAxesTransform, Transform ); /** Dimension of the domain space. */ itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions); itkStaticConstMacro(ParametersDimension, unsigned int, 0); /** Standard scalar type for this class. */ typedef typename Superclass::ScalarType ScalarType; /** Standard Jacobian container. */ typedef typename Superclass::JacobianType JacobianType; /** Standard vector type for this class. */ typedef Vector InputVectorType; typedef Vector OutputVectorType; /** Standard covariant vector type for this class. */ typedef CovariantVector InputCovariantVectorType; typedef CovariantVector OutputCovariantVectorType; /** Standard vnl_vector type for this class. */ typedef vnl_vector_fixed InputVnlVectorType; typedef vnl_vector_fixed OutputVnlVectorType; /** Standard coordinate point type for this class. */ typedef Point InputPointType; typedef Point OutputPointType; /** Method to transform a point or a vector. */ OutputPointType TransformPoint(const InputPointType &point ) const; OutputVectorType TransformVector(const InputVectorType &vector) const; OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const; OutputCovariantVectorType TransformCovariantVector( const InputCovariantVectorType &vector) const; /** PermuteOrderArray type. */ typedef FixedArray PermuteOrderArrayType; /** Set the permutation order. The elements of order must be * a rearrangement of the numbers from 0 to (ImageDimension - 1).*/ void SetOrder( const PermuteOrderArrayType& order ); /** Returns the permutation order of the PermuteAxesTransform. */ itkGetConstReferenceMacro(Order,PermuteOrderArrayType); /** Returns inverse permutation order of the PermuteAxesTransform. */ itkGetConstReferenceMacro(InverseOrder,PermuteOrderArrayType); /** Set the parameters to the IdentityTransform */ void SetIdentity(void); /** Set parameters to inverse axes permutation transform */ void Invert(void); /** Find inverse axes permutation transform */ bool GetInverse(Self* inverse) const; /** Compute the Jacobian Matrix of the transformation at one point - not applicable for this type of transform */ virtual const JacobianType & GetJacobian(const InputPointType &point ) const { itkExceptionMacro(<< "Method not applicable for permute axes transform."); return m_Jacobian; } protected: PermuteAxesTransform(); ~PermuteAxesTransform(); /** Print contents of an PermuteAxesTransform. */ void PrintSelf(std::ostream &os, Indent indent) const; private: PermuteAxesTransform(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented PermuteOrderArrayType m_Order; PermuteOrderArrayType m_InverseOrder; }; //class PermuteAxesTransform } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkPermuteAxesTransform.txx" #endif #endif /* __itkPermuteAxesTransform_h */