Skip to content

Commit

Permalink
ENH: Allow unselecting beam; Fix crash
Browse files Browse the repository at this point in the history
Re #218
  • Loading branch information
cpinter committed Oct 9, 2023
1 parent 1782b7a commit dfbeac5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions RoomsEyeView/Resources/UI/qSlicerRoomsEyeViewModule.ui
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@
<string>vtkMRMLRTBeamNode</string>
</stringlist>
</property>
<property name="noneEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
Expand Down
11 changes: 8 additions & 3 deletions RoomsEyeView/qSlicerRoomsEyeViewModuleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,6 @@ void qSlicerRoomsEyeViewModuleWidget::onBeamNodeChanged(vtkMRMLNode* node)
paramNode->SetAndObserveBeamNode(beamNode);
paramNode->DisableModifiedEventOff();

// Trigger update of transforms based on selected beam
beamNode->InvokeCustomModifiedEvent(vtkMRMLRTBeamNode::BeamTransformModified);

// Show only selected beam, hide others
std::vector<vtkMRMLNode*> beamNodes;
this->mrmlScene()->GetNodesByClass("vtkMRMLRTBeamNode", beamNodes);
Expand All @@ -413,6 +410,14 @@ void qSlicerRoomsEyeViewModuleWidget::onBeamNodeChanged(vtkMRMLNode* node)
shNode->GetItemByDataNode(currentBeamNode), (currentBeamNode == beamNode ? 1 : 0) );
}

if (!beamNode)
{
return;
}

// Trigger update of transforms based on selected beam
beamNode->InvokeCustomModifiedEvent(vtkMRMLRTBeamNode::BeamTransformModified);

// Select patient segmentation
vtkMRMLRTPlanNode* planNode = beamNode->GetParentPlanNode();
if (!planNode)
Expand Down

0 comments on commit dfbeac5

Please sign in to comment.