def _setGUIstate(self, csv_loaded=True): if csv_loaded: self.resetButton.text = 'Reset' # Collapse input parameter sections self.inputDataCollapsibleButton.collapsed = True self.parametersCollapsibleButton.collapsed = True # Connect the CTRL + N Shortcut if len(self.shortcuts) == 0: shortcutNext = qt.QShortcut(slicer.util.mainWindow()) shortcutNext.setKey(qt.QKeySequence('Ctrl+N')) shortcutNext.connect('activated()', self.onNext) self.shortcuts.append(shortcutNext) shortcutPrevious = qt.QShortcut(slicer.util.mainWindow()) shortcutPrevious.setKey(qt.QKeySequence('Ctrl+P')) shortcutPrevious.connect('activated()', self.onPrevious) self.shortcuts.append(shortcutPrevious) else: self.logger.warning('Shortcuts already initialized!') # Add an observer for the "MRML Scene End Close Event" if len(self.observers) == 0: self.observers.append( slicer.mrmlScene.AddObserver( slicer.mrmlScene.EndCloseEvent, self.onEndClose)) else: self.logger.warning('Event observer already initialized!') else: # reset Button is locked when loading cases, ensure it is unlocked to load new batch self.resetButton.enabled = (self.batchTableSelector.currentNodeID != '') self.resetButton.text = 'Start Batch' # Remove the keyboard shortcut for sc in self.shortcuts: sc.disconnect('activated()') sc.setParent(None) self.shortcuts = [] # Remove the event observer for obs in self.observers: slicer.mrmlScene.RemoveObserver(obs) self.observers = [] self.previousButton.enabled = csv_loaded self.nextButton.enabled = csv_loaded self.inputPathSelector.enabled = not csv_loaded self.loadBatchButton.enabled = not csv_loaded self.batchTableSelector.enabled = not csv_loaded self.batchTableView.enabled = not csv_loaded self.inputParametersGroupBox.enabled = not csv_loaded
def setupOptionsFrame(self): # Autoscroll range slider self.autoscrollRangeSlider = slicer.qMRMLSliderWidget() self.autoscrollRangeSlider.setMRMLScene(slicer.mrmlScene) self.autoscrollRangeSlider.minimum = 0 self.autoscrollRangeSlider.maximum = 10 self.autoscrollRangeSlider.value = 5 self.autoscrollRangeSlider.setToolTip( 'How many slices you would like to autoscroll up and down') self.scriptedEffect.addLabeledOptionsWidget("Slice range:", self.autoscrollRangeSlider) # Autoscroll speed slider self.autoscrollSpeedSlider = slicer.qMRMLSliderWidget() self.autoscrollSpeedSlider.setMRMLScene(slicer.mrmlScene) self.autoscrollSpeedSlider.minimum = 1 self.autoscrollSpeedSlider.maximum = 100 self.autoscrollSpeedSlider.value = 20 self.autoscrollSpeedSlider.setToolTip( 'How many slices you want to autoscroll per second') self.scriptedEffect.addLabeledOptionsWidget("Slice speed:", self.autoscrollSpeedSlider) # Input view selector self.sliceNodeSelector = qt.QComboBox() self.sliceNodeSelector.setToolTip( "This slice will be excluded during autoscrolling.") self.scriptedEffect.addLabeledOptionsWidget("Exclude view:", self.sliceNodeSelector) # Start button self.applyButton = qt.QPushButton("Start") self.applyButton.objectName = self.__class__.__name__ + 'Start' self.applyButton.setToolTip("Start/Stop autoscrolling (Alt+C)") self.scriptedEffect.addOptionsWidget(self.applyButton) # Set Hotkeys self.hotkey = qt.QShortcut(qt.QKeySequence("Alt+C"), slicer.util.mainWindow()) self.hotkey2 = qt.QShortcut(qt.QKeySequence("Ctrl+Alt+C"), slicer.util.mainWindow()) # Connections self.applyButton.connect('clicked()', self.onApply) self.sliceNodeSelector.connect("currentIndexChanged(int)", self.updateGUIFromMRML) self.hotkey.connect('activated()', self.autoscrollHotkey) self.hotkey2.connect('activated()', self.openSettings) # Initialize variables self.setupVariables()
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.logic = QuickSegmentLogic() # Load widget from .ui file (created by Qt Designer) uiWidget = slicer.util.loadUI(self.resourcePath('UI/QuickSegment.ui')) self.layout.addWidget(uiWidget) self.ui = slicer.util.childWidgetVariables(uiWidget) self.selectParameterNode() uiWidget.setMRMLScene(slicer.mrmlScene) self.ui.exportModelsButton.connect("clicked()", self.onExportModelsClicked) # Add vertical spacer self.layout.addStretch(1) self.isSingleModuleShown = False slicer.util.mainWindow().setWindowTitle("QuickEdit") self.showSingleModule(True) shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence("Ctrl+Shift+b")) shortcut.connect('activated()', lambda: self.showSingleModule(toggle=True)) self.addObserver(slicer.mrmlScene, slicer.mrmlScene.StartCloseEvent, self.onSceneStartClose) self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndCloseEvent, self.onSceneEndClose) self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndImportEvent, self.onSceneEndImport)
def setup(self): ScriptedLoadableModuleWidget.setup(self) self.logic = QuickSegmentLogic() # Load widget from .ui file (created by Qt Designer) uiWidget = slicer.util.loadUI(self.resourcePath('UI/QuickSegment.ui')) self.layout.addWidget(uiWidget) self.ui = slicer.util.childWidgetVariables(uiWidget) uiWidget.setMRMLScene(slicer.mrmlScene) if (self.ui.segmentEditorWidget.mrmlSegmentEditorNode() is None): segmentEditorNode = slicer.mrmlScene.AddNewNodeByClass( "vtkMRMLSegmentEditorNode") self.ui.segmentEditorWidget.setMRMLSegmentEditorNode( segmentEditorNode) self.ui.exportModelsButton.connect("clicked()", self.onExportModelsClicked) # Add vertical spacer self.layout.addStretch(1) self.isSingleModuleShown = False slicer.util.mainWindow().setWindowTitle("QuickEdit") self.showSingleModule(True) shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence("Ctrl+Shift+b")) shortcut.connect('activated()', lambda: self.showSingleModule(toggle=True))
def installShortcutKeys(self): """Turn on editor-wide shortcuts. These are active independent of the currently selected effect.""" Key_Escape = 0x01000000 # not in PythonQt Key_Space = 0x20 # not in PythonQt self.shortcuts = [] keysAndCallbacks = ( ('e', EditUtil.toggleLabel), ('z', self.toolsBox.undoRedo.undo), ('y', self.toolsBox.undoRedo.redo), ('h', EditUtil.toggleCrosshair), ('o', EditUtil.toggleLabelOutline), ('t', EditUtil.toggleForegroundBackground), (Key_Escape, self.toolsBox.defaultEffect), ('p', lambda: self.toolsBox.selectEffect('PaintEffect')), ('d', lambda: self.toolsBox.selectEffect('DrawEffect')), ('w', lambda: self.toolsBox.selectEffect('WandEffect')), ('r', lambda: self.toolsBox.selectEffect('RectangleEffect')), ('c', self.toolsColor.showColorBox), (Key_Space, self.toolsBox.toggleFloatingMode), ) for key, callback in keysAndCallbacks: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(key)) shortcut.connect('activated()', callback) self.shortcuts.append(shortcut)
def _connectHandlers(self): # Connect the CTRL + N and CTRL + P Shortcut if len(self.shortcuts) == 0: shortcutNext = qt.QShortcut(slicer.util.mainWindow()) shortcutNext.setKey(qt.QKeySequence('Ctrl+N')) shortcutNext.connect('activated()', self.onNext) self.shortcuts.append(shortcutNext) shortcutPrevious = qt.QShortcut(slicer.util.mainWindow()) shortcutPrevious.setKey(qt.QKeySequence('Ctrl+P')) shortcutPrevious.connect('activated()', self.onPrevious) self.shortcuts.append(shortcutPrevious) else: self.logger.warning('Shortcuts already initialized!')
def createPopupMenu(self, pos): """createPopupMenu(pos) -> redefines the popup menu with our extras """ ret = kdeui.KTextEdit.createPopupMenu(self, pos) ret.insertItem('Clear', self.clear, qt.QKeySequence(), -1, 0) return ret
def installShortcutKeys(self): """Turn on editor-wide shortcuts. These are active independent of the currently selected effect.""" #TODO: Deal with commented out shortcuts Key_Escape = 0x01000000 # not in PythonQt Key_Space = 0x20 # not in PythonQt self.shortcuts = [] keysAndCallbacks = ( # ('z', self.toolsBox.undoRedo.undo), # ('y', self.toolsBox.undoRedo.redo), ('h', self.toggleCrosshair), (Key_Escape, lambda: self.editor.setActiveEffect(None)), ('e', lambda: self.editor.setActiveEffect( self.editor.effectByName('Erase'))), ('p', lambda: self.editor.setActiveEffect( self.editor.effectByName('Paint'))), ('d', lambda: self.editor.setActiveEffect( self.editor.effectByName('Draw'))), ('w', lambda: self.editor.setActiveEffect( self.editor.effectByName('Wand'))), ('r', lambda: self.editor.setActiveEffect( self.editor.effectByName('Rectangle'))), # (Key_Space, self.toolsBox.toggleFloatingMode), ) for key, callback in keysAndCallbacks: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(key)) shortcut.connect('activated()', callback) self.shortcuts.append(shortcut)
def setup(self): """ Called when the user opens the module the first time and the widget is initialized. """ ScriptedLoadableModuleWidget.setup(self) # Load widget from .ui file (created by Qt Designer). # Additional widgets can be instantiated manually and added to self.layout. uiWidget = slicer.util.loadUI(self.resourcePath('UI/FiducialCenterlineExtraction.ui')) self.layout.addWidget(uiWidget) self.ui = slicer.util.childWidgetVariables(uiWidget) # Set scene in MRML widgets. Make sure that in Qt designer the top-level qMRMLWidget's # "mrmlSceneChanged(vtkMRMLScene*)" signal in is connected to each MRML widget's. # "setMRMLScene(vtkMRMLScene*)" slot. uiWidget.setMRMLScene(slicer.mrmlScene) # Create logic class. Logic implements all computations that should be possible to run # in batch mode, without a graphical user interface. self.logic = FiducialCenterlineExtractionLogic() self.ui.floodFillingCollapsibleGroupBox.checked = False # Connections # These connections ensure that we update parameter node when scene is closed self.addObserver(slicer.mrmlScene, slicer.mrmlScene.StartCloseEvent, self.onSceneStartClose) self.addObserver(slicer.mrmlScene, slicer.mrmlScene.EndCloseEvent, self.onSceneEndClose) # These connections ensure that whenever user changes some settings on the GUI, that is saved in the MRML scene # (in the selected parameter node). self.ui.inputFiducialSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.updateParameterNodeFromGUI) self.ui.inputSliceNodeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.updateParameterNodeFromGUI) self.ui.inputROISelector.connect("currentNodeChanged(vtkMRMLNode*)", self.updateParameterNodeFromGUI) self.ui.intensityToleranceSpinBox.connect("valueChanged(int)", self.updateParameterNodeFromGUI) self.ui.neighbourhoodSizeDoubleSpinBox.connect("valueChanged(double)", self.updateParameterNodeFromGUI) self.ui.extractCenterlinesCheckBox.connect("toggled(bool)", self.updateParameterNodeFromGUI) # Application connections self.ui.inputFiducialSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onFiducialNode) self.ui.inputSliceNodeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onSliceNode) self.ui.inputROISelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onROINode) self.ui.intensityToleranceSpinBox.connect("valueChanged(int)", self.logic.setIntensityTolerance) self.ui.neighbourhoodSizeDoubleSpinBox.connect("valueChanged(double)", self.logic.setNeighbourhoodSize) self.ui.extractCenterlinesCheckBox.connect("toggled(bool)", self.logic.setExtractCenterlines) self.ui.preFitROIToolButton.connect("clicked()", self.preFitROI) self.ui.restoreSliceViewToolButton.connect("clicked()", self.onRestoreSliceViews) # Buttons self.ui.applyButton.connect('clicked(bool)', self.onApplyButton) # Make sure parameter node is initialized (needed for module reload) self.initializeParameterNode() # A hidden one for the curious ! For developers. shortcut = qt.QShortcut(self.ui.FiducialCenterlineExtraction) shortcut.setKey(qt.QKeySequence('Meta+d')) shortcut.connect( 'activated()', lambda: self.removeOutputNodes())
def __init__(self, parent): ScriptedLoadableModuleWidget.__init__(self, parent) self.logic = SingleSliceSegmentationLogic() # Members self.parameterSetNode = None self.editor = None self.ui = None # Shortcuts self.shortcutS = qt.QShortcut(slicer.util.mainWindow()) self.shortcutS.setKey(qt.QKeySequence('s')) self.shortcutD = qt.QShortcut(slicer.util.mainWindow()) self.shortcutD.setKey(qt.QKeySequence('d')) self.shortcutC = qt.QShortcut(slicer.util.mainWindow()) self.shortcutC.setKey(qt.QKeySequence('c'))
def installShortcutKeys(self): logging.debug('installShortcutKeys') self.shortcuts = [] keysAndCallbacks = (('z', self.onPreviousSlice), ('x', self.onNextSlice)) for key, callback in keysAndCallbacks: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(key)) shortcut.connect('activated()', callback) self.shortcuts.append(shortcut)
def enterFloatingMode(self): self.mainFrame.setParent(None) cursorPosition = qt.QCursor().pos() w = self.mainFrame.width h = self.mainFrame.height self.mainFrame.pos = qt.QPoint(cursorPosition.x() - int(w/2), cursorPosition.y() - int(h/2)) self.mainFrame.show() self.mainFrame.raise_() Key_Space = 0x20 # not in PythonQt self.toggleShortcut = qt.QShortcut(self.mainFrame) self.toggleShortcut.setKey( qt.QKeySequence(Key_Space) ) self.toggleShortcut.connect( 'activated()', self.toggleFloatingMode )
def _connectHandlers(self): # Connect the CTRL + N and CTRL + P Shortcut if len(self.shortcuts) == 0: shortcutNext = qt.QShortcut(slicer.util.mainWindow()) shortcutNext.setKey(qt.QKeySequence('Ctrl+N')) shortcutNext.connect('activated()', self.onNext) self.shortcuts.append(shortcutNext) shortcutPrevious = qt.QShortcut(slicer.util.mainWindow()) shortcutPrevious.setKey(qt.QKeySequence('Ctrl+P')) shortcutPrevious.connect('activated()', self.onPrevious) self.shortcuts.append(shortcutPrevious) else: self.logger.warning('Shortcuts already initialized!') # Add an observer for the "MRML Scene End Close Event" if len(self.observers) == 0: self.observers.append(slicer.mrmlScene.AddObserver(slicer.mrmlScene.EndCloseEvent, self.onEndClose)) else: self.logger.warning('Event observer already initialized!')
def register_shortcuts(): """Register keyboard shortcuts. Map keyboard keys to the functions using the QT module from python. """ shortcuts = [ ("s", lambda: save_all(already_updated[-1])), ("b", lambda: toggle_sphere_brush()), ] for (shortcutKey, callback) in shortcuts: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(shortcutKey)) shortcut.connect("activated()", callback)
def installShortcutKeys(self): """Turn on editor-wide shortcuts. These are active independent of the currently selected effect.""" #TODO: Deal with commented out shortcuts Key_Escape = 0x01000000 # not in PythonQt Key_Space = 0x20 # not in PythonQt self.shortcuts = [] keysAndCallbacks = ( ('z', self.editor.undo), ('y', self.editor.redo), ('h', self.toggleCrosshair), (Key_Escape, lambda: self.editor.setActiveEffect(None)), ('0', lambda: self.editor.setActiveEffect(None)), ('1', lambda: self.editor.setActiveEffect( self.editor.effectByName('Paint'))), ('2', lambda: self.editor.setActiveEffect( self.editor.effectByName('Draw'))), ('3', lambda: self.editor.setActiveEffect( self.editor.effectByName('Erase'))), ('4', lambda: self.editor.setActiveEffect( self.editor.effectByName('LevelTracing'))), ('5', lambda: self.editor.setActiveEffect( self.editor.effectByName('Auto-complete'))), ('6', lambda: self.editor.setActiveEffect( self.editor.effectByName('Threshold'))), ('q', lambda: self.switchSegment(-1) ), # near effect selector numbers on a regular keyboard ('w', lambda: self.switchSegment(+1) ), # near effect selector numbers on a regular keyboard ('/', lambda: self.switchSegment(-1)), # available on the numpad ('*', lambda: self.switchSegment(+1)), # available on the numpad (',', lambda: self.switchSegment(-1) ), # commonly used in other applications ('.', lambda: self.switchSegment(+1) ), # commonly used in other applications ('<', lambda: self.switchSegment(-1) ), # commonly used in other applications ('>', lambda: self.switchSegment(+1) ), # commonly used in other applications ) for key, callback in keysAndCallbacks: shortcut = qt.QShortcut(slicer.util.mainWindow()) shortcut.setKey(qt.QKeySequence(key)) shortcut.connect('activated()', callback) self.shortcuts.append(shortcut)
def _init_toolbar( self ): self.window.setUsesTextLabel( False ) basedir = matplotlib.rcParams[ 'datapath' ] for text, tooltip_text, image_file, callback in self.toolitems: if text == None: self.addSeparator() continue fname = os.path.join( basedir, image_file ) image = qt.QPixmap() image.load( fname ) a = qt.QAction( qt.QIconSet( image ), text, qt.QKeySequence('M'), self.window ) a.setToolTip( tooltip_text ) qt.QObject.connect( a, qt.SIGNAL( 'activated()' ), getattr( self, callback ) ) a.addTo( self )
def setupMacros(): """Set up hot keys for various development scenarios""" import qt global tracker, endoscopy, editor, fileScan, performance, changetracker print "SlicerRC - Install custom keyboard shortcuts" macros = ( ("Ctrl+0", loadSlicerRCFile), ("Ctrl+1", tracker), ("Ctrl+2", endoscopy), ("Ctrl+3", editor), ("Ctrl+4", fileScan), ("Ctrl+5", performance), ("Ctrl+6", changetracker) ) for keys,f in macros: k = qt.QKeySequence(keys) s = qt.QShortcut(k,mainWindow()) s.connect('activated()', f) s.connect('activatedAmbiguously()', f) print "SlicerRC - '%s' -> '%s'" % (keys, f.__name__)
def setup(self): # this is the function that implements all GUI ScriptedLoadableModuleWidget.setup(self) # This sets the view being used to the red view only slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView) #This code block creates a collapsible button #This defines which type of button you are using self.usContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.usContainer.text = "Ultrasound Information" #Thiss actually creates that button self.layout.addWidget(self.usContainer) #This creates a variable that describes layout within this collapsible button self.usLayout = qt.QFormLayout(self.usContainer) #This descirbes the type of widget self.inputIPLineEdit = qt.QLineEdit() #This sets a placehoder example of what should be inputted to the line edit self.inputIPLineEdit.setPlaceholderText("127.0.0.1") #This is the help tooltip self.inputIPLineEdit.toolTip = "Put the IP address of your ultrasound device here" #This is the text that is input inot the line self.IPLabel = qt.QLabel("Server IP:") if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addRow(self.IPLabel, self.inputIPLineEdit) #This code block is the exact same as the one above only it asks for the server port self.layout.addWidget(self.usContainer) self.inputPortLineEdit = qt.QLineEdit() self.inputPortLineEdit.setPlaceholderText("18944") self.inputPortLineEdit.setValidator(qt.QIntValidator()) self.inputPortLineEdit.toolTip = "Put the Port of your ultrasound device here" self.portLabel = qt.QLabel("Sever Port:") if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addRow(self.portLabel, self.inputPortLineEdit) #This is a push button self.connectButton = qt.QPushButton() self.connectButton.setDefault(False) #This button says connect self.connectButton.text = "Connect" #help tooltip that explains the funciton self.connectButton.toolTip = "Connects to Ultrasound" #adds the widget to the layout if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addWidget(self.connectButton) # Combobox for image selection self.imageSelector = slicer.qMRMLNodeComboBox() self.imageSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.imageSelector.selectNodeUponCreation = True self.imageSelector.addEnabled = False self.imageSelector.removeEnabled = False self.imageSelector.noneEnabled = True self.imageSelector.showHidden = False self.imageSelector.showChildNodeTypes = False self.imageSelector.setMRMLScene( slicer.mrmlScene ) self.imageSelector.setToolTip( "Pick the image to be used." ) self.usLayout.addRow("US Volume: ", self.imageSelector) #add combo box for linear transform node self.TransformSelector = slicer.qMRMLNodeComboBox() self.TransformSelector.nodeTypes = ["vtkMRMLLinearTransformNode"] self.TransformSelector.selectNodeUponCreation = True self.TransformSelector.addEnabled = False self.TransformSelector.removeEnabled = False self.TransformSelector.noneEnabled = True self.TransformSelector.showHidden = False self.TransformSelector.showChildNodeTypes = False self.TransformSelector.setMRMLScene( slicer.mrmlScene ) self.TransformSelector.setToolTip( "Pick the transform representing the straw line." ) self.usLayout.addRow("Tip to Probe: ", self.TransformSelector) self.calibrationContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.calibrationContainer.text = "Calibration Parameters" #Thiss actually creates that button self.layout.addWidget(self.calibrationContainer) #This creates a variable that describes layout within this collapsible button self.calibrationLayout = qt.QFormLayout(self.calibrationContainer) self.segLabel = qt.QLabel() self.calibrationLayout.addRow(qt.QLabel("Type of segmentation:"), self.segLabel) self.manual = qt.QCheckBox() self.manual.text = "Check for manual segmentation" self.calibrationLayout.addWidget(self.manual) self.auto = qt.QCheckBox() self.auto.text = "Check for automatic segmentation for ultrasonix L14-5 38" self.calibrationLayout.addWidget(self.auto) self.recordContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.recordContainer.text = "Recording Options" #Thiss actually creates that button #This creates a variable that describes layout within this collapsible button self.recordLayout = qt.QFormLayout(self.recordContainer) self.RecordButton = qt.QPushButton() self.RecordButton.text = "Start Recording" self.recordLayout.addWidget(self.RecordButton) self.StopRecordButton = qt.QPushButton() self.StopRecordButton.text = "Stop Recording" self.recordLayout.addWidget(self.StopRecordButton) self.pathInput = qt.QLineEdit() self.pathInput.setPlaceholderText("Enter the path to save files to") self.pathText = qt.QLabel("File Path:") self.recordLayout.addRow(self.pathText, self.pathInput) self.SaveRecordButton = qt.QPushButton() self.SaveRecordButton.text = "Save Recording" self.recordLayout.addWidget(self.SaveRecordButton) # This creates another collapsible button self.fiducialContainer = ctk.ctkCollapsibleButton() self.fiducialContainer.text = "Registration" self.fiducialLayout = qt.QFormLayout(self.fiducialContainer) #This is the exact same as the code block below but it freezes the US to capture a screenshot self.freezeButton = qt.QPushButton() if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.freezeButton.text = "Place Fiducial ('f')" else: self.freezeButton.text = "Place Fiducial" self.freezeButton.toolTip = "Freeze the ultrasound image for fiducial placement" self.fiducialLayout.addRow(self.freezeButton) self.shortcut = qt.QShortcut(qt.QKeySequence('f'), slicer.util.mainWindow()) self.undoButton = qt.QPushButton() self.undoButton.setText("Undo ('u')") self.fiducialLayout.addRow(self.undoButton) self.uShortcut = qt.QShortcut(qt.QKeySequence('ctrl+u'), slicer.util.mainWindow()) self.redoButton = qt.QPushButton() self.rShortcut = qt.QShortcut(qt.QKeySequence('r'), slicer.util.mainWindow()) self.redoButton.setText("Redo ('r')") self.fiducialLayout.addRow(self.redoButton) self.numFidLabel = qt.QLabel() self.fiducialLayout.addRow(qt.QLabel("Fiducials collected:"), self.numFidLabel) self.transformTable = ctk.ctkMatrixWidget() self.transformTable.columnCount = 4 self.transformTable.rowCount = 4 self.transformTable.setDecimals(3) for i in range (0,4): for j in range(0,4): self.transformTable.setValue(i,j, (self.imageToProbe.GetElement(i,j))) self.fiducialLayout.addRow(qt.QLabel("Image to probe transform:")) self.fiducialLayout.addRow(self.transformTable) # Add vertical spacer self.copyButton = qt.QPushButton() self.copyButton.setText('Copy Transform') self.copyButton.toolTip = "Copy" self.fiducialLayout.addRow(self.copyButton) self.validationContainer = ctk.ctkCollapsibleButton() self.validationContainer.text = "Validation" self.validationLayout = qt.QFormLayout(self.validationContainer) self.visualizeButton = qt.QPushButton('Show 3D Scene') self.visualizeButton.toolTip = "This button enables the 3D view for visual validation" self.validationLayout.addRow(self.visualizeButton) self.visualizeButton.connect('clicked(bool)', self.onVisualizeButtonClicked) self.resetButton = qt.QPushButton('Reset') self.resetButton.setDefault(False) self.resetButton.toolTip = "This Button Resets the Module" self.validationLayout.addRow(self.resetButton) # Add the containers to the parent self.layout.addWidget(self.usContainer) self.layout.addWidget(self.calibrationContainer) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.layout.addWidget(self.recordContainer) self.layout.addWidget(self.fiducialContainer) #self.layout.addWidget(self.transformContainer) self.layout.addWidget(self.validationContainer) # Add vertical spacer self.layout.addStretch(1) # Connections if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.connectButton.connect('clicked(bool)', self.onConnectButtonClicked) self.freezeButton.connect('clicked(bool)', self.onConnectButtonClicked) self.shortcut.connect('activated()', self.onConnectButtonClicked) else: self.shortcut.connect('activated()', self.onFiducialClicked) self.freezeButton.connect('clicked(bool)', self.onFiducialClicked) self.RecordButton.connect('clicked(bool)', self.onRecordButtonClicked) self.StopRecordButton.connect('clicked(bool)', self.onStopRecordButtonClicked) self.SaveRecordButton.connect('clicked(bool)', self.onSaveRecordButtonClicked) self.copyButton.connect('clicked(bool)', self.onCopyButtonClicked) self.inputIPLineEdit.connect('textChanged(QString)', self.onInputChanged) self.inputPortLineEdit.connect('textChanged(QString)', self.onInputChanged) self.imageSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onImageChanged) self.TransformSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onTransformChanged) self.resetButton.connect('clicked(bool)', self.onResetButtonClicked) self.undoButton.connect('clicked(bool)', self.onUndoButtonClicked) self.uShortcut.connect('activated()', self.onUndoButtonClicked) self.redoButton.connect('clicked(bool)', self.onRedoButtonClicked) self.rShortcut.connect('activated()', self.onRedoButtonClicked) # Disable buttons until conditions are met self.connectButton.setEnabled(True) # if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: # self.freezeButton.setEnabled(False) self.StopRecordButton.setEnabled(False) self.sceneObserverTag = slicer.mrmlScene.AddObserver(slicer.mrmlScene.NodeAddedEvent, self.onNodeAdded)
def setup(self): ScriptedLoadableModuleWidget.setup(self) slicer.app.layoutManager().setLayout( slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView) l = slicer.modules.createmodels.logic() self.needleModel = l.CreateNeedle(150, 1, 2.5, False) # self.array1 = np.array([29, 24.37, 160.992]) # self.array2 = np.array([28, 1.630, 69.785]) # self.array3 = np.array([29,-7.321, 33.884]) # self.array4 = np.array([-26, 24.129, 160.022]) # self.array5 = np.array([-28, 11.065, 107.626]) # self.array6 = np.array([-30.387, -7.394, 33.589]) self.jigArray = np.array([[29, 24.37, 160.992], [28, 1.630, 69.785], [29, -7.321, 33.884], [-26, 24.129, 160.022], [-28, 11.065, 107.626], [-30.387, -7.394, 33.589]]) self.collectedArray = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]) self.points = vtk.vtkPoints() self.points.SetNumberOfPoints(6) self.points.SetPoint(0, self.jigArray[0]) self.points.SetPoint(1, self.jigArray[1]) self.points.SetPoint(2, self.jigArray[2]) self.points.SetPoint(3, self.jigArray[3]) self.points.SetPoint(4, self.jigArray[4]) self.points.SetPoint(5, self.jigArray[5]) self.collectedPoints = vtk.vtkPoints() self.collectedPoints.SetNumberOfPoints(6) self.DN = self.markupsNode.GetDisplayNode() self.DN.SetSelectedColor(0, 0, 1) self.DN.SetTextScale(0) self.markupsNode.AddFiducialFromArray(self.jigArray[0]) self.markupsNode.AddFiducialFromArray(self.jigArray[1]) self.markupsNode.AddFiducialFromArray(self.jigArray[2]) self.markupsNode.AddFiducialFromArray(self.jigArray[3]) self.markupsNode.AddFiducialFromArray(self.jigArray[4]) self.markupsNode.AddFiducialFromArray(self.jigArray[5]) slicer.app.layoutManager().setLayout( slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView) self.parametersCollapsibleButton = ctk.ctkCollapsibleButton() self.parametersCollapsibleButton.text = "Parameters" self.layout.addWidget(self.parametersCollapsibleButton) self.parametersFormLayout = qt.QFormLayout( self.parametersCollapsibleButton) self.connectButton = qt.QPushButton() self.connectButton.setDefault(False) self.connectButton.text = "Connect" self.parametersFormLayout.addWidget(self.connectButton) self.TransformSelector = slicer.qMRMLNodeComboBox() self.TransformSelector.nodeTypes = ["vtkMRMLLinearTransformNode"] self.TransformSelector.selectNodeUponCreation = True self.TransformSelector.addEnabled = False self.TransformSelector.removeEnabled = False self.TransformSelector.noneEnabled = True self.TransformSelector.showHidden = False self.TransformSelector.showChildNodeTypes = False self.TransformSelector.setMRMLScene(slicer.mrmlScene) self.TransformSelector.setToolTip( "Pick the transform representing the straw line.") self.parametersFormLayout.addRow("Tip to Probe: ", self.TransformSelector) self.collectButton = qt.QPushButton() self.collectButton.setDefault(False) self.collectButton.text = "Collect Fiducial" self.parametersFormLayout.addWidget(self.collectButton) self.shortcut = qt.QShortcut(qt.QKeySequence('c'), slicer.util.mainWindow()) self.deleteButton = qt.QPushButton() self.deleteButton.setDefault(False) self.deleteButton.text = "Delete Last Fiducial" self.parametersFormLayout.addWidget(self.deleteButton) self.calculateButton = qt.QPushButton() self.calculateButton.setDefault(False) self.calculateButton.text = "Calculate Transformation Matrix" self.parametersFormLayout.addWidget(self.calculateButton) self.transformTable = qt.QTableWidget() self.transTableItem = qt.QTableWidgetItem() self.fidError = qt.QLabel() self.transformTable.setRowCount(4) self.transformTable.setColumnCount(4) self.transformTable.horizontalHeader().hide() self.transformTable.verticalHeader().hide() self.transformTable.setItem(0, 0, qt.QTableWidgetItem("1")) self.transformTable.setItem(0, 1, qt.QTableWidgetItem("0")) self.transformTable.setItem(0, 2, qt.QTableWidgetItem("0")) self.transformTable.setItem(0, 3, qt.QTableWidgetItem("0")) self.transformTable.setItem(1, 0, qt.QTableWidgetItem("0")) self.transformTable.setItem(1, 1, qt.QTableWidgetItem("1")) self.transformTable.setItem(1, 2, qt.QTableWidgetItem("0")) self.transformTable.setItem(1, 3, qt.QTableWidgetItem("0")) self.transformTable.setItem(2, 0, qt.QTableWidgetItem("0")) self.transformTable.setItem(2, 1, qt.QTableWidgetItem("0")) self.transformTable.setItem(2, 2, qt.QTableWidgetItem("1")) self.transformTable.setItem(2, 3, qt.QTableWidgetItem("0")) self.transformTable.setItem(3, 0, qt.QTableWidgetItem("0")) self.transformTable.setItem(3, 1, qt.QTableWidgetItem("0")) self.transformTable.setItem(3, 2, qt.QTableWidgetItem("0")) self.transformTable.setItem(3, 3, qt.QTableWidgetItem("1")) self.transformTable.resizeColumnToContents(0) self.transformTable.resizeColumnToContents(1) self.transformTable.resizeColumnToContents(2) self.transformTable.resizeColumnToContents(3) self.transformTable.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.MinimumExpanding) # self.copyIcon =qt.QIcon(":Icons/Medium/SlicerEditCopy.png") # self.copyButton = qt.QPushButton() # self.copyButton.setIcon(self.copyIcon) # self.copyButton.toolTip = "Copy" # self.copyButton.setMaximumWidth(64) # self.copyHbox = qt.QHBoxLayout() # self.copyHbox.addWidget(self.copyButton) self.parametersFormLayout.addRow(qt.QLabel("Transformation Matrix:")) self.parametersFormLayout.addRow(self.transformTable) self.copyButton = qt.QPushButton() self.copyButton.setDefault(False) self.copyButton.text = "Copy Transform" self.parametersFormLayout.addWidget(self.copyButton) self.errorString = qt.QLabel() self.errorString.text = "RMSE: " + str(self.error) self.parametersFormLayout.addRow(self.errorString) self.connectButton.connect('clicked(bool)', self.onConnectButtonClicked) self.TransformSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onTransformChanged) self.collectButton.connect('clicked(bool)', self.onCollectButtonClicked) self.shortcut.connect('activated()', self.onCollectButtonClicked) self.deleteButton.connect('clicked(bool)', self.onDeleteButtonClicked) self.calculateButton.connect('clicked(bool)', self.onCalculateButtonClicked) self.copyButton.connect('clicked(bool)', self.onCopyButtonClicked) self.layout.addStretch(1) slicer.app.layoutManager().setLayout( slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView)
def setup(self): ScriptedLoadableModuleWidget.setup(self) # layoutLogic = slicer.app.layoutManager.layoutLogic() slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutSideBySideView) l = slicer.modules.createmodels.logic() self.needleModel = l.CreateNeedle(150, 0.4, 0, False) self.redWidget = slicer.app.layoutManager().sliceWidget('Red') self.yellowWidget = slicer.app.layoutManager().sliceWidget('Yellow') self.usContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.usContainer.text = "Connection Information" #Thiss actually creates that button #This creates a variable that describes layout within this collapsible button self.usLayout = qt.QFormLayout(self.usContainer) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: #This is a push button self.connectButton = qt.QPushButton() self.connectButton.setDefault(False) #This button says connect self.connectButton.text = "Connect" #help tooltip that explains the funciton self.connectButton.toolTip = "Connects to ultrasound" #adds the widget to the layout self.usLayout.addWidget(self.connectButton) # self.normalImageButton = qt.QCheckBox() # self.normalImageButton.text = "Select if performing a 2D Calibration" # self.usLayout.addRow(self.normalImageButton) self.imageSelector = slicer.qMRMLNodeComboBox() self.imageSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.imageSelector.selectNodeUponCreation = True self.imageSelector.addEnabled = False self.imageSelector.removeEnabled = False self.imageSelector.noneEnabled = True self.imageSelector.showHidden = False self.imageSelector.showChildNodeTypes = False self.imageSelector.setMRMLScene( slicer.mrmlScene ) self.imageSelector.setToolTip( "Pick the image to be used." ) self.usLayout.addRow("Left view volume: ", self.imageSelector) self.imageSelector2 = slicer.qMRMLNodeComboBox() self.imageSelector2.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.imageSelector2.selectNodeUponCreation = True self.imageSelector2.addEnabled = False self.imageSelector2.removeEnabled = False self.imageSelector2.noneEnabled = True self.imageSelector2.showHidden = False self.imageSelector2.showChildNodeTypes = False self.imageSelector2.setMRMLScene( slicer.mrmlScene ) self.imageSelector2.setToolTip( "Pick the image to be used." ) self.usLayout.addRow("Right view volume: ", self.imageSelector2) #add combo box for linear transform node self.TransformSelector = slicer.qMRMLNodeComboBox() self.TransformSelector.nodeTypes = ["vtkMRMLLinearTransformNode"] self.TransformSelector.selectNodeUponCreation = True self.TransformSelector.addEnabled = False self.TransformSelector.removeEnabled = False self.TransformSelector.noneEnabled = True self.TransformSelector.showHidden = False self.TransformSelector.showChildNodeTypes = False self.TransformSelector.setMRMLScene( slicer.mrmlScene ) self.TransformSelector.setToolTip( "Pick the transform representing the straw line." ) self.usLayout.addRow("Tip to Probe: ", self.TransformSelector) self.recordContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.recordContainer.text = "Recording Options" #Thiss actually creates that button #This creates a variable that describes layout within this collapsible button self.recordLayout = qt.QFormLayout(self.recordContainer) self.RecordButton = qt.QPushButton() self.RecordButton.text = "Start Recording" self.recordLayout.addWidget(self.RecordButton) self.StopRecordButton = qt.QPushButton() self.StopRecordButton.text = "Stop Recording" self.recordLayout.addWidget(self.StopRecordButton) self.pathInput = qt.QLineEdit() self.pathInput.setPlaceholderText("Enter the path to save files to") self.pathText = qt.QLabel("File Path:") self.recordLayout.addRow(self.pathText, self.pathInput) self.SaveRecordButton = qt.QPushButton() self.SaveRecordButton.text = "Save Recording" self.recordLayout.addWidget(self.SaveRecordButton) # This creates another collapsible button self.fiducialContainer = ctk.ctkCollapsibleButton() self.fiducialContainer.text = "Registration" self.fiducialLayout = qt.QFormLayout(self.fiducialContainer) self.freezeButton = qt.QPushButton() if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.freezeButton.text = "Freeze" else: self.freezeButton.text = "Place Fiducial" self.freezeButton.toolTip = "Freeze the ultrasound image for fiducial placement" self.fiducialLayout.addRow(self.freezeButton) self.shortcut = qt.QShortcut(qt.QKeySequence('f'), slicer.util.mainWindow()) self.numFidLabel = qt.QLabel() self.fiducialLayout.addRow(qt.QLabel("Fiducials collected:"), self.numFidLabel) self.transformTable = qt.QTableWidget() self.transTableItem = qt.QTableWidgetItem() self.fidError = qt.QLabel() self.transformTable.setRowCount(4) self.transformTable.setColumnCount(4) self.transformTable.horizontalHeader().hide() self.transformTable.verticalHeader().hide() self.transformTable.setItem(0,0, qt.QTableWidgetItem("1")) self.transformTable.setItem(0,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(0,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(0,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,1, qt.QTableWidgetItem("1")) self.transformTable.setItem(1,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,2, qt.QTableWidgetItem("1")) self.transformTable.setItem(2,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,3, qt.QTableWidgetItem("1")) self.transformTable.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.MinimumExpanding) self.copyIcon =qt.QIcon(":Icons/Medium/SlicerEditCopy.png") self.copyButton = qt.QPushButton() self.copyButton.setIcon(self.copyIcon) self.copyButton.setMaximumWidth(64) self.copyButton.enabled = False if self.numFidLabel >= 2: self.copyButton.enabled = True self.fiducialLayout.addRow(qt.QLabel("Image to probe transform:")) self.fiducialLayout.addRow(self.transformTable) self.fiducialLayout.addRow("Copy:", self.copyButton) self.validationContainer = ctk.ctkCollapsibleButton() self.validationContainer.text = "Validation" self.validationLayout = qt.QFormLayout(self.validationContainer) self.visualizeButton = qt.QPushButton('Show 3D Scene') self.visualizeButton.toolTip = "This button enables the 3D view for visual validation" self.validationLayout.addRow(self.visualizeButton) self.visualizeButton.connect('clicked(bool)', self.onVisualizeButtonClicked) self.layout.addWidget(self.usContainer) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.layout.addWidget(self.recordContainer) self.layout.addWidget(self.fiducialContainer) self.layout.addWidget(self.validationContainer) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.connectButton.connect('clicked(bool)', self.onConnectButtonClicked) self.freezeButton.connect('clicked(bool)', self.onConnectButtonClicked) self.shortcut.connect('activated()', self.onConnectButtonClicked) self.RecordButton.connect('clicked(bool)', self.onRecordButtonClicked) self.StopRecordButton.connect('clicked(bool)', self.onStopButtonClicked) self.SaveRecordButton.connect('clicked(bool)', self.onSaveButtonClicked) else: self.shortcut.connect('activated()', self.onFiducialClicked) self.freezeButton.connect('clicked(bool)', self.onFiducialClicked) self.imageSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onImageChanged) self.imageSelector2.connect('currentNodeChanged(vtkMRMLNode*)', self.onImageChanged2) self.TransformSelector.connect('currentNodeChanged(vtkMRMLNode*)',self.onTransformChanged) self.copyButton.connect('clicked(bool)', self.onCopyButtonClicked) self.layout.addStretch(1) self.sceneObserverTag = slicer.mrmlScene.AddObserver(slicer.mrmlScene.NodeAddedEvent, self.onNodeAdded)
def setup(self): # this is the function that implements all GUI ScriptedLoadableModuleWidget.setup(self) # This sets the view being used to the red view only slicer.app.layoutManager().setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView) l = slicer.modules.createmodels.logic() self.needleModel = l.CreateNeedle(150, 0.4, 0, False) #This code block creates a collapsible button #This defines which type of button you are using self.usContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.usContainer.text = "Ultrasound Information" #Thiss actually creates that button self.layout.addWidget(self.usContainer) #This creates a variable that describes layout within this collapsible button self.usLayout = qt.QFormLayout(self.usContainer) #This descirbes the type of widget self.inputIPLineEdit = qt.QLineEdit() #This sets a placehoder example of what should be inputted to the line edit self.inputIPLineEdit.setPlaceholderText("127.0.0.1") #This is the help tooltip self.inputIPLineEdit.toolTip = "Put the IP address of your ultrasound device here" #This is the text that is input inot the line self.IPLabel = qt.QLabel("Server IP:") if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addRow(self.IPLabel, self.inputIPLineEdit) #This code block is the exact same as the one above only it asks for the server port self.layout.addWidget(self.usContainer) self.inputPortLineEdit = qt.QLineEdit() self.inputPortLineEdit.setPlaceholderText("18944") self.inputPortLineEdit.setValidator(qt.QIntValidator()) self.inputPortLineEdit.toolTip = "Put the Port of your ultrasound device here" self.portLabel = qt.QLabel("Sever Port:") if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addRow(self.portLabel, self.inputPortLineEdit) #This is a push button self.connectButton = qt.QPushButton() self.connectButton.setDefault(False) #This button says connect self.connectButton.text = "Connect" #help tooltip that explains the funciton self.connectButton.toolTip = "Connects to Ultrasound" #adds the widget to the layout if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.usLayout.addWidget(self.connectButton) # Combobox for image selection self.imageSelector = slicer.qMRMLNodeComboBox() self.imageSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.imageSelector.selectNodeUponCreation = True self.imageSelector.addEnabled = False self.imageSelector.removeEnabled = False self.imageSelector.noneEnabled = True self.imageSelector.showHidden = False self.imageSelector.showChildNodeTypes = False self.imageSelector.setMRMLScene( slicer.mrmlScene ) self.imageSelector.setToolTip( "Pick the image to be used." ) self.usLayout.addRow("US Volume: ", self.imageSelector) #add combo box for linear transform node self.TransformSelector = slicer.qMRMLNodeComboBox() self.TransformSelector.nodeTypes = ["vtkMRMLLinearTransformNode"] self.TransformSelector.selectNodeUponCreation = True self.TransformSelector.addEnabled = False self.TransformSelector.removeEnabled = False self.TransformSelector.noneEnabled = True self.TransformSelector.showHidden = False self.TransformSelector.showChildNodeTypes = False self.TransformSelector.setMRMLScene( slicer.mrmlScene ) self.TransformSelector.setToolTip( "Pick the transform representing the straw line." ) self.usLayout.addRow("Tip to Probe: ", self.TransformSelector) self.calibrationContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.calibrationContainer.text = "Calibration Parameters" #Thiss actually creates that button self.layout.addWidget(self.calibrationContainer) #This creates a variable that describes layout within this collapsible button self.calibrationLayout = qt.QFormLayout(self.calibrationContainer) self.segLabel = qt.QLabel() self.calibrationLayout.addRow(qt.QLabel("Type of segmentation:"), self.segLabel) self.recordContainer = ctk.ctkCollapsibleButton() #This is what the button will say self.recordContainer.text = "Recording Options" #Thiss actually creates that button #This creates a variable that describes layout within this collapsible button self.recordLayout = qt.QFormLayout(self.recordContainer) self.RecordButton = qt.QPushButton() self.RecordButton.text = "Start Recording" self.recordLayout.addWidget(self.RecordButton) self.StopRecordButton = qt.QPushButton() self.StopRecordButton.text = "Stop Recording" self.recordLayout.addWidget(self.StopRecordButton) self.pathInput = qt.QLineEdit() self.pathInput.setPlaceholderText("Enter the path to save files to") self.pathText = qt.QLabel("File Path:") self.recordLayout.addRow(self.pathText, self.pathInput) self.SaveRecordButton = qt.QPushButton() self.SaveRecordButton.text = "Save Recording" self.recordLayout.addWidget(self.SaveRecordButton) # This creates another collapsible button self.fiducialContainer = ctk.ctkCollapsibleButton() self.fiducialContainer.text = "Registration" self.fiducialLayout = qt.QFormLayout(self.fiducialContainer) #This is the exact same as the code block below but it freezes the US to capture a screenshot self.freezeButton = qt.QPushButton() if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.freezeButton.text = "Freeze" else: self.freezeButton.text = "Place Fiducial" self.freezeButton.toolTip = "Freeze the ultrasound image for fiducial placement" self.fiducialLayout.addRow(self.freezeButton) self.shortcut = qt.QShortcut(qt.QKeySequence('f'), slicer.util.mainWindow()) self.numFidLabel = qt.QLabel() self.fiducialLayout.addRow(qt.QLabel("Fiducials collected:"), self.numFidLabel) self.transformTable = qt.QTableWidget() self.transTableItem = qt.QTableWidgetItem() self.fidError = qt.QLabel() self.transformTable.setRowCount(4) self.transformTable.setColumnCount(4) self.transformTable.horizontalHeader().hide() self.transformTable.verticalHeader().hide() self.transformTable.setItem(0,0, qt.QTableWidgetItem("1")) self.transformTable.setItem(0,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(0,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(0,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,1, qt.QTableWidgetItem("1")) self.transformTable.setItem(1,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(1,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(2,2, qt.QTableWidgetItem("1")) self.transformTable.setItem(2,3, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,0, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,1, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,2, qt.QTableWidgetItem("0")) self.transformTable.setItem(3,3, qt.QTableWidgetItem("1")) self.transformTable.setSizePolicy(qt.QSizePolicy.Minimum, qt.QSizePolicy.MinimumExpanding) self.copyIcon =qt.QIcon(":Icons/Medium/SlicerEditCopy.png") self.copyButton = qt.QPushButton() self.copyButton.setIcon(self.copyIcon) self.copyButton.toolTip = "Copy" self.copyButton.setMaximumWidth(64) self.copyHbox = qt.QHBoxLayout() self.copyHbox.addWidget(self.copyButton) self.copyButton.enabled = False if self.numFidLabel >= 2: self.copyButton.enabled = True self.fiducialLayout.addRow(qt.QLabel("Image to probe transform:")) self.fiducialLayout.addRow(self.transformTable) # Add vertical spacer self.layout.addStretch(1) # Add vertical spacer self.layout.addStretch(1) self.fiducialLayout.addRow("Copy:", self.copyHbox) self.validationContainer = ctk.ctkCollapsibleButton() self.validationContainer.text = "Validation" self.validationLayout = qt.QFormLayout(self.validationContainer) self.visualizeButton = qt.QPushButton('Show 3D Scene') self.visualizeButton.toolTip = "This button enables the 3D view for visual validation" self.validationLayout.addRow(self.visualizeButton) self.visualizeButton.connect('clicked(bool)', self.onVisualizeButtonClicked) self.resetButton = qt.QPushButton('Reset') self.resetButton.setDefault(False) self.resetButton.toolTip = "This Button Resets the Module" self.validationLayout.addRow(self.resetButton) # Add the containers to the parent self.layout.addWidget(self.usContainer) self.layout.addWidget(self.calibrationContainer) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.layout.addWidget(self.recordContainer) self.layout.addWidget(self.fiducialContainer) #self.layout.addWidget(self.transformContainer) self.layout.addWidget(self.validationContainer) # Add vertical spacer self.layout.addStretch(1) # Connections if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.connectButton.connect('clicked(bool)', self.onConnectButtonClicked) self.freezeButton.connect('clicked(bool)', self.onConnectButtonClicked) self.shortcut.connect('activated()', self.onConnectButtonClicked) else: self.shortcut.connect('activated()', self.onFiducialClicked) self.freezeButton.connect('clicked(bool)', self.onFiducialClicked) self.RecordButton.connect('clicked(bool)', self.onRecordButtonClicked) self.StopRecordButton.connect('clicked(bool)', self.onStopRecordButtonClicked) self.SaveRecordButton.connect('clicked(bool)', self.onSaveRecordButtonClicked) self.copyButton.connect('clicked(bool)', self.onCopyButtonClicked) self.inputIPLineEdit.connect('textChanged(QString)', self.onInputChanged) self.inputPortLineEdit.connect('textChanged(QString)', self.onInputChanged) self.imageSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onImageChanged) self.TransformSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onTransformChanged) self.resetButton.connect('clicked(bool)', self.onResetButtonClicked) # Disable buttons until conditions are met self.connectButton.setEnabled(True) if slicer.mrmlScene.GetNodesByClass("vtkMRMLSequenceNode").GetNumberOfItems() == 0: self.freezeButton.setEnabled(False) self.StopRecordButton.setEnabled(False) self.sceneObserverTag = slicer.mrmlScene.AddObserver(slicer.mrmlScene.NodeAddedEvent, self.onNodeAdded)
def init_QuickTCGA(self): self.emergencyStopFunc = None self.dialogBox = qt.QMessageBox( ) #will display messages to draw users attention if he does anything wrong self.dialogBox.setWindowTitle("QuickTCGA Error") self.dialogBox.setWindowModality( qt.Qt.NonModal ) #will allow user to continue interacting with Slicer # TODO: check this claim- might be causing leaks # set the image, label nodes (this will not change although the user can # alter what is bgrnd/frgrnd in editor) # Confused about how info propagates UIarray to UIVol, not the other way, NEEDS AUTO TESTS self.labelNode = self.editUtil.getLabelVolume( ) #labelLogic.GetVolumeNode() self.backgroundNode = self.editUtil.getBackgroundVolume( ) #backgroundLogic.GetVolumeNode() self.foregroundNode = self.swRed.GetForegroundLayer().GetVolumeNode() #perform safety check on right images/labels being selected, #set up images #if red slice doesnt have a label or image, go no further if type(self.backgroundNode) == type(None) or type( self.labelNode) == type(None): self.dialogBox.setText( "Either Image (must be Background Image) or Label not set in slice views." ) self.dialogBox.show() if self.emergencyStopFunc: self.emergencyStopFunc() return volumesLogic = slicer.modules.volumes.logic() self.labelName = self.labelNode.GetName( ) # record name of label so user, cant trick us self.imgBgrdName = self.backgroundNode.GetName() self.imgFgrdName = self.foregroundNode.GetName() if self.sliceViewMatchEditor( self.sliceLogic ) == False: # do nothing, exit function if user has played with images if self.emergencyStopFunc: self.emergencyStopFunc() return # QuickTCGA shortcuts ##resetQTCGAKey = qt.QKeySequence(qt.Qt.Key_R) # reset initialization flag ##runQTCGAClusterKey = qt.QKeySequence(qt.Qt.Key_S) # run fast growcut runNucleiSegKey = qt.QKeySequence(qt.Qt.Key_Y) ##editTCGAKey = qt.QKeySequence(qt.Qt.Key_E) # edit seed labels ##runQTCGATemplateKey = qt.QKeySequence(qt.Qt.Key_T) ##runQTCGARefineCurvatureKey = qt.QKeySequence(qt.Qt.Key_U) ##runQTCGAShortCutKey = qt.QKeySequence(qt.Qt.Key_C) ##runQTCGAShortEditCutKey = qt.QKeySequence(qt.Qt.Key_F) print " key to run QuickTCGA segmentation is Y" self.qtkeyconnections = [] self.qtkeydefsQTCGA = [[runNucleiSegKey, self.runQTCGA_NucleiSegYi]] for keydef in self.qtkeydefsQTCGA: s = qt.QShortcut(keydef[0], slicer.util.mainWindow() ) # connect this qt event to mainWindow focus s.connect('activated()', keydef[1]) self.qtkeyconnections.append(s) self.qTCGALabMod_tag = self.sliceLogic.AddObserver( "ModifiedEvent", self.QTCGAChangeLabelInput ) # put test listener on the whole window # Quick TCGA parameters self.bEditTCGA = True self.bEditShortCut = False self.currentMessage = "" seedArray = slicer.util.array(self.labelName) self.qTCGASeedArray = seedArray.copy() self.qTCGASegArray = seedArray.copy() self.qTCGASeedArray[:] = 0 self.qTCGASegArray[:] = 0 self.SCutROIRad = 50 self.volSize = self.labelNode.GetImageData().GetDimensions() self.qSCutROIArray = seedArray.copy( ) #np.zeros([self.volSize[0],self.volSize[1],1]) self.qSCutROIArray[:] = 0 roiVTK = vtk.vtkImageData() roiVTK.DeepCopy(self.labelNode.GetImageData()) self.roiVTK = roiVTK import vtkSlicerQuickTCGAModuleLogicPython node = EditUtil.EditUtil().getParameterNode( ) # get the parameters from MRML otsuRatio = float(node.GetParameter("QuickTCGAEffect,otsuRatio")) curvatureWeight = float( node.GetParameter("QuickTCGAEffect,curvatureWeight")) / 10 sizeThld = float(node.GetParameter("QuickTCGAEffect,sizeThld")) sizeUpperThld = float( node.GetParameter("QuickTCGAEffect,sizeUpperThld")) mpp = float(node.GetParameter("QuickTCGAEffect,mpp")) / 100 cparams["otsuRatio"] = otsuRatio cparams["curvatureWeight"] = curvatureWeight cparams["sizeThld"] = sizeThld cparams["sizeUpperThld"] = sizeUpperThld cparams["mpp"] = mpp qTCGAMod = vtkSlicerQuickTCGAModuleLogicPython.vtkQuickTCGA() qTCGAMod.SetSourceVol(self.foregroundNode.GetImageData()) qTCGAMod.SetotsuRatio(otsuRatio) qTCGAMod.SetcurvatureWeight(curvatureWeight) qTCGAMod.SetsizeThld(sizeThld) qTCGAMod.SetsizeUpperThld(sizeUpperThld) qTCGAMod.Setmpp(mpp) qTCGAMod.Initialization() self.qTCGAMod = qTCGAMod self.QuickTCGACreated = True #tracks if completed the initializtion (so can do stop correctly) of KSlice
def __init__(self, ctrl, argv=None): QtInterface.__init__(self, ctrl, argv) self._changeset = None self._window = qt.QMainWindow() self._window.setCaption("Smart Package Manager %s" % VERSION) centerWindow(self._window) self._window.setMinimumSize(640, 480) app.connect(app, qt.SIGNAL('lastWindowClosed()'), app, qt.SLOT('quit()')) self._undo = [] self._redo = [] globals = {"self": self, "qt": qt} group = qt.QActionGroup(self._window, "Actions") self._actions = compileActions(group, ACTIONS, globals) class ToggleAction(qt.QAction): def __init__(self, group, name, label): qt.QAction.__init__(self, group, name) self.setToggleAction(True) self.setMenuText(label.replace("&","&&")) self._name = name def connect(self, signal, callback, userdata): self._callback = callback self._userdata = userdata qt.QObject.connect(self, qt.SIGNAL(signal), self.slot) def slot(self): self._callback(self._userdata) self._filters = {} for name, label in [("hide-non-upgrades", _("Hide Non-upgrades")), ("hide-installed", _("Hide Installed")), ("hide-uninstalled", _("Hide Uninstalled")), ("hide-unmarked", _("Hide Unmarked")), ("hide-unlocked", _("Hide Unlocked")), ("hide-requested", _("Hide Requested")), ("hide-old", _("Hide Old"))]: act = ToggleAction(None, name, label) act.connect("activated()", self.toggleFilter, name) self._actions[name] = act treestyle = sysconf.get("package-tree") for name, label in [("groups", _("Groups")), ("channels", _("Channels")), ("channels-groups", _("Channels & Groups")), ("none", _("None"))]: act = ToggleAction(group, "tree-style-"+name, label) if name == treestyle: act.setOn(True) act.connect("activated()", self.setTreeStyle, name) self._actions["tree-style-"+name] = act self._menubar = self._window.menuBar() for MENU in MENUBAR: def insertmenu(menubar, menu): item = menu[0] action = self._actions[item] m = qt.QPopupMenu(menubar) text = action.menuText() menubar.insertItem(text, m) for item in menu[1]: if isinstance(item, tuple): insertmenu(m, item) elif item: action = self._actions[item] #i = qt.QPopupMenu(m) #text = action.menuText() #m.insertItem(text, i) action.addTo(m) else: m.insertSeparator() insertmenu(self._menubar, MENU) self._toolbar = qt.QToolBar(self._window) for TOOL in TOOLBAR: def inserttool(toolbar, tool): if tool: action = self._actions[tool] #b = qt.QToolButton(toolbar, TOOL) #b.setTextLabel(action.toolTip()) pixmap = getPixmap(TOOLBARICONS[tool]) #b.setIconSet(qt.QIconSet(pixmap)) action.setIconSet(qt.QIconSet(pixmap)) action.addTo(toolbar) else: toolbar.addSeparator() inserttool(self._toolbar, TOOL) #self._window.add_accel_group(self._ui.get_accel_group()) self._actions["exec-changes"].setAccel(qt.QKeySequence("Ctrl+C")) self._actions["find"].setAccel(qt.QKeySequence("Ctrl+F")) self._actions["expand-all"].setAccel(qt.QKeySequence("Ctrl+O")) self._actions["collapse-all"].setAccel(qt.QKeySequence("Ctrl+W")) self._actions["summary-window"].setAccel(qt.QKeySequence("Ctrl+S")) self._actions["exec-changes"].setEnabled(False) self._actions["clear-changes"].setEnabled(False) self._actions["undo"].setEnabled(False) self._actions["redo"].setEnabled(False) # Search bar self._searchbar = qt.QToolBar(self._window) self._searchbar.hide() label = qt.QLabel(_("Search:"), self._searchbar) label.show() self._searchentry = qt.QLineEdit(self._searchbar) qt.QObject.connect(self._searchentry, qt.SIGNAL("returnPressed()"), self.refreshPackages) self._searchentry.show() button = qt.QPushButton(self._searchbar) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self.refreshPackages) pixmap = getPixmap("crystal-search") button.setIconSet(qt.QIconSet(pixmap)) button.show() buttongroup = qt.QButtonGroup(self._searchbar) buttongroup.hide() self._searchname = qt.QRadioButton(_("Automatic"), self._searchbar) self._searchname.setChecked(True) qt.QObject.connect(self._searchname, qt.SIGNAL("clicked()"), self.refreshPackages) buttongroup.insert(self._searchname) self._searchname.show() self._searchdesc = qt.QRadioButton(_("Description"), self._searchbar) self._searchdesc.setChecked(False) qt.QObject.connect(self._searchdesc, qt.SIGNAL("clicked()"), self.refreshPackages) self._searchdesc.show() buttongroup.insert(self._searchdesc) # Packages and information self._splitter = qt.QSplitter(qt.Qt.Vertical, self._window) self._window.setCentralWidget(self._splitter) self._pv = QtPackageView(self._splitter) self._pv.show() self._pi = QtPackageInfo(self._splitter) self._pi.show() qt.QObject.connect(self._pv, qt.PYSIGNAL("packageSelected"), self._pi.setPackage) qt.QObject.connect(self._pv, qt.PYSIGNAL("packageActivated"), self.actOnPackages) qt.QObject.connect(self._pv, qt.PYSIGNAL("packagePopup"), self.packagePopup) self._status = self._window.statusBar() self._status.show() self._legend = QtLegend(self._window)
def setup(self): # this is the function that implements all GUI ScriptedLoadableModuleWidget.setup(self) # This sets the view being used to the red view only slicer.app.layoutManager().setLayout( slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #Section 3.2.1: Ultrasound connection ang widgets #the following code provides a GUI to connect to an external ultrasound scanner throught the PlusServer #this section also provides examples of other widgets that can be used #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# ################################################################################################################## #This section creates all the widgets #This is where you will create the type of widget and what it will say ################################################################################################################## #This code block creates a collapsible button #This defines which type of button you are using self.usButton = ctk.ctkCollapsibleButton() #This is what the button will say self.usButton.text = "Ultrasound Connection" #This actually creates that button #This descirbes the type of widget self.inputIPLineEdit = qt.QLineEdit() #This sets a placehoder example of what should be inputted to the line edit self.inputIPLineEdit.setPlaceholderText("127.0.0.1") #This is the help tooltip self.inputIPLineEdit.toolTip = "Put the IP address of your ultrasound device here" #This code block is the exact same as the one above only it asks for the server port self.inputPortLineEdit = qt.QLineEdit() self.inputPortLineEdit.setPlaceholderText("18944") self.inputPortLineEdit.setValidator(qt.QIntValidator()) self.inputPortLineEdit.toolTip = "Put the port ID of the OpenIGTLink here (18944)" #This is a push button self.connectButton = qt.QPushButton() self.connectButton.setDefault(False) #This button says connect self.connectButton.text = "Connect" #help tooltip that explains the funciton self.connectButton.toolTip = "Connects to Ultrasound" #adds the widget to the layout self.freezeButton = qt.QPushButton() self.freezeButton.text = "Freeze" self.freezeButton.toolTip = "Freeze the ultrasound image for fiducial placement" # Combobox for image selection self.imageSelector = slicer.qMRMLNodeComboBox() self.imageSelector.nodeTypes = ["vtkMRMLScalarVolumeNode"] self.imageSelector.selectNodeUponCreation = True self.imageSelector.addEnabled = False self.imageSelector.removeEnabled = False self.imageSelector.noneEnabled = True self.imageSelector.showHidden = False self.imageSelector.showChildNodeTypes = False self.imageSelector.setMRMLScene(slicer.mrmlScene) self.imageSelector.setToolTip("Pick the image to be used.") self.checkBox = qt.QCheckBox() self.checkBox.text = "This is a check box" self.checkBox.toolTip = "This an example check box" #### EXAMPLE: to access the functionality of a check box you can use an if statement #### if self.checkBox.isChecked() == True: self.radioButton = qt.QRadioButton() self.radioButton.text = "This is an example radio button" self.radioButton.toolTip = "This an example radio button" self.sliderWidget = slicer.qMRMLSliderWidget() self.sliderWidget.minimum = 0.00 self.sliderWidget.maximum = 100.00 self.resetButton = qt.QPushButton('Reset') self.resetButton.setDefault(False) self.resetButton.toolTip = "This Button Resets the Module" ################################################################################################################## #This section adds the containers to the parent widget ################################################################################################################## self.layout.addWidget(self.usButton) #This creates a variable that describes layout within this collapsible button self.usLayout = qt.QFormLayout(self.usButton) self.usLayout.addRow("Server IP:", self.inputIPLineEdit) self.usLayout.addRow("Server Port:", self.inputPortLineEdit) self.usLayout.addWidget(self.connectButton) self.usLayout.addRow("US Volume: ", self.imageSelector) self.usLayout.addRow(self.freezeButton) self.shortcut = qt.QShortcut(qt.QKeySequence('f'), slicer.util.mainWindow()) self.usLayout.addRow(self.checkBox) self.usLayout.addRow(self.radioButton) self.usLayout.addRow(self.sliderWidget) # Add vertical spacer self.layout.addStretch(1) ################################################################################################################## #This section connects the widgets to functions ################################################################################################################## self.connectButton.connect('clicked(bool)', self.onConnectButtonClicked) self.freezeButton.connect('clicked(bool)', self.onConnectButtonClicked) self.inputIPLineEdit.connect('textChanged(QString)', self.onInputChanged) self.inputPortLineEdit.connect('textChanged(QString)', self.onInputChanged) self.imageSelector.connect('currentNodeChanged(vtkMRMLNode*)', self.onImageChanged) # Disable buttons until conditions are met self.connectButton.setEnabled(False) self.freezeButton.setEnabled(False)
def __init__(self, FrameParent): self.currentMummyName = "" self.currentExplanation = "" self.frameParent = FrameParent self.frameParent.setLayout(qt.QHBoxLayout()) self.layout = self.frameParent.layout() self.layout.setMargin(0) self.layout.setSpacing(0) moduleDir = os.path.dirname(__file__) uiPath = os.path.join(moduleDir, 'Resources', 'UI', 'MummyInterface.ui') # Load widget from .ui file (created by Qt Designer) self.uiWidget = slicer.util.loadUI(uiPath) self.layout.addWidget(self.uiWidget) self.ui = slicer.util.childWidgetVariables(self.uiWidget) # keyboard "v" shows the control panel shortcutShow = qt.QShortcut(self.frameParent) shortcutShow.setKey(qt.QKeySequence("v")) shortcutShow.connect('activated()', lambda: self.showPanel()) # keyboard "e" hides the control panel shortcutHide = qt.QShortcut(self.frameParent) shortcutHide.setKey(qt.QKeySequence("e")) shortcutHide.connect('activated()', lambda: self.hidePanel()) # Add layout widget self.layoutWidget = slicer.qMRMLLayoutWidget() self.layoutWidget.setMRMLScene(slicer.mrmlScene) self.frameParent.layout().addWidget(self.layoutWidget) self.layoutWidget.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUp3DView) self.threeDWidget = self.layoutWidget.layoutManager().threeDWidget(0) self.threeDWidget.threeDController().setVisible(False) self.threeDView = self.threeDWidget.threeDView() # Set up the Volumen rendering self.volRenLogic = slicer.modules.volumerendering.logic() self.setupCustomPreset() # Set the Default rendering method. They can be: # - vtkMRMLCPURayCastVolumeRenderingDisplayNode (combobox: "VTK CPU Ray Casting" ) # - vtkMRMLGPURayCastVolumeRenderingDisplayNode (combobox: "VTK GPU Ray Casting" ) # - vtkMRMLMultiVolumeRenderingDisplayNode (combobox: "VTK Multi-Volume" ) self.volRenLogic.SetDefaultRenderingMethod("vtkMRMLGPURayCastVolumeRenderingDisplayNode") # set up background color, box, label axis self.setup3DView() self.setupConnections() # Show defaul mummy (Mummy1) self.onLoadMummy1() #Full screen self.frameParent.showFullScreen() self.frameParent.show()