Ejemplo n.º 1
1
    def __init__(self, parent=None):
        ScriptedLoadableModuleWidget.__init__(self, parent)
        settings = qt.QSettings()
        self.developerMode = SlicerUtil.IsDevelopment
        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()

        self.priority = 2
        self.calcificationType = 0
        self.ThresholdMin = 130.0
        self.ThresholdMax = 1000.0
        self.MinimumLesionSize = 1
        self.MaximumLesionSize = 500
        self.croppedVolumeNode = slicer.vtkMRMLScalarVolumeNode()
        self.threshImage = vtk.vtkImageData()
        self.marchingCubes = vtk.vtkDiscreteMarchingCubes()
        self.transformPolyData = vtk.vtkTransformPolyDataFilter()

        self.selectedLabelList = []
        self.labelScores = []
        self.selectedLabels = {}
        self.modelNodes = []
        self.voxelVolume = 1.
        self.sx = 1.
        self.sy = 1.
        self.sz = 1.
        self.selectedRGB = [1,0,0]
        self.observerTags = []
        self.xy = []

        self.summary_reports=["Agatston Score","Mass Score","Volume"]

        self.labelScores = dict()
        self.totalScores=dict()
        for sr in self.summary_reports:
            self.labelScores[sr]=[]
            self.totalScores[sr]=0
              
        self.columnsDict = OrderedDict()
        self.columnsDict["CaseID"] = "CaseID"
        for sr in self.summary_reports:
            self.columnsDict[sr.replace(" ","")]=sr
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        self.testingServer = None

        # state management for compressing events
        # - each time an update is requested, start the singleShot timer
        # - if the update is requested before the timeout, the call to timer.start() resets it
        # - the actual update only happens when the the full time elapses since the last request
        self.updateRecentActivityTimer = qt.QTimer()
        self.updateRecentActivityTimer.setSingleShot(True)
        self.updateRecentActivityTimer.interval = 500
        self.updateRecentActivityTimer.connect(
            'timeout()', self.onUpateRecentActivityRequestTimeout)

        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
            self.layout = self.parent.layout()
            self.setup()
            self.parent.show()
        else:
            self.parent = parent
            self.layout = parent.layout()

        globals()['d'] = self
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        VTKObservationMixin.__init__(self)

        self.editUtil = EditUtil()  # Kept for backward compatibility

        # mrml volume node instances
        self.master = None
        self.masterWhenMergeWasSet = None
        # Editor color LUT
        self.colorNodeID = None
        # string
        self.createMergeOptions = ""
        self.mergeVolumePostfix = "-label"
        # slicer helper class
        self.volumesLogic = slicer.modules.volumes.logic()
        # widgets that are dynamically created on demand
        # pseudo signals
        # - python callable that gets True or False
        self.selectCommand = None

        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
            self.create()
            self.parent.show()
        else:
            self.parent = parent
            self.create()
Ejemplo n.º 4
0
 def __init__(self,
              parent=None,
              parameterNode=None,
              parameter=None,
              colorNode=None,
              selectCommand=None):
     self.colorNode = colorNode
     self.parameterNode = parameterNode
     self.parameter = parameter
     self.selectCommand = selectCommand
     self.recents = []
     self.label = None
     if not parent:
         self.parent = slicer.qMRMLWidget()
         self.parent.setObjectName('EditMRMLWidget')
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
         self.create()
         p = qt.QCursor().pos()
         self.parent.setGeometry(p.x(), p.y(), 300, 700)
         self.parent.show()
         self.parent.raise_()
     else:
         self.parent = parent
         self.create()
Ejemplo n.º 5
0
    def __init__(self, dbTableName, columnsDict, parentWidget = None, dbFilePath=None):
        """
        Widget constructor
        :param dbTableName: name of the table that will store the information of the module
        :param columnsDict: dictionary of colummKey-ColumnDescription (note that column keys cannot contain special
        characters, white spaces, etc.)
        :param parentWidget: widget where this ReportsWidget will be inserted
        :param dbFilePath: full path of the file that will store the database that is using the widget.
                           by default, it will be in the settings folder
        """
        EventsTrigger.__init__(self)
        
        if not parentWidget:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
        else:
            self.parent = parentWidget
        self.layout = self.parent.layout()

        self._showWarningWhenIncompleteColumns_ = True
        self.logic = CaseReportsLogic(dbTableName, columnsDict, dbFilePath=dbFilePath)
        self.__initEvents__()
        self.reportWindow = CaseReportsWindow(self)
        self.reportWindow.objectName = "caseReportsWindow"
