Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createCursor(self, widget):
# Turn off effect-specific cursor for this effect
return slicer.util.mainWindow().cursor
def createCursor(self, widget):
# Turn off effect-specific cursor for this effect
return slicer.util.mainWindow().cursor
widget = lm.viewport()
elif type == slicer.qMRMLScreenShotDialog.ThreeD:
# just the 3D window
widget = lm.threeDWidget(0).threeDView()
elif type == slicer.qMRMLScreenShotDialog.Red:
# red slice window
widget = lm.sliceWidget("Red")
elif type == slicer.qMRMLScreenShotDialog.Yellow:
# yellow slice window
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)
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 onCloseCaseButtonClicked(self):
if not self.session.data.completed:
dialog = qt.QMessageBox(qt.QMessageBox.Question, "SliceTracker", "Do you want to mark this case as completed?", qt.QMessageBox.Yes | qt.QMessageBox.No | qt.QMessageBox.Cancel, slicer.util.mainWindow(), qt.Qt.WindowStaysOnTopHint).exec_()
if dialog == qt.QMessageBox.Yes:
self.session.complete()
elif dialog == qt.QMessageBox.Cancel:
return
if self.session.isRunning():
self.session.close(save=False)