Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.filteredFilePathsList = list()
self.tableWidgetItemDefaultFlags = qt.Qt.NoItemFlags | qt.Qt.ItemIsSelectable | qt.Qt.ItemIsEnabled
self.displayOnClick = True
# Table columns
self.subjectsColumnName = 0
self.subjectsColumnConsistency = 1
# Note that these values change on initSegmentsTable/initSegmentsMultiTable
self.segmentsColumnSubjectName = -1
self.segmentsColumnSegmentName = 0
self.segmentsColumnTopologyCurrent = 1
self.segmentsColumnTopologyExpected = 2
# get available color tables
self.color_table_dict = dict()
scene = slicer.mrmlScene
count = scene.GetNumberOfNodes()
for idx in range(count):
node = scene.GetNthNode(idx)
node_type = node.GetClassName()
name = node.GetName()
id = node.GetID()
if node_type == 'vtkMRMLColorTableNode':
self.color_table_dict[name] = id
# Load widget from .ui file (created by Qt Designer)
uiWidget = slicer.util.loadUI(self.resourcePath('%s.ui' % self.moduleName))
self.layout.addWidget(uiWidget)
self.ui = slicer.util.childWidgetVariables(uiWidget)
# Qtabwidget
self.ImporterTypeTabWidget = self.ui.ImporterTypeTabWidget
def setupSegmentEditor(self):
self.segmentEditorWidget = slicer.qMRMLSegmentEditorWidget()
self.segmentEditorWidget.setMRMLScene(slicer.mrmlScene)
self.segmentEditorWidget.visible = False
self.segmentEditorWidget.setSegmentationNodeSelectorVisible(False)
self.segmentEditorWidget.setMasterVolumeNodeSelectorVisible(False)
self.segmentEditorWidget.setSwitchToSegmentationsButtonVisible(False)
self.segmentEditorWidget.findChild(qt.QPushButton, "AddSegmentButton").hide()
self.segmentEditorWidget.findChild(qt.QPushButton, "RemoveSegmentButton").hide()
self.segmentEditorWidget.findChild(ctk.ctkMenuButton, "Show3DButton").hide()
self.segmentEditorWidget.findChild(ctk.ctkExpandableWidget, "SegmentsTableResizableFrame").hide()
self.segmentEditorWidget.setSizePolicy(qt.QSizePolicy.Maximum, qt.QSizePolicy.Expanding)
def _removeLabelNode(self, labelNode):
dNode = labelNode.GetDisplayNode()
if dNode is not None:
slicer.mrmlScene.RemoveNode(dNode)
slicer.mrmlScene.RemoveNode(labelNode)
def __init__(self, parent = None):
if not parent:
self.parent = slicer.qMRMLWidget()
self.parent.setLayout(qt.QVBoxLayout())
self.parent.setMRMLScene(slicer.mrmlScene)
else:
self.parent = parent
self.layout = self.parent.layout()
if not parent:
self.setup()
self.parent.show()