Example #1
0
    def __init__(self, parent=None):
        self.moduleName = 'Workflow'
        self._layouts = []
        self.maximumNumberOfInput = 3
        self._CurrentViewID = 1

        self._CurrentViewNodes = {}
        for i in range(1, self.maximumNumberOfInput + 1):
            subDictionnary = {
                'Background': '',
                'Foreground': '',
                'Label': '',
            }
            self._CurrentViewNodes['Input%i' % i] = subDictionnary

        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._setupLayouts()
Example #2
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 __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()

    jsonFiles = glob(SimpleFilters.JSON_DIR+"*.json")
    jsonFiles.sort(cmp=lambda x,y: cmp(os.path.basename(x), os.path.basename(y)))

    self.jsonFilters = []

    for fname in jsonFiles:
      try:
        fp = file(fname, "r")
        j = json.load(fp,object_pairs_hook=OrderedDict)
        if j["name"] in dir(sitk):
          self.jsonFilters.append(j)
        else:
          import sys
          sys.stderr.write("Unknown SimpleITK class \"{0}\".\n".format(j["name"]))
      except Exception as e:
        import sys
        sys.stderr.write("Error while reading \"{0}\". Exception: {1}\n".format(fname, e))


    self.filterParameters = None
    self.logic = None
Example #4
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()
   
   self.fileDialog = None
   
   # Initialize Data Nodes List
   self.inputDataNodes = []
   
   # use OrderedDict for class-specific dictionary of function calls
   # map feature class to list of features
   self.featureClassKeys = collections.OrderedDict()
   self.featureClassKeys["Node Information"] = ["Node"]
   self.featureClassKeys["First-Order Statistics"] = ["Voxel Count", "Gray Levels", "Energy", "Entropy" , "Minimum Intensity", "Maximum Intensity", "Mean Intensity", "Median Intensity", "Range", "Mean Deviation", "Root Mean Square",  "Standard Deviation", "Skewness", "Kurtosis", "Variance", "Uniformity"]
   self.featureClassKeys["Morphology and Shape"] = ["Volume mm^3", "Volume cc", "Surface Area mm^2", "Surface:Volume Ratio", "Compactness 1", "Compactness 2", "Maximum 3D Diameter", "Spherical Disproportion", "Sphericity"]  
   self.featureClassKeys["Texture: GLCM"] = ["Autocorrelation", "Cluster Prominence", "Cluster Shade", "Cluster Tendency", "Contrast", "Correlation", "Difference Entropy", "Dissimilarity", "Energy (GLCM)", "Entropy(GLCM)", "Homogeneity 1", "Homogeneity 2", "IMC1", "IDMN", "IDN", "Inverse Variance", "Maximum Probability", "Sum Average", "Sum Entropy", "Sum Variance", "Variance (GLCM)"] #IMC2 missing
   self.featureClassKeys["Texture: GLRL"] = ["SRE", "LRE", "GLN", "RLN", "RP", "LGLRE", "HGLRE", "SRLGLE", "SRHGLE", "LRLGLE", "LRHGLE"]   
   self.featureClassKeys["Geometrical Measures"] = ["Extruded Surface Area", "Extruded Volume", "Extruded Surface:Volume Ratio"]
   self.featureClassKeys["Renyi Dimensions"] = ["Box-Counting Dimension", "Information Dimension", "Correlation Dimension"]
   
   # used to map feature class to a list of auto-generated feature checkbox widgets
   self.featureWidgets = collections.OrderedDict()
   for key in self.featureClassKeys.keys():
     self.featureWidgets[key] = list()   
  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()

    pathToJSON = os.path.dirname(os.path.realpath(__file__)) + '/Resources/json/'
    # need to hit reload to get correct file
    print("pathToJSON: ",pathToJSON)
    print(__file__)

    jsonFiles = glob(pathToJSON+"*.json")

    self.jsonFilters = []
  
    for fname in jsonFiles:
      try:
        fp = file(fname, "r")
        j = json.load(fp,object_pairs_hook=OrderedDict)
        self.jsonFilters.append(j)
      except:
        print "Error while reading $1", fname
    
    self.filterParameters = None
    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()

        # this flag is 1 if there is an update in progress
        self.__updating = 1

        # the pointer to the logic
        self.__logic = None

        if not parent:
            self.setup()
            self.__inputVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__seedFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__vesselnessVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__outputVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__outputModelNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__stopperFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)
            # after setup, be ready for events
            self.__updating = 0

            self.parent.show()

        # register default slots
        self.parent.connect('mrmlSceneChanged(vtkMRMLScene*)',
                            self.onMRMLSceneChanged)
  def __init__(self, parent = None, rootDir = None, MODULE = None):    
    """ 
    Init function.

    @param parent: The parent qt.QWidget of the settings file.
    @type parent: qt.QWidget

    @param rootDir: The root directory where to store the settings file.
    @type rootDir:  str

    @param MODULE: The XNAT Slicer module.
    @type MODULE: XNATSlicerWidget
    """

    if not parent:
      self.parent = slicer.qMRMLWidget()
    else:
      self.parent = parent   
    self.Events = MokaUtils.Events(self.EVENT_TYPES)
    self.MODULE = MODULE
    self.filepath = os.path.join(rootDir, self.FILE_PREFIX + self.FILE_SUFFIX)

    #--------------------
    # OS specific database settings
    #--------------------
    self.dbFormat = qt.QSettings.IniFormat 
    self.__resetDatabase()
    self.defaultHosts = {'Central': 'https://central.xnat.org', 
                         'CNDA': 'https://cnda.wustl.edu'}  
    self.setup()
    self.currErrorMessage = ""
    slicer.app.processEvents()
