14 #include <Poco/Zip/Decompress.h> 15 #include <Poco/Path.h> 44 std::ifstream file(filename.c_str(), std::ios::binary);
52 Poco::Zip::Decompress unzipper(file, Poco::Path(tempDirectory));
53 unzipper.decompressAllFiles();
59 if (loadedStorage->GetAll()->size() == 0 || loadedStorage.IsNull())
70 std::remove((std::string(tempDirectory + Poco::Path::separator() +
GetFileWithoutPath(filename) +
".storage")).c_str());
80 returnValue->SetDataNode(node);
83 std::string identifier;
84 node->GetStringProperty(
"identifier", identifier);
85 returnValue->SetIdentifier(identifier);
87 node->RemoveProperty(
"identifier");
91 node->GetStringProperty(
"serial number", serial);
92 returnValue->SetSerialNumber(serial);
94 node->RemoveProperty(
"serial number");
98 node->GetStringProperty(
"tracking device type", device_type);
101 if (device_type.size() == 0)
120 node->GetIntProperty(
"tracking device type", device_type_old);
121 switch (device_type_old)
126 case 3:device_type =
"IntuitiveDaVinci";
break;
127 case 4:device_type =
"AscensionMicroBird";
break;
130 case 7:device_type =
"TrackingSystemInvalid";
break;
137 node->RemoveProperty(
"tracking device type");
139 returnValue->SetTrackingDeviceType(static_cast<mitk::TrackingDeviceType>(device_type));
143 node->GetIntProperty(
"tracking tool type", type);
144 returnValue->SetType(static_cast<mitk::NavigationTool::NavigationToolType>(type));
146 node->RemoveProperty(
"tracking tool type");
149 std::string calibration_filename;
150 node->GetStringProperty(
"toolfileName", calibration_filename);
151 if (calibration_filename ==
"none")
153 returnValue->SetCalibrationFile(
"none");
157 std::string calibration_filename_with_path = toolPath + Poco::Path::separator() + calibration_filename;
158 returnValue->SetCalibrationFile(calibration_filename_with_path);
161 node->RemoveProperty(
"toolfileName");
166 std::string RegLandmarksString;
167 std::string CalLandmarksString;
168 node->GetStringProperty(
"ToolRegistrationLandmarks", RegLandmarksString);
169 node->GetStringProperty(
"ToolCalibrationLandmarks", CalLandmarksString);
172 returnValue->SetToolLandmarks(ToolRegLandmarks);
173 returnValue->SetToolControlPoints(ToolCalLandmarks);
175 node->RemoveProperty(
"ToolRegistrationLandmarks");
176 node->RemoveProperty(
"ToolCalibrationLandmarks");
179 std::string toolTipPositionString;
180 std::string toolTipOrientationString;
181 bool positionSet = node->GetStringProperty(
"ToolTipPosition", toolTipPositionString);
182 bool orientationSet = node->GetStringProperty(
"ToolAxisOrientation", toolTipOrientationString);
184 if (positionSet && orientationSet)
189 else if (positionSet != orientationSet)
191 MITK_WARN <<
"Tooltip definition incomplete: position and orientation have to be set! Skipping tooltip definition.";
194 node->RemoveProperty(
"ToolTipPosition");
195 node->RemoveProperty(
"ToolAxisOrientation");
202 Poco::Path myFile(FileWithPath.c_str());
203 return myFile.getFileName();
209 std::string pointSeperator =
"|";
210 std::string valueSeperator =
";";
211 std::vector<std::string> points;
212 split(
string, pointSeperator, points);
213 for (
unsigned int i = 0; i < points.size(); i++)
215 std::vector<std::string> values;
216 split(points.at(i), valueSeperator, values);
217 if (values.size() == 4)
219 double index = atof(values.at(0).c_str());
221 point[0] = atof(values.at(1).c_str());
222 point[1] = atof(values.at(2).c_str());
223 point[2] = atof(values.at(3).c_str());
224 returnValue->SetPoint(index, point);
231 std::string valueSeperator =
";";
232 std::vector<std::string> values;
233 split(
string, valueSeperator, values);
235 if (values.size() == 3)
237 point[0] = atof(values.at(0).c_str());
238 point[1] = atof(values.at(1).c_str());
239 point[2] = atof(values.at(2).c_str());
246 std::string valueSeperator =
";";
247 std::vector<std::string> values;
248 split(
string, valueSeperator, values);
250 if (values.size() == 4)
253 atof(values.at(1).c_str()),
254 atof(values.at(2).c_str()),
255 atof(values.at(3).c_str()));
262 int n = text.length();
265 start = text.find_first_not_of(separators);
266 while ((start >= 0) && (start < n))
268 stop = text.find_first_of(separators, start);
269 if ((stop < 0) || (stop > n)) stop = n;
270 words.push_back(text.substr(start, stop - start));
271 start = text.find_first_not_of(separators, stop + 1);
static std::string GetTempPath()
vnl_quaternion< ScalarType > Quaternion
std::string TrackingDeviceType