Example #1
0
  def onMouseEvent(self, observer, eventid):
      ras = [0.0, 0.0, 0.0]
      ras = slicer.util.getNode('Crosshair').GetCrosshairRAS()

      compositeNode = EditUtil.getCompositeNode()
      bgID = compositeNode.GetBackgroundVolumeID()

      if bgID == None:
        self.reportInfo(ras)
        return
      else:
        volumeNode = slicer.mrmlScene.GetNodeByID(bgID)
	val = self.volumeInfo(volumeNode, ras)          
        self.reportInfo(ras, val)
Example #2
0
    def enter(self):
        """
    When entering the module, check that the lightbox modes are off
    and that we have the volumes loaded
    """
        self.turnOffLightboxes()
        self.installShortcutKeys()

        # get the master and merge nodes from the composite node associated
        # with the red slice, but only if showing volumes and we don't already
        # have an active set of volumes that we are using
        if self.showVolumesFrame:
            if not self.helper.master or not self.helper.merge:
                # get the slice composite node for the Red slice view (we'll assume it exists
                # since we are in the editor) to get the current background and label
                # - set the foreground layer as the active ID
                # in the selection node for later calls to PropagateVolumeSelection
                compositeNode = EditUtil.getCompositeNode()
                selectionNode = slicer.app.applicationLogic().GetSelectionNode(
                )
                selectionNode.SetSecondaryVolumeID(
                    compositeNode.GetForegroundVolumeID())
                bgID = lbID = ""
                if compositeNode.GetBackgroundVolumeID():
                    bgID = compositeNode.GetBackgroundVolumeID()
                if compositeNode.GetLabelVolumeID():
                    lbID = compositeNode.GetLabelVolumeID()
                masterNode = slicer.mrmlScene.GetNodeByID(bgID)
                mergeNode = slicer.mrmlScene.GetNodeByID(lbID)
                self.setMasterNode(masterNode)
                self.setMergeNode(mergeNode)
        # if not showing volumes, the caller is responsible for setting the master and
        # merge nodes, most likely according to a widget within the caller

        # Observe the parameter node in order to make changes to
        # button states as needed
        self.parameterNode = EditUtil.getParameterNode()
        self.addObserver(self.parameterNode, vtk.vtkCommand.ModifiedEvent,
                         self.updateGUIFromMRML)

        self.addObserver(slicer.mrmlScene, slicer.mrmlScene.StartCloseEvent,
                         self.resetInterface)

        if self.helper:
            self.helper.onEnter()

        if self.toolsColor:
            self.toolsColor.updateGUIFromMRML(self.parameterNode,
                                              vtk.vtkCommand.ModifiedEvent)
Example #3
0
  def enter(self):
    """
    When entering the module, check that the lightbox modes are off
    and that we have the volumes loaded
    """
    self.turnOffLightboxes()
    self.installShortcutKeys()

    # get the master and merge nodes from the composite node associated
    # with the red slice, but only if showing volumes and we don't already
    # have an active set of volumes that we are using
    if self.showVolumesFrame:
      if not self.helper.master or not self.helper.merge:
        # get the slice composite node for the Red slice view (we'll assume it exists
        # since we are in the editor) to get the current background and label
        # - set the foreground layer as the active ID
        # in the selection node for later calls to PropagateVolumeSelection
        compositeNode = EditUtil.getCompositeNode()
        selectionNode = slicer.app.applicationLogic().GetSelectionNode()
        selectionNode.SetReferenceSecondaryVolumeID( compositeNode.GetForegroundVolumeID() )
        bgID = lbID = ""
        if compositeNode.GetBackgroundVolumeID():
          bgID = compositeNode.GetBackgroundVolumeID()
        if compositeNode.GetLabelVolumeID():
          lbID = compositeNode.GetLabelVolumeID()
        masterNode = slicer.mrmlScene.GetNodeByID( bgID )
        mergeNode = slicer.mrmlScene.GetNodeByID( lbID )
        self.setMasterNode(masterNode)
        self.setMergeNode(mergeNode)
    # if not showing volumes, the caller is responsible for setting the master and
    # merge nodes, most likely according to a widget within the caller

    # Observe the parameter node in order to make changes to
    # button states as needed
    self.parameterNode = EditUtil.getParameterNode()
    self.parameterNodeTag = self.parameterNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.updateGUIFromMRML)

    self.mrmlSceneTag = slicer.mrmlScene.AddObserver(slicer.mrmlScene.StartCloseEvent, self.resetInterface)

    if self.helper:
      self.helper.onEnter()

    if self.toolsColor:
      self.toolsColor.updateGUIFromMRML(self.parameterNode, vtk.vtkCommand.ModifiedEvent)