Example #8
0
    def __init__(self,
                 parent=None,
                 embedded=False,
                 suppliedEffects=[],
                 showVolumesFrame=True):
        self.observerTags = []

        # set attributes from ctor parameters
        self.embedded = embedded
        self.suppliedEffects = suppliedEffects
        self.showVolumesFrame = showVolumesFrame
        # TODO: figure out why module/class hierarchy is different
        # between developer builds ans packages
        try:
            # for developer build...
            self.editUtil = EditorLib.EditUtil.EditUtil()
        except AttributeError:
            # for release package...
            self.editUtil = EditorLib.EditUtil()

        #->> check to make sure it works with a supplied parent
        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()
            #self.setup()
            if self.embedded:
                self.setup()
Example #9
0
  def __init__(self, parent = None):
    self.moduleName = 'Workflow'
    self._layouts = []
    self.maximumNumberOfInput = 3
    self._CurrentViewID = 1

    self._CurrentViewNodes = {}
    for i in range(1, self.maximumNumberOfInput + 1):
      subDictionnary = {
        'Background' : '',
        'Foreground' : '',
        'Label' : '',
        }
      self._CurrentViewNodes['Input%i' %i] = subDictionnary

    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._setupLayouts()
 def __init__(self, parent=None, test=False):
     logFile = os.path.join(os.environ['TMPDIR'], "DerivedImageQAWidget" + '.log')
     logging.basicConfig(filename=logFile,
                         level=logging.DEBUG,
                         format='%(module)s.%(funcName)s - %(levelname)s: %(message)s')
     self.logging = logging.getLogger(__name__)
     self.images = ('t2_average', 't1_average') # T1 is second so that reviewers see it as background for regions
     self.regions = ('labels_tissue',
                     'caudate_left', 'caudate_right',
                     'accumben_left', 'accumben_right',
                     'putamen_left', 'putamen_right',
                     'globus_left', 'globus_right',
                     'thalamus_left', 'thalamus_right',
                     'hippocampus_left', 'hippocampus_right')
     self.currentSession = None
     self.imageQAWidget = None
     self.navigationWidget = None
     self.followUpDialog = None
     self.notes = None
     # Handle the UI display with/without Slicer
     if parent is None and not test:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
         self.layout = self.parent.layout()
         self.logic = DerivedImageQALogic(self)
         self.setup()
         self.parent.show()
     elif not test:
         self.parent = parent
         self.layout = self.parent.layout()
         self.logic = DerivedImageQALogic(self, test=test)
     elif test:
         self.logic = DerivedImageQALogic(self, test=test)
