14 #include <Poco/Zip/Compress.h> 15 #include <Poco/Path.h> 43 m_ErrorMessage =
"Cannot write a navigation tool containing invalid tool data, aborting!";
53 if ( Tool->GetDataNode().IsNotNull()
54 && (Tool->GetDataNode()->GetData()!=
nullptr)
55 && (Tool->GetDataNode()->GetData()->GetGeometry()!=
nullptr)
58 geometryBackup = Tool->GetDataNode()->GetData()->GetGeometry()->Clone();
59 Tool->GetDataNode()->GetData()->GetGeometry()->SetIdentity();
61 else {
MITK_WARN <<
"Saving a tool with invalid data node, proceeding but errors might occure!";}
66 saveStorage->Add(thisTool);
71 mySceneIO->SaveScene(saveStorage->GetAll(),saveStorage,DataStorageFileName);
74 std::ofstream file( FileName.c_str(), std::ios::binary | std::ios::out);
77 m_ErrorMessage =
"Could not open a zip file for writing: '" + FileName +
"'";
83 Poco::Zip::Compress zipper( file,
true );
85 if (Tool->GetCalibrationFile()!=
"none") zipper.addFile(Tool->GetCalibrationFile(),
GetFileWithoutPath(Tool->GetCalibrationFile()));
90 std::remove(DataStorageFileName.c_str());
93 if (geometryBackup.IsNotNull()) {Tool->GetDataNode()->GetData()->SetGeometry(geometryBackup);}
102 if (Tool->GetDataNode().IsNull())
105 thisTool->SetName(
"none");
123 if (Tool->IsToolTipSet())
130 thisTool->RemoveProperty(
"material");
137 Poco::Path myFile(FileWithPath.c_str());
138 return myFile.getFileName();
143 std::stringstream returnValue;
145 for ( it = pointSet->GetPointSet()->GetPointData()->Begin();it != pointSet->GetPointSet()->GetPointData()->End();it++ )
150 return returnValue.str();
155 std::stringstream returnValue;
156 returnValue << point[0] <<
";" << point[1] <<
";" << point[2];
157 return returnValue.str();
162 std::stringstream returnValue;
163 returnValue << quat.x() <<
";" << quat.y() <<
";" << quat.z() <<
";" << quat.r();
164 return returnValue.str();
vnl_quaternion< ScalarType > Quaternion
static std::string CreateTemporaryDirectory(const std::string &templateName="XXXXXX", std::string path=std::string())
DataType::PointDataContainerIterator PointDataIterator