Ejemplo n.º 6
0
 def setupEditorWidget(self):
     editorWidgetParent = slicer.qMRMLWidget()
     editorWidgetParent.setLayout(qt.QVBoxLayout())
     editorWidgetParent.setMRMLScene(slicer.mrmlScene)
     self.editorWidget = EditorWidget(parent=editorWidgetParent)
     self.editorWidget.setup()
     self.segmentationGroupBoxLayout.addWidget(self.editorWidget.parent)
Ejemplo n.º 7
0
  def __init__(self, parent=None):
    VTKObservationMixin.__init__(self)

    self.editUtil = EditUtil() # Kept for backward compatibility

    # mrml volume node instances
    self.master = None
    self.masterWhenMergeWasSet = None
    # Editor color LUT
    self.colorNodeID = None
    # string
    self.createMergeOptions = ""
    self.mergeVolumePostfix = "-label"
    # slicer helper class
    self.volumesLogic = slicer.modules.volumes.logic()
    # widgets that are dynamically created on demand
    # pseudo signals
    # - python callable that gets True or False
    self.selectCommand = None

    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
      self.create()
      self.parent.show()
    else:
      self.parent = parent
      self.create()
Ejemplo n.º 8
0
 def setupEditorWidget(self):
   editorWidgetParent = slicer.qMRMLWidget()
   editorWidgetParent.setLayout(qt.QVBoxLayout())
   editorWidgetParent.setMRMLScene(slicer.mrmlScene)
   self.editorWidget = EditorWidget(parent=editorWidgetParent)
   self.editorWidget.setup()
   self.segmentationGroupBoxLayout.addWidget(self.editorWidget.parent)
 def setupEditorWidget(self):
   self.editorWidgetParent = slicer.qMRMLWidget()
   self.editorWidgetParent.setLayout(qt.QVBoxLayout())
   self.editorWidgetParent.setMRMLScene(slicer.mrmlScene)
   self.editUtil = EditorLib.EditUtil.EditUtil()
   self.editorWidget = EditorWidget(parent=self.editorWidgetParent, showVolumesFrame=False)
   self.editorWidget.setup()
   self.editorParameterNode = self.editUtil.getParameterNode()
Ejemplo n.º 10
0
    def __init__(self, parent=None):
        ScriptedLoadableModuleWidget.__init__(self, parent)

        self.chartOptions = ("LAA%-950", "LAA%-925", "LAA%-910", "LAA%-856",
                             "HAA%-700", "HAA%-600", "HAA%-500", "HAA%-250",
                             "Perc10", "Perc15", "Mean", "Std", "Kurtosis",
                             "Skewness", "Ventilation Heterogeneity", "Mass",
                             "Volume")

        # Build the column keys. Here all the columns are declared, but an alternative could be just:
        #self.columnsDict = CaseReportsWidget.getColumnKeysNormalizedDictionary(["Volume Name", "Region", "LAA%-950", ...])
        self.columnsDict = OrderedDict()
        self.columnsDict["VolumeName"] = "Volume Name"
        self.columnsDict["Region"] = "Region"
        self.columnsDict["LAA950"] = "LAA%-950"
        self.columnsDict["LAA925"] = "LAA%-925"
        self.columnsDict["LAA910"] = "LAA%-910"
        self.columnsDict["LAA856"] = "LAA%-856"
        self.columnsDict["HAA700"] = "HAA%-700"
        self.columnsDict["HAA600"] = "HAA%-600"
        self.columnsDict["HAA500"] = "HAA%-500"
        self.columnsDict["HAA250"] = "HAA%-250"
        self.columnsDict["Perc10"] = "Perc10"
        self.columnsDict["Perc15"] = "Perc15"
        self.columnsDict["Mean"] = "Mean"
        self.columnsDict["Std"] = "Std"
        self.columnsDict["Kurtosis"] = "Kurtosis"
        self.columnsDict["Skewness"] = "Skewness"
        self.columnsDict[
            "VentilationHeterogeneity"] = "Ventilation Heterogeneity"
        self.columnsDict["Mass"] = "Mass"
        self.columnsDict["Volume"] = "Volume"

        self.rTags = ("WholeLung", "RightLung", "LeftLung", "RUL", "RLL",
                      "RML", "LUL", "LLL", "LUT", "LMT", "LLT", "RUT", "RMT",
                      "RLT")
        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
        else:
            self.parent = parent
        self.logic = None
        self.CTNode = None
        self.labelNode = None
        # self.expNode = None
        # self.explabelNode = None
        self.fileName = None
        self.fileDialog = None

        if not parent:
            self.setup()
            self.CTSelector.setMRMLScene(slicer.mrmlScene)
            # self.expSelector.setMRMLScene(slicer.mrmlScene)
            self.labelSelector.setMRMLScene(slicer.mrmlScene)
            # self.explabelSelector.setMRMLScene(slicer.mrmlScene)
            self.parent.show()