Example #11
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()
Example #12
0
    def createUserInterface(self):
        """ This step is mostly empty. A volume rendering threshold is added to be useful.
		"""

        self.__layout = self.__parent.createUserInterface()

        self.__threshRange = slicer.qMRMLRangeWidget()
        self.__threshRange.decimals = 0
        self.__threshRange.singleStep = 1
        self.__threshRange.connect('valuesChanged(double,double)',
                                   self.onThresholdChanged)
        qt.QTimer.singleShot(0, self.killButton)

        ThreshGroupBox = qt.QGroupBox()
        ThreshGroupBox.setTitle('3D Visualization Intensity Threshold')
        ThreshGroupBoxLayout = qt.QFormLayout(ThreshGroupBox)
        ThreshGroupBoxLayout.addRow(self.__threshRange)
        self.__layout.addRow(ThreshGroupBox)

        editorWidgetParent = slicer.qMRMLWidget()
        editorWidgetParent.setLayout(qt.QVBoxLayout())
        editorWidgetParent.setMRMLScene(slicer.mrmlScene)
        self.__editorWidget = EditorWidget(parent=editorWidgetParent)
        self.__editorWidget.setup()
        self.__layout.addRow(editorWidgetParent)
        self.hideUnwantedEditorUIElements()

        RestartGroupBox = qt.QGroupBox()
        RestartGroupBox.setTitle('Restart')
        RestartGroupBoxLayout = qt.QFormLayout(RestartGroupBox)

        self.__RestartButton = qt.QPushButton('Return to Step 1')
        RestartGroupBoxLayout.addRow(self.__RestartButton)

        self.__RemoveCroppedSubtractionMap = qt.QCheckBox()
        self.__RemoveCroppedSubtractionMap.checked = True
        self.__RemoveCroppedSubtractionMap.setToolTip(
            "Delete the cropped version of your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete cropped subtraction map: ",
                                     self.__RemoveCroppedSubtractionMap)

        self.__RemoveFullSubtracitonMap = qt.QCheckBox()
        self.__RemoveFullSubtracitonMap.checked = True
        self.__RemoveFullSubtracitonMap.setToolTip(
            "Delete the full version of your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete full subtraction map: ",
                                     self.__RemoveFullSubtracitonMap)

        self.__RemoveROI = qt.QCheckBox()
        self.__RemoveROI.checked = False
        self.__RemoveROI.setToolTip(
            "Delete the ROI resulting from your subtaction map.")
        RestartGroupBoxLayout.addRow("Delete ROI: ", self.__RemoveROI)

        # self.__RestartButton.setEnabled(0)

        self.__RestartButton.connect('clicked()', self.Restart)
        self.__RestartActivated = True

        self.__layout.addRow(RestartGroupBox)
Example #13
0
  def __init__(self, parent=None):
    self.testingServer = None
    self.dicomBrowser = None

    # options for browser
    self.browserPersistent = False

    # TODO: are these wrapped so we can avoid magic numbers?
    self.dicomModelUIDRole = 32
    self.dicomModelTypeRole = self.dicomModelUIDRole + 1
    self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')

    # 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
Example #14
0
    def __init__(self, parent=None):
        if not parent:
            self.parent = slicer.qMRMLWidget()
            self.parent.setLayout(qt.QVBoxLayout())
        else:
            self.parent = parent

        self.layout = self.parent.layout()

        # this flag is 1 if there is an update in progress
        self.__updating = 1

        self.__mvNode = None
        self.extractFrame = False

        # chart view node
        self.__cvn = None

        # data node
        #slicer.mrmlScene.AddNode(slicer.vtkMRMLDoubleArrayNode())

        # chart node
        self.__cn = slicer.vtkMRMLChartNode()
        self.__cn.SetScene(slicer.mrmlScene)
        slicer.mrmlScene.AddNode(self.__cn)

        # image play setup
        self.timer = qt.QTimer()
        self.timer.setInterval(50)
        self.timer.connect('timeout()', self.goToNext)
