Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def volumesLogic(self):
return slicer.modules.volumes.logic()
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)
def loadSeries(self, seriesUID):
dicomWidget = slicer.modules.dicom.widgetRepresentation().self()
dicomWidget.detailsPopup.offerLoadables(seriesUID, 'Series')
dicomWidget.detailsPopup.examineForLoading()
dicomWidget.detailsPopup.loadCheckedLoadables()
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
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()
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)