Orfeo Toolbox  3.16
itkDTITubeSpatialObjectPoint.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkDTITubeSpatialObjectPoint.txx,v $
5  Language: C++
6  Date: $Date: 2009-01-28 20:10:27 $
7  Version: $Revision: 1.12 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkDTITubeSpatialObjectPoint_txx
18 #define __itkDTITubeSpatialObjectPoint_txx
19 
21 #include "itksys/SystemTools.hxx"
22 
23 namespace itk
24 {
25 
27 template< unsigned int TPointDimension >
30 {
31  // Initialize the tensor matrix to identity
32  for(unsigned int i=0;i<6;i++)
33  {
34  m_TensorMatrix[i] = 0;
35  }
36  m_TensorMatrix[0] = 1;
37  m_TensorMatrix[3] = 1;
38  m_TensorMatrix[5] = 1;
39 }
40 
42 template< unsigned int TPointDimension >
45 {
46 }
47 
48 
49 template< unsigned int TPointDimension >
50 void
52 ::PrintSelf( std::ostream & os, Indent indent) const
53 {
54  Superclass::PrintSelf(os,indent);
55 }
56 
58 template< unsigned int TPointDimension >
59 std::string
62 {
63  // Do the translation
64  switch(name)
65  {
66  case 0:
67  return "FA";
68  break;
69  case 1:
70  return "ADC";
71  break;
72  case 2:
73  return "GA";
74  break;
75  default:
76  return "";
77  }
78  return "";
79 }
80 
82 template< unsigned int TPointDimension >
83 void
85 ::AddField(const char* name,float value)
86 {
87  FieldType field(itksys::SystemTools::LowerCase(name),value);
88  m_Fields.push_back(field);
89 }
90 
91 
93 template< unsigned int TPointDimension >
94 void
96 ::SetField(const char* name,float value)
97 {
98  FieldListType::iterator it = m_Fields.begin();
99  while(it != m_Fields.end())
100  {
101  if(!strcmp((*it).first.c_str(),
102  itksys::SystemTools::LowerCase(name).c_str()))
103  {
104  (*it).second = value;
105  }
106  it++;
107  }
108 }
109 
111 template< unsigned int TPointDimension >
112 void
114 ::SetField(FieldEnumType name,float value)
115 {
116  std::string charname = this->TranslateEnumToChar(name);
117 
118  if(charname.size() > 0)
119  {
120  this->SetField(charname.c_str(),value);
121  }
122  else
123  {
124  std::cout << "DTITubeSpatialObjectPoint::SetField(): enum not defined"
125  << std::endl;
126  }
127 
128 }
129 
131 template< unsigned int TPointDimension >
132 void
134 ::AddField(FieldEnumType name,float value)
135 {
136  std::string charname = this->TranslateEnumToChar(name);
137 
138  if(charname.size() > 0)
139  {
140  FieldType field(itksys::SystemTools::LowerCase(charname).c_str(),value);
141  m_Fields.push_back(field);
142  }
143  else
144  {
145  std::cout << "DTITubeSpatialObjectPoint::AddField() : enum not defined"
146  << std::endl;
147  }
148 
149 }
150 
152 template< unsigned int TPointDimension >
153 float
155 ::GetField(const char* name) const
156 {
157  FieldListType::const_iterator it = m_Fields.begin();
158  while(it != m_Fields.end())
159  {
160  if(!strcmp((*it).first.c_str(),
161  itksys::SystemTools::LowerCase(name).c_str()))
162  {
163  return (*it).second;
164  }
165  it++;
166  }
167  return -1;
168 }
169 
171 template< unsigned int TPointDimension >
172 float
175 {
176  std::string charname = this->TranslateEnumToChar(name);
177  if(charname.size() > 0)
178  {
179  return this->GetField(itksys::SystemTools::LowerCase(charname).c_str());
180  }
181  else
182  {
183  std::cout << "DTITubeSpatialObjectPoint::GetField() : enum not defined"
184  << std::endl;
185  return -1;
186  }
187 
188  return -1;
189 }
190 
191 template< unsigned int TPointDimension >
195 {
196  // Copy the extra fields
197  m_Fields.clear();
198  const FieldListType & fields = rhs.GetFields();
199  FieldListType::const_iterator it = fields.begin();
200  while(it != fields.end())
201  {
202  this->AddField((*it).first.c_str(),(*it).second);
203  it++;
204  }
205 
206  this->m_ID = rhs.m_ID;
207 
208  for(unsigned int i=0;i<6;i++)
209  {
210  m_TensorMatrix[i] = rhs.m_TensorMatrix[i];
211  }
212 
213  this->m_NumDimensions = rhs.m_NumDimensions;
214  this->m_X = rhs.m_X;
215  this->m_T = rhs.m_T;
216  this->m_R = rhs.m_R;
217  this->m_Normal1 = rhs.m_Normal1;
218  this->m_Normal2 = rhs.m_Normal2;
219  this->m_Color = rhs.m_Color;
220  return * this;
221 }
222 
223 } // end namespace itk
224 
225 #endif

Generated at Sat Feb 2 2013 23:35:48 for Orfeo Toolbox with doxygen 1.8.1.1