Ejemplo n.º 11
0
 def create(self):
   if not self.parent:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.parent.show()
   self.frame = qt.QFrame(self.parent)
   self.frame.setLayout(qt.QVBoxLayout())
   self.parent.layout().addWidget(self.frame)
   self.widgets.append(self.frame)
Ejemplo n.º 12
0
 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()
 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()
Ejemplo n.º 14
0
 def __init__(self, parent = 0):
   self.observerTags = []
   self.parameterNode = None
   self.parameterNodeTag = None
   if parent == 0:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.create()
     self.parent.show()
   else:
     self.parent = parent
     self.create()
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        self.observerTags = []
        self.logic = SampleDataLogic(self.logMessage)

        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
            self.layout = self.parent.layout()
            self.setup()
            self.parent.show()
        else:
            self.parent = parent
            self.layout = parent.layout()
Ejemplo n.º 16
0
 def __init__(self, parent=None):
     ScriptedLoadableModuleWidget.__init__(self, parent)
     self.logic = CIP_InteractiveLobeSegmentationLogic()
     self.observerTags = []
     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()
Ejemplo n.º 17
0
  def __init__(self, parent=None):
    self.observerTags = []
    self.logic = SampleDataLogic(self.logMessage)

    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
      self.layout = self.parent.layout()
      self.setup()
      self.parent.show()
    else:
      self.parent = parent
      self.layout = parent.layout()
Ejemplo n.º 18
0
  def __init__(self, parent=None):
    self.logic = SelfTestsLogic(slicer.selfTests)

    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
      self.layout = self.parent.layout()
      self.setup()
      self.parent.show()
    else:
      self.parent = parent
      self.layout = parent.layout()

    globals()['selfTests'] = self
  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()

    self.logic = SteeredPolyAffineRegistrationLogic()

    self.interaction = False
Ejemplo n.º 20
0
 def __init__(self, parent=0, parameter='label', colorNode=None):
     VTKObservationMixin.__init__(self)
     self.parameterNode = None
     self.parameterNodeTag = None
     self.parameter = parameter
     self.colorBox = None
     self.colorNode = colorNode
     if parent == 0:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
         self.create()
         self.parent.show()
     else:
         self.parent = parent
         self.create()
Ejemplo n.º 21
0
 def __init__(self, parent=0, parameter='label',colorNode=None):
   VTKObservationMixin.__init__(self)
   self.parameterNode = None
   self.parameterNodeTag = None
   self.parameter = parameter
   self.colorBox = None
   self.colorNode = colorNode
   if parent == 0:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.create()
     self.parent.show()
   else:
     self.parent = parent
     self.create()
Ejemplo n.º 22
0
 def __init__(self, parent=0, parameter='label'):
     self.observerTags = []
     self.parameterNode = None
     self.parameterNodeTag = None
     self.parameter = parameter
     self.editUtil = EditUtil.EditUtil()
     self.colorBox = None
     if parent == 0:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
         self.create()
         self.parent.show()
     else:
         self.parent = parent
         self.create()
Ejemplo n.º 23
0
  def __init__( self, parent=None ):
    print "running something"  
    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()
      
    if slicer.mrmlScene.GetTagByClassName( "vtkMRMLScriptedModuleNode" ) != 'ScriptedModule':
      slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
Ejemplo n.º 24
0
 def __init__(self, parent=0, parameter='label'):
   self.observerTags = []
   self.parameterNode = None
   self.parameterNodeTag = None
   self.parameter = parameter
   self.editUtil = EditUtil.EditUtil()
   self.colorBox = None
   if parent == 0:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.create()
     self.parent.show()
   else:
     self.parent = parent
     self.create()
