00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _freVectorTo2DProjectionAccessor_h
00023 #define _freVectorTo2DProjectionAccessor_h
00024
00025 #include "itkVector.h"
00026
00027 namespace FREE
00028 {
00029 namespace Accessor
00030 {
00031
00044 template <class TVector>
00045 class ITK_EXPORT VectorTo2DProjectionAccessor
00046 {
00047 public:
00049 typedef VectorTo2DProjectionAccessor Self;
00050
00053 typedef TVector InternalType;
00054
00057 typedef itk::Vector<typename InternalType::ValueType,2> ExternalType;
00058
00060 inline void Set( InternalType & output, const ExternalType & input ) const
00061 {
00062 output[m_ActiveDim1] = input[0];
00063 output[m_ActiveDim2] = input[1];
00064 }
00065
00067 inline ExternalType Get( const InternalType & input ) const
00068 {
00069 ExternalType projection;
00070 projection[0] = input[m_ActiveDim1];
00071 projection[1] = input[m_ActiveDim2];
00072 return projection;
00073 }
00074
00076 inline void SetActiveDimensions(const unsigned int& index1, const unsigned int& index2)
00077 {
00078 if (index1<index2)
00079 {
00080 m_ActiveDim1 = index1;
00081 m_ActiveDim2 = index2;
00082 }
00083 else
00084 {
00085 m_ActiveDim1 = index2;
00086 m_ActiveDim2 = index1;
00087 }
00088 };
00089
00090 VectorTo2DProjectionAccessor();
00091
00092 private:
00094 unsigned int m_ActiveDim1;
00096 unsigned int m_ActiveDim2;
00097 };
00098
00099 }
00100 }
00101
00102 #endif