コード例 #1
0
 def markupsNodes(self):
   return {
     slicer.vtkMRMLMarkupsAngleNode(): slicer.vtkSlicerAngleWidget(),
     slicer.vtkMRMLMarkupsClosedCurveNode(): slicer.vtkSlicerCurveWidget(),
     slicer.vtkMRMLMarkupsCurveNode(): slicer.vtkSlicerCurveWidget(),
     slicer.vtkMRMLMarkupsFiducialNode(): slicer.vtkSlicerPointsWidget(),
     slicer.vtkMRMLMarkupsLineNode(): slicer.vtkSlicerLineWidget(),
     slicer.vtkMRMLMarkupsPlaneNode(): slicer.vtkSlicerPlaneWidget(),
     slicer.vtkMRMLMarkupsROINode(): slicer.vtkSlicerROIWidget(),
     slicer.vtkMRMLMarkupsTestLineNode(): slicer.vtkSlicerTestLineWidget()
   }
コード例 #2
0
 def placeManualPlane(self):
   interactionNode = slicer.app.applicationLogic().GetInteractionNode()
   selectionNode = slicer.app.applicationLogic().GetSelectionNode()
   selectionNode.SetReferenceActivePlaceNodeClassName("vtkMRMLMarkupsPlaneNode")
   planeNode = slicer.vtkMRMLMarkupsPlaneNode()
   slicer.mrmlScene.AddNode(planeNode)
   planeNode.CreateDefaultDisplayNodes() 
   selectionNode.SetActivePlaceNodeID(planeNode.GetID())
   interactionNode.SetCurrentInteractionMode(interactionNode.Place)
   self.splitPlanes.append(planeNode)
   self.ui.PreviewSplitButton.enabled = True
コード例 #3
0
  def placeAutoPlane(self):
    planeNode = slicer.vtkMRMLMarkupsPlaneNode()
    slicer.mrmlScene.AddNode(planeNode)
    planeNode.CreateDefaultDisplayNodes() 
    self.splitPlanes.append(planeNode)
    bounds = [0,0,0,0,0,0]
    self.activeNode.GetRASBounds(bounds)

    # TODO: Clean this up to be clearer about what is being calculated, maybe add a function
    center = [((bounds[1] - bounds[0]) / 2) + bounds[0], ((bounds[3] - bounds[2]) / 2) + bounds[2], ((bounds[5] - bounds[4]) / 2) + bounds[4]]
    p2 = [((bounds[1] - bounds[0]) / 2) + bounds[0]+(bounds[1] - bounds[0])*1.5/2, ((bounds[3] - bounds[2]) / 2) + bounds[2], ((bounds[5] - bounds[4]) / 2) + bounds[4]]
    p3 = [((bounds[1] - bounds[0]) / 2) + bounds[0], ((bounds[3] - bounds[2]) / 2) + bounds[2]+(bounds[3] - bounds[2])*1.5/2, ((bounds[5] - bounds[4]) / 2) + bounds[4]]

    planeNode.AddControlPoint(vtk.vtkVector3d(center))
    planeNode.AddControlPoint(vtk.vtkVector3d(p2))
    planeNode.AddControlPoint(vtk.vtkVector3d(p3))
    self.ui.PreviewSplitButton.enabled = True