ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkDTITubeSpatialObjectPoint.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 __itkDTITubeSpatialObjectPoint_h
00019 #define __itkDTITubeSpatialObjectPoint_h
00020 
00021 #include "itkTubeSpatialObjectPoint.h"
00022 #include "itkDiffusionTensor3D.h"
00023 #include "vnl/vnl_vector_fixed.h"
00024 
00025 namespace itk
00026 {
00036 template< unsigned int TPointDimension = 3 >
00037 class ITK_EXPORT DTITubeSpatialObjectPoint:
00038   public TubeSpatialObjectPoint< TPointDimension >
00039 {
00040 public:
00041 
00042   typedef DTITubeSpatialObjectPoint                  Self;
00043   typedef SpatialObjectPoint< TPointDimension >      Superclass;
00044   typedef Point< double, TPointDimension >           PointType;
00045   typedef Vector< double, TPointDimension >          VectorType;
00046   typedef CovariantVector< double, TPointDimension > CovariantVectorType;
00047   typedef std::pair< std::string, float >            FieldType;
00048   typedef std::vector< FieldType >                   FieldListType;
00049 
00050   // If you add a type here you need to modify the TranslateEnumToChar
00051   // to translate the enum to a string
00052   typedef enum { FA, ADC, GA } FieldEnumType;
00053 
00056   DTITubeSpatialObjectPoint(void);
00057 
00059   virtual ~DTITubeSpatialObjectPoint(void);
00060 
00062   void SetTensorMatrix(const DiffusionTensor3D< double > & matrix)
00063   {
00064     std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
00065   }
00066 
00067   void SetTensorMatrix(const DiffusionTensor3D< float > & matrix)
00068   {
00069     std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
00070   }
00071 
00072   void SetTensorMatrix(const float *matrix)
00073   {
00074     for ( unsigned int i = 0; i < 6; i++ )
00075       {
00076       m_TensorMatrix[i] = matrix[i];
00077       }
00078   }
00079 
00080   const float * GetTensorMatrix() const { return m_TensorMatrix; }
00081 
00083   Self & operator=(const DTITubeSpatialObjectPoint & rhs);
00084 
00086   void AddField(const char *name, float value);
00087 
00089   void AddField(FieldEnumType name, float value);
00090 
00092   void SetField(FieldEnumType name, float value);
00093 
00094   void SetField(const char *name, float value);
00095 
00097   const FieldListType & GetFields() const { return m_Fields; }
00098 
00100   float GetField(const char *name) const;
00101 
00102   float GetField(FieldEnumType name) const;
00103 
00104 protected:
00105 
00106   float         m_TensorMatrix[6];
00107   FieldListType m_Fields;
00108 
00110   void PrintSelf(std::ostream & os, Indent indent) const;
00111 
00113   std::string TranslateEnumToChar(FieldEnumType name) const;
00114 };
00115 } // end of namespace itk
00116 
00117 #ifndef ITK_MANUAL_INSTANTIATION
00118 #include "itkDTITubeSpatialObjectPoint.hxx"
00119 #endif
00120 
00121 #endif // __itkDTITubeSpatialObjectPoint_h
00122