ITK  4.4.0
Insight Segmentation and Registration Toolkit
itkDTITubeSpatialObjectPoint.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkDTITubeSpatialObjectPoint_h
19 #define __itkDTITubeSpatialObjectPoint_h
20 
22 #include "itkDiffusionTensor3D.h"
23 #include "vnl/vnl_vector_fixed.h"
24 
25 namespace itk
26 {
36 template< unsigned int TPointDimension = 3 >
37 class ITK_EXPORT DTITubeSpatialObjectPoint:
38  public TubeSpatialObjectPoint< TPointDimension >
39 {
40 public:
41 
47  typedef std::pair< std::string, float > FieldType;
48  typedef std::vector< FieldType > FieldListType;
49 
50  // If you add a type here you need to modify the TranslateEnumToChar
51  // to translate the enum to a string
52  typedef enum { FA, ADC, GA } FieldEnumType;
53 
57 
59  virtual ~DTITubeSpatialObjectPoint(void);
60 
62  void SetTensorMatrix(const DiffusionTensor3D< double > & matrix)
63  {
64  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
65  }
66 
67  void SetTensorMatrix(const DiffusionTensor3D< float > & matrix)
68  {
69  std::copy(matrix.Begin(), matrix.End(), m_TensorMatrix);
70  }
71 
72  void SetTensorMatrix(const float *matrix)
73  {
74  for ( unsigned int i = 0; i < 6; i++ )
75  {
76  m_TensorMatrix[i] = matrix[i];
77  }
78  }
79 
80  const float * GetTensorMatrix() const { return m_TensorMatrix; }
81 
83  Self & operator=(const DTITubeSpatialObjectPoint & rhs);
84 
86  void AddField(const char *name, float value);
87 
89  void AddField(FieldEnumType name, float value);
90 
92  void SetField(FieldEnumType name, float value);
93 
94  void SetField(const char *name, float value);
95 
97  const FieldListType & GetFields() const { return m_Fields; }
98 
100  float GetField(const char *name) const;
101 
102  float GetField(FieldEnumType name) const;
103 
104 protected:
105 
106  float m_TensorMatrix[6];
108 
110  void PrintSelf(std::ostream & os, Indent indent) const;
111 
113  std::string TranslateEnumToChar(FieldEnumType name) const;
114 };
115 } // end of namespace itk
116 
117 #ifndef ITK_MANUAL_INSTANTIATION
118 #include "itkDTITubeSpatialObjectPoint.hxx"
119 #endif
120 
121 #endif // __itkDTITubeSpatialObjectPoint_h
122