How to use the slicer.modules function in slicer

To help you get started, we’ve selected a few slicer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QIICR / SlicerDevelopmentToolbox / SlicerDevelopmentToolboxUtils / mixins.py View on Github external
def volumesLogic(self):
    return slicer.modules.volumes.logic()
github SlicerDMRI / SlicerDMRI / Modules / Scripted / TractographyDownsample / TractographyDownsample.py View on Github external
widget = lm.sliceWidget("Yellow")
    elif type == slicer.qMRMLScreenShotDialog.Green:
      # green slice window
      widget = lm.sliceWidget("Green")
    else:
      # default to using the full window
      widget = slicer.util.mainWindow()
      # reset the type so that the node is set correctly
      type = slicer.qMRMLScreenShotDialog.FullLayout

    # grab and convert to vtk image data
    qimage = ctk.ctkWidgetsUtils.grabWidget(widget)
    imageData = vtk.vtkImageData()
    slicer.qMRMLUtils().qImageToVtkImageData(qimage,imageData)

    annotationLogic = slicer.modules.annotations.logic()
    annotationLogic.CreateSnapShot(name, description, type, 1, imageData)
github QIICR / QuantitativeReporting / QuantitativeReporting.py View on Github external
def loadSeries(self, seriesUID):
    dicomWidget = slicer.modules.dicom.widgetRepresentation().self()
    dicomWidget.detailsPopup.offerLoadables(seriesUID, 'Series')
    dicomWidget.detailsPopup.examineForLoading()
    dicomWidget.detailsPopup.loadCheckedLoadables()
github SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / zFrameRegistration.py View on Github external
def __init__(self):
    self.annotationLogic = slicer.modules.annotations.logic()
    self.zFrameRegistrationClass = getattr(sys.modules[__name__], self.getSetting("ZFrame_Registration_Class_Name"))

    self.roiObserverTag = None
    self.coverTemplateROI = None
    self.zFrameCroppedVolume = None
    self.zFrameLabelVolume = None
    self.zFrameMaskedVolume = None

    self.zFrameClickObserver = None
    self.zFrameInstructionAnnotation = None

    super(SliceTrackerZFrameRegistrationStep, self).__init__()
    self.logic.templateVolume = None
github SlicerProstate / SliceTracker / SliceTracker / SliceTrackerUtils / steps / plugins / segmentationValidator.py View on Github external
def onConfirmSegmentButtonClicked(self):
    if self.segmentationModified is True:
      volumesLogic = slicer.modules.volumes.logic()
      clonedLabelNode = volumesLogic.CloneVolume(slicer.mrmlScene, self.labelNode,
                                                 self.labelNode.GetName() + "_modified")
      self.labelNode = clonedLabelNode
      slicer.modules.segmentations.logic().ExportAllSegmentsToLabelmapNode(self.segmentationNode, self.labelNode)
      ModuleLogicMixin.runBRAINSResample(inputVolume=self.labelNode, referenceVolume=self.volumeNode,
                                         outputVolume=self.labelNode)
    self.accept()
github SlicerDMRI / SlicerDMRI / Modules / Loadable / TractographyDisplay / Testing / Python / DTINotReproducibleIssue3977.py View on Github external
def computeFA(self, inputVolume):
    # Create intermediate output volumes
    dtiVolume = slicer.mrmlScene.AddNode(slicer.vtkMRMLDiffusionTensorVolumeNode())
    outputBaseline = slicer.mrmlScene.AddNode(slicer.vtkMRMLScalarVolumeNode())

    # Compute the DTI output volume using the "DWI to DTI estimation" CLI module
    module = slicer.modules.dwitodtiestimation
    self.delayDisplay(module.title)
    logging.info('"%s" started' % module.title)
    cliParams = {
      'inputVolume': inputVolume.GetID(),
      'outputTensor': dtiVolume.GetID(),
      'outputBaseline' : outputBaseline.GetID()
    }
    cliNode = slicer.cli.run(module, None, cliParams, wait_for_completion=True)
    logging.info('"%s" completed' % module.title)

    # Create output volume
    outputScalar = slicer.mrmlScene.AddNode(slicer.vtkMRMLScalarVolumeNode())

    # Compute FA output volume using "Diffusion Tensor Scalar Measurements" CLI module
    module = slicer.modules.diffusiontensorscalarmeasurements
    self.delayDisplay(module.title)