Ejemplo n.º 25
0
 def __init__(self, parent = None):
   # Get module name by stripping 'Widget' from the class name
   self.moduleName = self.__class__.__name__
   if self.moduleName.endswith('Widget'):
     self.moduleName = self.moduleName[:-6]
   settings = qt.QSettings()
   self.developerMode = settings.value('Developer/DeveloperMode').lower() == 'true'
   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()
Ejemplo n.º 26
0
 def __init__(self, parent=None):
     ScriptedLoadableModuleWidget.__init__(self, parent)
     settings = qt.QSettings()
     self.developerMode = settings.value(
         'Developer/DeveloperMode').lower() == 'true'
     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()
     self.roiManager = None
     self.ROIRadius = 20.0
Ejemplo n.º 27
0
 def __init__(self, parent=None):
     # Get module name by stripping 'Widget' from the class name
     self.moduleName = self.__class__.__name__
     if self.moduleName.endswith('Widget'):
         self.moduleName = self.moduleName[:-6]
     self.developerMode = slicer.util.settingsValue(
         'Developer/DeveloperMode', False, lambda v: v.lower() == 'true')
     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()
Ejemplo n.º 28
0
 def create(self,registrationState):
   """Call this method from your subclass to manage dynamic layout
   and widget deleting
   - registrationState is a callable object that will give you an instance
   of a RegistrationState object that you can use to determine the current
   state of the fixed, moving, and other parameters of the parent gui.
   """
   self.registrationState = registrationState
   if not self.parent:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.parent.show()
   self.frame = qt.QFrame(self.parent)
   self.frame.objectName = 'EditOptionsFrame'
   self.frame.setLayout(qt.QVBoxLayout())
   self.parent.layout().addWidget(self.frame)
   self.widgets.append(self.frame)
Ejemplo n.º 29
0
 def __init__(self, parent=None):
   self.chartOptions = ("Count", "Volume mm^3", "Volume cc", "Min", "Max", "Mean", "StdDev")
   if not parent:
     self.parent = slicer.qMRMLWidget()
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
   else:
     self.parent = parent
   self.logic = None
   self.grayscaleNode = None
   self.labelNode = None
   self.fileName = None
   self.fileDialog = None
   if not parent:
     self.setup()
     self.grayscaleSelector.setMRMLScene(slicer.mrmlScene)
     self.labelSelector.setMRMLScene(slicer.mrmlScene)
     self.parent.show()
Ejemplo n.º 30
0
 def __init__(self, parent=None):
     # Get module name by stripping 'Widget' from the class name
     self.moduleName = self.__class__.__name__
     if self.moduleName.endswith('Widget'):
         self.moduleName = self.moduleName[:-6]
     self.developerMode = slicer.util.settingsValue(
         'Developer/DeveloperMode', False, converter=slicer.util.toBool)
     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()
     slicer.app.moduleManager().connect('moduleAboutToBeUnloaded(QString)',
                                        self._onModuleAboutToBeUnloaded)
Ejemplo n.º 31
0
 def __init__(self, parent=None):
     self.chartOptions = ("Count", "Volume mm^3", "Volume cc", "Min", "Max",
                          "Mean", "StdDev")
     if not parent:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
     else:
         self.parent = parent
     self.logic = None
     self.grayscaleNode = None
     self.labelNode = None
     self.fileName = None
     self.fileDialog = None
     if not parent:
         self.setup()
         self.grayscaleSelector.setMRMLScene(slicer.mrmlScene)
         self.labelSelector.setMRMLScene(slicer.mrmlScene)
         self.parent.show()
Ejemplo n.º 32
0
 def __init__(self, parent=None, parameterNode=None, parameter=None, colorNode=None, selectCommand=None):
   self.colorNode = colorNode
   self.parameterNode = parameterNode
   self.parameter = parameter
   self.selectCommand = selectCommand
   self.recents = []
   self.label = None
   if not parent:
     self.parent = slicer.qMRMLWidget()
     self.parent.setObjectName('EditMRMLWidget')
     self.parent.setLayout(qt.QVBoxLayout())
     self.parent.setMRMLScene(slicer.mrmlScene)
     self.create()
     p = qt.QCursor().pos()
     self.parent.setGeometry(p.x(), p.y(), 300, 700)
     self.parent.show()
     self.parent.raise_()
   else:
     self.parent = parent
     self.create()
