Page MenuHomePhabricator

Bug in method SetSurface of Class QmitkNeedleShapeRegistrationWidget
Closed, ResolvedPublic

Description

The method SetSurface() doesn't work in all cases. You have to use the class GeneralNavigationToolModel to get a working Surface. The error doesn't occure in the method SetSurface() but later on when the method OnCalcInitPosition() is called which happens when the user clicks the corresponding button. The error manifests itself in the fact, that no surface is loaded and accordingly no initial position is calculated.

I've the suspicion that the error occurs when the programm tries to convert the stl-image into a binary image (method makeImage()).

An example:

this code works:

mitk::GeneralNavigationToolModel::Pointer m_NavigationToolModel = mitk::GeneralNavigationToolModel::New();

QString fileName = QFileDialog::getOpenFileName(NULL,"Open Surface","/","surface files (*.stl *.vtk *.vtp *.obj)");
if (fileName==QString::null)return;
m_NavigationToolModel->SetSurfaceFilePath(fileName.toStdString());
m_NavigationToolModel->CreateSurface();
m_Controls->m_NeedleShapedRegistrationWidget->SetSurface(dynamic_cast<mitk::Surface*>(m_NavigationToolModel.GetPointer()));

and this not:

std::string filename = "C:\\tools\\Tool11c_ANCHOR._KwongTest3.stl";

mitk::STLFileReader::Pointer stlReader = mitk::STLFileReader::New();
try
  {
  stlReader->SetFileName( filename.c_str() );
  stlReader->Update();
  }
catch (...)
  {
  }

if ( stlReader->GetOutput() == NULL );
else 
  {
  m_Controls->m_NeedleShapeRegistrationWidget->SetSurface(stlReader->GetOutput());
  std::cout << "Loaded testing tool succesfully!";
  }

Event Timeline

Hi Kwong, did you work on this bug? Can you please assign this bug or reassign it to someone else if you won't fix it.

Greets

Alfred

Bug fixed. The methods SetSurface and SetFixedImage are now deprecated. Please use the new method SetParameter instead.