Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def layoutManager(self):
return slicer.app.layoutManager()
def getDefaultMasterVolumeNodeID(self):
layoutManager = slicer.app.layoutManager()
# Use first background volume node in any of the displayed layouts
for layoutName in layoutManager.sliceViewNames():
compositeNode = self.getCompositeNode(layoutName)
if compositeNode.GetBackgroundVolumeID():
return compositeNode.GetBackgroundVolumeID()
# Use first background volume node in any of the displayed layouts
for layoutName in layoutManager.sliceViewNames():
compositeNode = self.getCompositeNode(layoutName)
if compositeNode.GetForegroundVolumeID():
return compositeNode.GetForegroundVolumeID()
# Not found anything
return None
probeToRasMatrix = vtk.vtkMatrix4x4()
probeToRasTransformNode.GetMatrixTransformToWorld(probeToRasMatrix)
rasToProbeMatrix = vtk.vtkMatrix4x4()
rasToProbeMatrix.DeepCopy(probeToRasMatrix)
rasToProbeMatrix.Invert()
positioningTransformNode = self.parameterNode.GetNodeReference('PositioningTransform')
positioningTransformNode.ApplyTransformMatrix(rasToProbeMatrix)
# set probeToRas transform to identity
identityMatrix = vtk.vtkMatrix4x4()
probeToRasTransformNode.SetMatrixTransformFromParent(identityMatrix)
# reset slice views and 3d views (to refocus on RVOT model)
manager = slicer.app.layoutManager()
manager.resetSliceViews()
manager.resetThreeDViews()
from CardiacDeviceSimulatorUtils.DeviceSelectorWidget import DeviceImplantWidget
self.addObserver(self.parameterNode, CardiacDeviceBase.DEVICE_CLASS_MODIFIED_EVENT, self.onDeviceClassModified)
self.addObserver(self.parameterNode, CardiacDeviceBase.DEVICE_PARAMETER_VALUE_MODIFIED_EVENT, self.onDeviceParameterValueModified)
def center3dView(self):
layoutManager = slicer.app.layoutManager()
threeDWidget = layoutManager.threeDWidget(0)
threeDView = threeDWidget.threeDView()
threeDView.resetFocalPoint()
def setupFourUpTableViewConnection(self):
if not self.fourUpTableView and self.layoutManager.layout == self.fourUpSliceTableViewLayoutButton.LAYOUT:
if slicer.app.layoutManager().tableWidget(0):
self.fourUpTableView = slicer.app.layoutManager().tableWidget(0).tableView()
self.fourUpTableView.selectionModel().selectionChanged.connect(self.onSegmentSelectionChanged)
self.fourUpTableView.setSelectionBehavior(qt.QTableView.SelectRows)