Ejemplo n.º 33
0
    def __init__(self, parent=None, showVolumesFrame=True):
        VTKObservationMixin.__init__(self)
        self.shortcuts = []
        self.toolsBox = None

        # set attributes from ctor parameters
        self.showVolumesFrame = showVolumesFrame

        self.editUtil = EditUtil()  # Kept for backward compatibility

        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
            self.layout = self.parent.layout()
        else:
            self.parent = parent
            self.layout = parent.layout()

        ScriptedLoadableModuleWidget.__init__(self, parent)
Ejemplo n.º 34
0
  def __init__(self, parent=None, showVolumesFrame=True):
    VTKObservationMixin.__init__(self)
    self.shortcuts = []
    self.toolsBox = None

    # set attributes from ctor parameters
    self.showVolumesFrame = showVolumesFrame

    self.editUtil = EditUtil() # Kept for backward compatibility

    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
      self.layout = self.parent.layout()
    else:
      self.parent = parent
      self.layout = parent.layout()

    ScriptedLoadableModuleWidget.__init__(self, parent)
Ejemplo n.º 35
0
 def __init__(self, parent = None):
   """If parent widget is not specified: a top-level widget is created automatically;
   the application has to delete this widget (by calling widget.parent.deleteLater() to avoid memory leaks.
   """
   # Get module name by stripping 'Widget' from the class name
   self.moduleName = self.__class__.__name__
   if self.moduleName.endswith('Widget'):
     self.moduleName = self.moduleName[:-6]
   self.developerMode = slicer.util.settingsValue('Developer/DeveloperMode', False, converter=slicer.util.toBool)
   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()
   slicer.app.moduleManager().connect(
     'moduleAboutToBeUnloaded(QString)', self._onModuleAboutToBeUnloaded)
Ejemplo n.º 36
0
 def __init__(self, parent = None):
   """If parent widget is not specified: a top-level widget is created automatically;
   the application has to delete this widget (by calling widget.parent.deleteLater() to avoid memory leaks.
   """
   # Get module name by stripping 'Widget' from the class name
   self.moduleName = self.__class__.__name__
   if self.moduleName.endswith('Widget'):
     self.moduleName = self.moduleName[:-6]
   self.developerMode = slicer.util.settingsValue('Developer/DeveloperMode', False, converter=slicer.util.toBool)
   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()
   slicer.app.moduleManager().connect(
     'moduleAboutToBeUnloaded(QString)', self._onModuleAboutToBeUnloaded)
Ejemplo n.º 37
0
 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()
   self.cameraNode = None
   self.cameraNodeObserverTag = None
   self.cameraObserverTag= None
   # Flythough variables
   self.transform = None
   self.path = None
   self.camera = None
   self.skip = 0
   self.timer = qt.QTimer()
   self.timer.setInterval(20)
   self.timer.connect('timeout()', self.flyToNext)
   if not parent:
     self.setup()
     self.cameraNodeSelector.setMRMLScene(slicer.mrmlScene)
     self.inputFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)
     self.parent.show()
Ejemplo n.º 38
0
 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()
     self.cameraNode = None
     self.cameraNodeObserverTag = None
     self.cameraObserverTag = None
     # Flythough variables
     self.transform = None
     self.path = None
     self.camera = None
     self.skip = 0
     self.timer = qt.QTimer()
     self.timer.setInterval(20)
     self.timer.connect('timeout()', self.flyToNext)
     if not parent:
         self.setup()
         self.cameraNodeSelector.setMRMLScene(slicer.mrmlScene)
         self.inputFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)
         self.parent.show()
Ejemplo n.º 39
0
  def __init__(self, parent=None):
    self.testingServer = None

    # state management for compressing events
    # - each time an update is requested, start the singleShot timer
    # - if the update is requested before the timeout, the call to timer.start() resets it
    # - the actual update only happens when the the full time elapses since the last request
    self.updateRecentActivityTimer = qt.QTimer()
    self.updateRecentActivityTimer.singleShot = True
    self.updateRecentActivityTimer.interval = 500
    self.updateRecentActivityTimer.connect('timeout()', self.onUpateRecentActivityRequestTimeout)

    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout(qt.QVBoxLayout())
      self.parent.setMRMLScene(slicer.mrmlScene)
      self.layout = self.parent.layout()
      self.setup()
      self.parent.show()
    else:
      self.parent = parent
      self.layout = parent.layout()

    globals()['d'] = self
