111 std::vector<std::string> readData = std::vector<std::string>();
115 oldLocale = setlocale(LC_ALL,
nullptr);
119 setlocale(LC_ALL,
"C");
123 file.open(filename.c_str(), std::ios::in);
127 file.seekg(0L, std::ios::beg);
133 std::getline(file, buffer);
135 readData.push_back(buffer);
137 ++count;
if (count == m_SampleCount) count = 0;
144 setlocale(LC_ALL, oldLocale);
151 mitk::NavigationData::Pointer returnValue = mitk::NavigationData::New();
153 QString myLine = QString(line.c_str());
155 QStringList myLineList = myLine.split(m_SeparatorSign);
157 mitk::Point3D position;
158 mitk::Quaternion orientation;
165 if (myLineList.size() < m_MinNumberOfColumns)
167 MITK_ERROR <<
"Error: cannot read line: only found " << myLineList.size() <<
" fields. Last field: " << myLineList.at(myLineList.size() - 1).toStdString();
168 returnValue = GetEmptyNavigationData();
178 position[0] = myLineList.at(3).toDouble();
179 position[1] = myLineList.at(4).toDouble();
180 position[2] = myLineList.at(5).toDouble();
182 orientation[0] = myLineList.at(6).toDouble();
183 orientation[1] = myLineList.at(7).toDouble();
184 orientation[2] = myLineList.at(8).toDouble();
185 orientation[3] = myLineList.at(9).toDouble();
189 position[0] = position[0]*(-1);
194 orientation[0] = myLineList.at(m_Qx).toDouble();
195 orientation[1] = myLineList.at(m_Qy).toDouble();
196 orientation[2] = myLineList.at(m_Qz).toDouble();
197 orientation[3] = myLineList.at(m_Qr).toDouble();
202 double elevationAngle;
210 azimuthAngle = myLineList.at(m_Azimuth).toDouble();
218 elevationAngle = myLineList.at(m_Elevation).toDouble();
226 rollAngle = myLineList.at(m_Roll).toDouble();
230 if (!m_EulersInRadiants)
232 azimuthAngle = azimuthAngle / 180 * itk::Math::pi;
233 elevationAngle = elevationAngle / 180 * itk::Math::pi;
234 rollAngle = rollAngle / 180 * itk::Math::pi;
236 vnl_quaternion<double> eulerQuat(rollAngle, elevationAngle, azimuthAngle);
237 orientation = eulerQuat;
243 mitk::Quaternion linksZuRechtsdrehend;
244 double rotationAngle = -itk::Math::pi;
245 double rotationAxis[3];
250 linksZuRechtsdrehend[3] = cos(rotationAngle / 2);
251 linksZuRechtsdrehend[0] = rotationAxis[0] * sin(rotationAngle / 2);
252 linksZuRechtsdrehend[1] = rotationAxis[1] * sin(rotationAngle / 2);
253 linksZuRechtsdrehend[2] = rotationAxis[2] * sin(rotationAngle / 2);
255 orientation = orientation * linksZuRechtsdrehend;
264 if (myLineList.size() < 8)
266 MITK_ERROR <<
"Error: cannot read line: only found " << myLineList.size() <<
" fields. Last field: " << myLineList.at(myLineList.size() - 1).toStdString();
267 returnValue = GetEmptyNavigationData();
271 if (myLineList.at(3).toStdString() ==
"1") valid =
true;
273 position[0] = myLineList.at(2).toDouble();
274 position[1] = myLineList.at(3).toDouble();
275 position[2] = myLineList.at(4).toDouble();
277 orientation[0] = myLineList.at(5).toDouble();
278 orientation[1] = myLineList.at(6).toDouble();
279 orientation[2] = myLineList.at(7).toDouble();
280 orientation[3] = myLineList.at(8).toDouble();
283 returnValue->SetDataValid(valid);
284 returnValue->SetPosition(position);
285 returnValue->SetOrientation(orientation);
void SetOptions(bool rightHanded, char seperatorSign, int sampleCount, bool headerRow, int xPos, int yPos, int zPos, bool useQuats, int qx, int qy, int qz, int qr, int azimuth, int elevatino, int roll, bool eulerInRadiants, int minNumberOfColums)
SetOptions sets the options for reading out the data out of the correct positions of the file....