I am trying to create a module in C++ and am stumbling on a crash on line 4 below :
vtkMRMLNode * fiducialNode = d->inputFiducialSelector->currentNode();
vtkMRMLMarkupsFiducialNode * fiducialNodeReal = vtkMRMLMarkupsFiducialNode::SafeDownCast(fiducialNode);
std::cout << fiducialNodeReal->GetClassName() << std::endl; // OK
std::cout << fiducialNodeReal->GetNumberOfControlPoints() << std::endl; // Crash
The module is created using the extension wizard. The code is executed when a button is clicked. Debugging does not help, no thread is available on crash (Slicer and the module are compiled with RelWithDebInfo).
This very primitive sample illustrates the issue.
I wish to avoid a fallback on Python, and would appreciate any comment to help resolve this.
Thank you.