Ejemplo n.º 40
0
    def __init__(self, parent = None):
        """ 
        Init function.
        @param parent: The parent widget to attach to.
        @type parent: qt.QWidget
        """
        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
            self.parent.setMRMLScene(slicer.mrmlScene)
        else:
            self.parent = parent
        if not parent:
            self.setup()
            self.parent.show()

        self.XnatIo = None 
        self.layout = self.parent.layout()

        XnatSlicerUtils.constructNecessaryModuleDirectories()

        self.__collapseDataProbe()
        self.__initComponents()
        self.__addObservers()
Ejemplo n.º 41
0
    def __init__(self, parent=None):
        ScriptedLoadableModuleWidget.__init__(self, parent)
        settings = qt.QSettings()
        self.developerMode = settings.value('Developer/DeveloperMode').lower() == 'true'
        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()

        self.priority = 2
        self.calcinationType = 0
        self.ThresholdMin = 130.0
        self.ThresholdMax = 2000.0
        self.MinimumLesionSize = 1
        self.MaximumLesionSize = 2000
        self.croppedVolumeNode = slicer.vtkMRMLScalarVolumeNode()
        self.threshImage = vtk.vtkImageData()
        self.marchingCubes = vtk.vtkDiscreteMarchingCubes()
        self.transformPolyData = vtk.vtkTransformPolyDataFilter()

        self.selectedLableList = []
        self.labelScores = []
        self.selectedLables = {}
        self.modelNodes = []
        self.voxelVolume = 1
        self.selectedRGB = [1,0,0]
        self.observerTags = []
        self.xy = []

        self.totalScore = 0
