Hello all!
So I was trying to implement this line of code from Python in c++:
id = crosshairNode.AddObserver(slicer.vtkMRMLCrosshairNode.CursorPositionModifiedEvent, onMouseMoved)
and my first guess was this one:
vtkNew<vtkMRMLScene> scene;
vtkMRMLVolumeNode* volumeNode = vtkMRMLVolumeNode :: SafeDownCast( scene->GetNodeByID("MRHead"));
vtkMRMLVolumeNode* inputVolumeNode;
vtkMRMLCrosshairNode* crosshairNode;
vtkSmartPointer<vtkCallbackCommand> callback;
crosshairNode -> AddObserver( vtkMRMLCrosshairNode:: CursorPositionModifiedEvent, callback)
this crashes my application immediately.
I also tried to add an observer this way, which actually did not crash, but I don’t know if the observer was actually listening.
I tried to create an event handler that had the NodeCallback Type:
vtkNew<vtkMRMLCoreTestingUtilities::vtkMRMLNodeCallback> eventHandler() {
vtkNew<vtkMRMLCoreTestingUtilities::vtkMRMLNodeCallback> callback;
qDebug() << "... handler";
return callback;
}
scene->AddObserver(vtkCommand :: AnyEvent, eventHandler());
I woul be really glad for any help.