Example #15
0
  def __init__(self, parent=None, showVolumesFrame=True):
    self.observerTags = []
    self.shortcuts = []
    self.toolsBox = None

    # set attributes from ctor parameters
    self.showVolumesFrame = showVolumesFrame
    # TODO: figure out why module/class hierarchy is different
    # between developer builds ans packages
    try:
      # for developer build...
      self.editUtil = EditorLib.EditUtil.EditUtil()
    except AttributeError:
      # for release package...
      self.editUtil = EditorLib.EditUtil()

    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()
  def __init__( self, parent=None ):
    if not parent:
      self.parent = slicer.qMRMLWidget()
      self.parent.setLayout( qt.QVBoxLayout() )
    else:
      self.parent = parent

    self.layout = self.parent.layout()

    # this flag is 1 if there is an update in progress
    self.__updating = 1

    self.__mvNode = None
    self.extractFrame = False

    # chart view node
    self.__cvn = None

    # data node
    #slicer.mrmlScene.AddNode(slicer.vtkMRMLDoubleArrayNode())

    # chart node
    self.__cn = slicer.vtkMRMLChartNode()
    self.__cn.SetScene(slicer.mrmlScene)
    slicer.mrmlScene.AddNode(self.__cn)

    # image play setup
    self.timer = qt.QTimer()
    self.timer.setInterval(50)
    self.timer.connect('timeout()', self.goToNext)
Example #17
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()
    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()

        # this flag is 1 if there is an update in progress
        self.__updating = 1

        # the pointer to the logic and the mrmlManager
        self.__mrmlManager = None
        self.__logic = None

        if not parent:
            self.setup()

            # after setup, be ready for events
            self.__updating = 0

            self.parent.show()

        if slicer.mrmlScene.GetTagByClassName(
                "vtkMRMLScriptedModuleNode") != 'ScriptedModule':
            slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
Example #19
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
Example #20
0
  def __init__(self, parent=None):
    self.testingServer = None
    
    # let the popup window manage data loading
    self.useDetailsPopup = True
    # hide the search box 
    self.hideSearch = True

    # options for browser
    self.browserPersistent = False

    # TODO: are these wrapped so we can avoid magic numbers?
    self.dicomModelUIDRole = 32
    self.dicomModelTypeRole = self.dicomModelUIDRole + 1
    self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')


    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
Example #21
0
    def __init__(self, parent=None):
        self.testingServer = None

        # let the popup window manage data loading
        self.useDetailsPopup = True
        # hide the search box
        self.hideSearch = True

        # options for browser
        self.browserPersistent = False

        # TODO: are these wrapped so we can avoid magic numbers?
        self.dicomModelUIDRole = 32
        self.dicomModelTypeRole = self.dicomModelUIDRole + 1
        self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')

        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
Example #22
0
    def __init__(self, parent=None):
        self.testingServer = None
        self.dicomApp = None

        # hide the search box
        self.hideSearch = True

        # options for browser
        self.browserPersistent = False

        # TODO: are these wrapped so we can avoid magic numbers?
        self.dicomModelUIDRole = 32
        self.dicomModelTypeRole = self.dicomModelUIDRole + 1
        self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')

        # state management for compressing events
        self.resumeModelRequested = False
        self.updateRecentActivityRequested = False

        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
 def __init__(self, parent=None, configFile=None):
     self.util = QAUtil()
     if configFile is None:
         configFile = os.path.join(os.path.dirname(slicer.modules.qualityassurance.path),
                                   "qualityassurance.cfg.EXAMPLE")
     else:
         print "This is the config file:", configFile
     self.util.CONFIG_FILE = configFile
     self.logger = self.util.getLogger()
     for name in self.util.findModules():
         print name
         exec "self.{module} = QAModule(self.logger, '{module}')".format(module=name) in globals(), locals()
     if parent is None:
         self.logger.debug("Parent is None")
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
         self.parent.setMRMLScene(slicer.mrmlScene)
         self.layout = self.parent.layout()
         self.setup()
         # self.createModuleButtons(self.parent)
         self.parent.show()
     else:
         self.logger.debug("Parent is: %s" % type(parent))
         self.parent = parent
         self.layout = self.parent.layout()
    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()

        # this flag is 1 if there is an update in progress
        self.__updating = 1

        # the pointer to the logic
        self.__logic = None

        if not parent:
            self.setup()
            self.__inputVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__seedFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__outputVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            self.__previewVolumeNodeSelector.setMRMLScene(slicer.mrmlScene)
            # after setup, be ready for events
            self.__updating = 0

            self.parent.show()

        # register default slots
        self.parent.connect("mrmlSceneChanged(vtkMRMLScene*)", self.onMRMLSceneChanged)
