Page MenuHomePhabricator

Tracking Toolbox Options: Crash when Selecting Model
Closed, DuplicatePublic

Event Timeline

Only occures on Windows machines when loading specific models (crashes, e.g., for NDIPolarisOldModel.stl). Loading these files manually into the workbench works. Something seems to be wrong with the tracking volume data node after it was generated by the class mitk::TrackingVolumeGenerator.

There, the old stl file reader is used.

mitk::STLFileReader::Pointer stlReader = mitk::STLFileReader::New();
stlReader->SetFileName( tmpFilePath.c_str() );
stlReader->Update();

One could try to replace this file reader by the newer IOUtil:

mitk::Surface::Pointer newVolume = mitk::IOUtil::LoadSurface(tmpFilePath.c_str());

But this also didn't work because streaming the file data from the resource system to a temporary file didn't work correctly:

us::Module* module = us::GetModuleContext()->GetModule();

us::ModuleResource moduleResource = module->GetResource(filename);

// Create ResourceStream from Resource
us::ModuleResourceStream resStream(moduleResource,std::ios_base::binary);
ofstream tmpOutputStream;
std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile (tmpOutputStream,"currentTrackingVolume.stl");
tmpOutputStream << resStream.rdbuf();
tmpOutputStream.close();

... this leads to the error message:

9.33 blueberry.ui.wrkbncPlg: LOG: Unable to create view ID org.mitk.views.mitkig
ttrackingtoolbox: Part initialization error: D:\prg\MITK-01-src\MITK\Core\Code\I
O\mitkIOUtil.cpp:453:
Creating temporary file C:\Users\franza\AppData\Local\Temp\\currentTrackingVolum
e.stl failed: Der Vorgang wurde erfolgreich beendet.

Keno, can you help fixing this bug?