Ejemplo n.º 42
0
  def setup(self):
    ScriptedLoadableModuleWidget.setup(self)

    # Instantiate and connect widgets ...

    #
    # Format Scene Area
    #
    loadGroupBox = ctk.ctkCollapsibleGroupBox()
    loadGroupBox.setTitle('Sequence Data')
    self.layout.addWidget(loadGroupBox)
    loadGroupBoxLayout = qt.QFormLayout(loadGroupBox)
    
    self.volumeSequenceComboBox = slicer.qMRMLNodeComboBox()
    self.volumeSequenceComboBox.nodeTypes = ( ("vtkMRMLSequenceNode"), "" )
    self.volumeSequenceComboBox.setMRMLScene( slicer.mrmlScene )
    self.volumeSequenceComboBox.noneEnabled = False
    loadGroupBoxLayout.addRow('Volume Sequence: ',self.volumeSequenceComboBox)
    
    self.transformSequenceComboBox = slicer.qMRMLNodeComboBox()
    self.transformSequenceComboBox.nodeTypes = ( ("vtkMRMLSequenceNode"), "" )
    self.transformSequenceComboBox.selectNodeUponCreation = False
    self.transformSequenceComboBox.setMRMLScene( slicer.mrmlScene )
    self.transformSequenceComboBox.noneEnabled = True
    loadGroupBoxLayout.addRow('Transform Sequence: ',self.transformSequenceComboBox)
    
    self.labelSequenceComboBox = slicer.qMRMLNodeComboBox()
    self.labelSequenceComboBox.nodeTypes = ( ("vtkMRMLSequenceNode"), "" )
    self.labelSequenceComboBox.selectNodeUponCreation = False
    self.labelSequenceComboBox.setMRMLScene( slicer.mrmlScene )
    self.labelSequenceComboBox.noneEnabled = True
    loadGroupBoxLayout.addRow('Label Sequence: ',self.labelSequenceComboBox)
    
    sliceButtonsLayout = qt.QHBoxLayout()
    loadGroupBoxLayout.addRow('Slice Views: ',sliceButtonsLayout)
    self.axialCheckbox = qt.QCheckBox('Axial')
    self.axialCheckbox.checked = True
    sliceButtonsLayout.addWidget(self.axialCheckbox)
    self.sagittalCheckBox = qt.QCheckBox('Sagittal')
    self.sagittalCheckBox.checked = True
    sliceButtonsLayout.addWidget(self.sagittalCheckBox)
    self.coronalCheckBox = qt.QCheckBox('Coronal')
    self.coronalCheckBox.checked = False
    sliceButtonsLayout.addWidget(self.coronalCheckBox)
    
    formatSceneButton = qt.QPushButton('Format Scene')
    loadGroupBoxLayout.addRow('',formatSceneButton)
    
    #
    # Editor Widget
    #
    editorWidget = slicer.modules.editor.widgetRepresentation().self()
    self.labelEditor = editorWidget.editLabelMapsFrame
    self.layout.addWidget(self.labelEditor)
    self.labelEditor.collapsed = False
    
    
    # add vertical spacer
    self.layout.addStretch(1)
    
    #
    # Format Scene Widget
    #
    self.formatSceneWidget = slicer.qMRMLWidget()
    self.formatSceneWidget.setWindowTitle('Format Scene View')
    self.formatSceneWidgetLayout = qt.QGridLayout(self.formatSceneWidget)
    nodeSelectionRegion = qt.QGroupBox()
    self.formatSceneWidgetLayout.addWidget(nodeSelectionRegion,1,1,4,1)
    nodeSelectionRegion.setTitle('Data Selection')
    nodeSelectionLayout = qt.QVBoxLayout(nodeSelectionRegion)
    volumeSelectionLabel = qt.QLabel('Volume Data')
    nodeSelectionLayout.addWidget(volumeSelectionLabel)
    volumeSelectionList = slicer.qMRMLListWidget()
    nodeSelectionLayout.addWidget(volumeSelectionList)
    
    transformSelectionLabel = qt.QLabel('Transforms')
    nodeSelectionLayout.addWidget(transformSelectionLabel)
    transformSelectionList = slicer.qMRMLListWidget()
    nodeSelectionLayout.addWidget(transformSelectionList)
    
    addToSceneArrow = ctk.ctkPushButton()
    self.formatSceneWidgetLayout.addWidget(addToSceneArrow,2,2,1,1)
    removeFromSceneArrow = ctk.ctkPushButton()
    self.formatSceneWidgetLayout.addWidget(removeFromSceneArrow,3,2,1,1)
    
    organizeSceneRegion = qt.QGroupBox()
    self.formatSceneWidgetLayout.addWidget(organizeSceneRegion,1,3,4,5)
    organizeSceneRegion.setTitle('Scene Format')
    self.organizeSceneRegionLayout = qt.QGridLayout(organizeSceneRegion)
    self.backgroundSceneButtons = []
    backgroundVolumeBox = qt.QPushButton('Background')
    backgroundVolumeBox.setCheckable(True)
    #backgroundVolumeBox.connect('toggled(bool)',self.testClick)
    
    self.organizeSceneRegionLayout.addWidget(backgroundVolumeBox,1,1,1,1)
    self.backgroundSceneButtons.append(backgroundVolumeBox)
    
    self.foregroundSceneButtons = []
    foregroundVolumeBox = qt.QPushButton('Foreground')
    foregroundVolumeBox.setCheckable(True)
    self.organizeSceneRegionLayout.addWidget(foregroundVolumeBox,2,1,1,1)
    #foregroundVolumeBox.connect('toggled(bool)',self.testClick)
    backgroundVolumeBox.connect('clicked()',lambda i=1: self.backgroundButtonClicked(i))
    foregroundVolumeBox.connect('clicked()',lambda i=1: self.foregroundButtonClicked(i))
    
    self.backgroundSceneButtons.append(backgroundVolumeBox)
    self.foregroundSceneButtons.append(foregroundVolumeBox)
    #self.backgroundSceneButtons[0].connect('clicked(bool)', self.backgroundButtonClicked(1))
    #self.foregroundSceneButtons[0].connect('clicked(bool)', self.foregroundButtonClicked(1))
    
    self.addColumnButton = qt.QPushButton('+Add')
    self.organizeSceneRegionLayout.addWidget(self.addColumnButton,1,2,1,1)
    self.sceneColumns = 1
    
    loadFormattedSceneButton = qt.QPushButton('Load Scene')
    self.formatSceneWidgetLayout.addWidget(loadFormattedSceneButton,5,8,1,1)
    

    # connections
    formatSceneButton.connect('clicked(bool)', self.onFormatSceneButtonClicked)
    self.addColumnButton.connect('clicked(bool)', self.onAddColumn)
Ejemplo n.º 43
0
 def __initSettingsFile(self):
   """
   """
   self.SettingsFile = SettingsFile(slicer.qMRMLWidget(), 
                 XnatSlicerGlobals.LOCAL_URIS['settings'], self)