Example #25
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()
Example #26
0
    def __init__(self, parent=None, showVolumesFrame=True):
        self.observerTags = []
        self.shortcuts = []
        self.toolsBox = None

        # set attributes from ctor parameters
        self.showVolumesFrame = showVolumesFrame
        # TODO: figure out why module/class hierarchy is different
        # between developer builds ans packages
        try:
            # for developer build...
            self.editUtil = EditorLib.EditUtil.EditUtil()
        except AttributeError:
            # for release package...
            self.editUtil = EditorLib.EditUtil()

        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()
Example #27
0
  def __init__(self, parent=None):
    self.testingServer = None
    self.dicomApp = None

    # hide the search box
    self.hideSearch = True

    # options for browser
    self.browserPersistent = False

    # TODO: are these wrapped so we can avoid magic numbers?
    self.dicomModelUIDRole = 32
    self.dicomModelTypeRole = self.dicomModelUIDRole + 1
    self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')

    # state management for compressing events
    self.resumeModelRequested = False
    self.updateRecentActivityRequested = False

    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
Example #28
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()
   
   self.fileDialog = None
   
   # Initialize Data Nodes List
   self.inputDataNodes = []
   
   # use OrderedDict for class-specific dictionary of function calls
   # map feature class to list of features
   self.featureClassKeys = collections.OrderedDict()
   self.featureClassKeys["Node Information"] = ["Node"]
   self.featureClassKeys["First-Order Statistics"] = ["Voxel Count", "Gray Levels", "Energy", "Entropy" , "Minimum Intensity", "Maximum Intensity", "Mean Intensity", "Median Intensity", "Range", "Mean Deviation", "Root Mean Square",  "Standard Deviation", "Skewness", "Kurtosis", "Variance", "Uniformity"]
   self.featureClassKeys["Morphology and Shape"] = ["Volume mm^3", "Volume cc", "Surface Area mm^2", "Surface:Volume Ratio", "Compactness 1", "Compactness 2", "Maximum 3D Diameter", "Spherical Disproportion", "Sphericity"]  
   self.featureClassKeys["Texture: GLCM"] = ["Autocorrelation", "Cluster Prominence", "Cluster Shade", "Cluster Tendency", "Contrast", "Correlation", "Difference Entropy", "Dissimilarity", "Energy (GLCM)", "Entropy(GLCM)", "Homogeneity 1", "Homogeneity 2", "IMC1", "IDMN", "IDN", "Inverse Variance", "Maximum Probability", "Sum Average", "Sum Entropy", "Sum Variance", "Variance (GLCM)"] #IMC2 missing
   self.featureClassKeys["Texture: GLRL"] = ["SRE", "LRE", "GLN", "RLN", "RP", "LGLRE", "HGLRE", "SRLGLE", "SRHGLE", "LRLGLE", "LRHGLE"]   
   self.featureClassKeys["Geometrical Measures"] = ["Extruded Surface Area", "Extruded Volume", "Extruded Surface:Volume Ratio"]
   self.featureClassKeys["Renyi Dimensions"] = ["Box-Counting Dimension", "Information Dimension", "Correlation Dimension"]
   
   # used to map feature class to a list of auto-generated feature checkbox widgets
   self.featureWidgets = collections.OrderedDict()
   for key in self.featureClassKeys.keys():
     self.featureWidgets[key] = list()   
  def __init__(self, parent = None):
  #def __init__(self, parent):
    #ScriptedLoadableModuleWidget.setup(self)

    self.tnode = None
    self.strHostname = None
    self.times0 = 0

    self.chooseCell = False
    self.connectTag = False
    self.registTag = False

    self.receiveCurrentNode = 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 = SmartTemplateLogic(None)
    self.generateTag = False
Example #30
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.transformNode = None
        self.transformNodeObserverTag = None
        self.transformObserverTag = None
        self.transform = None
        self.acquireButtonFlag = False
        self.collectSignal = False
        self.pointerPosition = np.zeros(3)
        self.pointsCounts = 0
        self.recordedpoint = np.zeros(3)

        self.statusTimer = qt.QTimer()
        self.statusTimer.setInterval(100)
        self.statusTimer.connect('timeout()', self.changeTrackerStatus)

        if not parent:
            self.setup()
            self.parent.show()
Example #31
0
  def __init__(self, parent=None, embedded=False, suppliedEffects=[], showVolumesFrame=True):
    self.observerTags = []

    # set attributes from ctor parameters
    self.embedded = embedded
    self.suppliedEffects = suppliedEffects
    self.showVolumesFrame = showVolumesFrame
    # TODO: figure out why module/class hierarchy is different
    # between developer builds ans packages
    try:
      # for developer build...
      self.editUtil = EditorLib.EditUtil.EditUtil()
    except AttributeError:
      # for release package...
      self.editUtil = EditorLib.EditUtil()

    #->> check to make sure it works with a supplied parent
    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()
      #self.setup()
      if self.embedded:
        self.setup()
Example #32
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.markersFiducialsNodeSelector.setMRMLScene(slicer.mrmlScene)

            self.targetFiducialNodeSelector.setMRMLScene(slicer.mrmlScene)

            self.entryFiducialNodeSelector.setMRMLScene(slicer.mrmlScene)

            self.parent.show()
Example #33
0
    def __init__(self, parent=None):
        self.testingServer = None
        self.dicomBrowser = None

        # options for browser
        self.browserPersistent = False

        # TODO: are these wrapped so we can avoid magic numbers?
        self.dicomModelUIDRole = 32
        self.dicomModelTypeRole = self.dicomModelUIDRole + 1
        self.dicomModelTypes = ('Root', 'Patient', 'Study', 'Series', 'Image')

        # 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
  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()

    # this flag is 1 if there is an update in progress
    self.__updating = 1

    # the pointer to the logic and the mrmlManager
    self.__mrmlManager = None
    self.__logic = None

    if not parent:
      self.setup()

      # after setup, be ready for events
      self.__updating = 0

      self.parent.show()

    if slicer.mrmlScene.GetTagByClassName( "vtkMRMLScriptedModuleNode" ) != 'ScriptedModule':
      slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
  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()

  # Module Variables
    self.timer = qt.QTimer()
    self.timer.setInterval(20)
    self.timer.connect('timeout()', self.doSomething)
    self.fiducialMatrixStatus = False
    self.outsideSign = 0
    self.needleInsertionStarted = False 
    self.dataBufferIsEmpty = True
    self.trajectoryRawData = [ 0, 0, 0] 
    self.minimumDistanceBetweenSeperatePoints = 2 
    #self.n = 48
    #self.p = numpy.zeros((self.n,3))

    # 10 mm offset for template widt
    self.templateWidth = -10   
Example #36
0
    def __init__(self, parent=None, rootDir=None, MODULE=None):
        """ 
    Init function.

    @param parent: The parent qt.QWidget of the settings file.
    @type parent: qt.QWidget

    @param rootDir: The root directory where to store the settings file.
    @type rootDir:  str

    @param MODULE: The XNAT Slicer module.
    @type MODULE: XNATSlicerWidget
    """

        if not parent:
            self.parent = slicer.qMRMLWidget()
        else:
            self.parent = parent
        self.Events = MokaUtils.Events(self.EVENT_TYPES)
        self.MODULE = MODULE
        self.filepath = os.path.join(rootDir,
                                     self.FILE_PREFIX + self.FILE_SUFFIX)

        #--------------------
        # OS specific database settings
        #--------------------
        self.dbFormat = qt.QSettings.IniFormat
        self.__resetDatabase()
        self.defaultHosts = {
            'Central': 'https://central.xnat.org',
            'CNDA': 'https://cnda.wustl.edu'
        }
        self.setup()
        self.currErrorMessage = ""
        slicer.app.processEvents()
Example #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()
   if not parent:
     self.setup()
     self.parent.show()
     
   self.logic = ViewpointLogic()
   
   self.sliderTranslationDefaultMm    = 0
   self.sliderTranslationMinMm        = -200
   self.sliderTranslationMaxMm        = 200
   self.sliderViewAngleDefaultDeg     = 30
   self.cameraViewAngleMinDeg         = 5.0  # maximum magnification
   self.cameraViewAngleMaxDeg         = 150.0 # minimum magnification
   self.sliderParallelScaleDefaultDeg = 1
   self.cameraParallelScaleMinDeg     = 0.001  # maximum magnification
   self.cameraParallelScaleMaxDeg     = 1000.0 # minimum magnification
   
   self.sliderSingleStepValue = 1
   self.sliderPageStepValue   = 10
   
   self.enableViewpointButtonState = 0
   self.enableViewpointButtonTextState0 = "Enable Viewpoint Mode"
   self.enableViewpointButtonTextState1 = "Disable Viewpoint Mode"
Example #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.logic = VolumeMaskerLogic()
 def __init__(self, parent=None):
     if not parent:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(qt.QVBoxLayout())
     else:
         self.parent = parent
         self.layout = self.parent.layout()
     if not parent:
         self.setup()
         self.parent.show()
     self.inputsFilled = False
Example #40
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()
Example #41
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()
Example #42
0
 def __init__(self, parent = None):
   self.developerMode = False # change this to true to get reload and test
   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()
Example #43
0
 def __init__(self, parent=None, rootDir=None, browser = None):    
   if not parent:
     self.parent = slicer.qMRMLWidget()
   else:
     self.parent = parent   
   self.browser = browser
   self.filepath = os.path.join(rootDir, 'XNATSettings.ini')
   self.database = qt.QSettings(self.filepath, qt.QSettings.IniFormat)
   self.defaultHosts = {'Central': 'https://central.xnat.org', 
                        'CNDA': 'https://cnda.wustl.edu'}  
   self.setup()
   self.currErrorMessage = ""
Example #44
0
 def __init__(self, parent = None):
     """Widget constructor (existing module)"""
     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()    
Example #45
0
 def __init__(self, parent = None):
   self.developerMode = False # change this to true to get reload and test
   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()
Example #46
0
 def __init__(self, parent=None):
     """Widget constructor (existing module)"""
     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):
        """ It seems to be that Slicer creates an instance of this class with a
			qMRMLWidget parent. If for some reason it doesn't, this __init__ will.
		"""

        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()
Example #48
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.parent = slicer.modules.cropvolume.widgetRepresentation()
     self.layout = self.parent.layout()
     if not parent:
         self.setup()
         self.parent.show()
Example #49
0
 def __init__(self, parent = None):
   self.moduleName = 'Workflow'
   self._ViewNodeIDs = { 'Active' : None, 'Secondary' : None, 'Label' : 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()
   self.logic = InBoreWorkspaceCheckerLogic()
   self.tag = 0
Example #51
0
    def __init__(self, moduleName, parentWidget=None):
        """Widget constructor (existing module)"""
        #        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.__moduleName__ = moduleName
        self.layout = self.parent.layout()
        self.logic = PreProcessingLogic(moduleName)
Example #52
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.lastCommandId = 0
     self.timeoutCounter = 0
     if not parent:
         self.setup()
         self.parent.show()
    def __init__( self, parent=None ):
        """ It seems to be that Slicer creates an instance of this class with a
            qMRMLWidget parent. My understanding of parenthood when it comes to modules
            is currently limited -- I'll update this when I know more.
        """

        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()
	def __init__( self, parent=None ):

		""" It seems to be that Slicer creates an instance of this class with a
			qMRMLWidget parent. If for some reason it doesn't, this __init__ will.
		"""

		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()
Example #55
0
 def __init__(self, parent=None):
     if not parent:
         self.parent = slicer.qMRMLWidget()
         self.parent.setLayout(
             qt.QVBoxLayout())  # dispone los elementos de manera vertical
         self.parent.setMRMLScene(
             slicer.mrmlScene)  # Asocia la escena mrml al widget
     else:
         self.parent = parent
         self.layout = self.parent.layout()
     if not parent:
         self.setup()
         self.parent.show()
Example #56
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.logic = WebGLExportLogic()
   self.__httpd = None
   self.__port = 3456
   self.__p = None
   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()

    self.moduleName = 'SlicerTestRecentFilesTests'
    self.tester = SlicerTestRecentFilesTestsTest()
Example #58
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()
 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.distanceTable = list()
     self.outputNode = None
     if not parent:
         self.setup()
         self.vtkSelector.setMRMLScene(slicer.mrmlScene)
         self.outputSelector.setMRMLScene(slicer.mrmlScene)
     self.parent.show()