コード例 #1
0
ファイル: UltraSound.py プロジェクト: xTdub/SlicerIGT
    def __init__(self, guideletParent):
        self.guideletParent = guideletParent
        self.captureDeviceName = self.guideletParent.parameterNode.GetParameter(
            'PLUSCaptureDeviceName')
        self.referenceToRas = None

        try:
            slicer.modules.plusremote
        except:
            raise Exception(
                'Error: Could not find Plus Remote module. Please install the SlicerOpenIGTLink extension'
            )
            return

        from PlusRemote import PlusRemoteLogic
        self.plusRemoteLogic = PlusRemoteLogic()

        fileDir = os.path.dirname(__file__)
        iconPathRecord = os.path.join(fileDir, 'Resources', 'Icons',
                                      'icon_Record.png')
        iconPathStop = os.path.join(fileDir, 'Resources', 'Icons',
                                    'icon_Stop.png')

        if os.path.isfile(iconPathRecord):
            self.recordIcon = qt.QIcon(iconPathRecord)
        if os.path.isfile(iconPathStop):
            self.stopIcon = qt.QIcon(iconPathStop)
コード例 #2
0
    def __init__(self, parent):
        super(CaseReportsWindow, self).__init__()

        self.mainLayout = qt.QVBoxLayout(self)
        self.setLayout(self.mainLayout)
        self.resize(400, 300)

        self.label = qt.QLabel("Data stored in the module: ")
        self.label.setStyleSheet("margin: 10px 0 15px 0")
        self.mainLayout.addWidget(self.label)

        self.tableView = qt.QTableView()
        self.tableView.setColumnWidth(0,125)

        self.tableView.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding)
        self.mainLayout.addWidget(self.tableView)

        self.exportButton = ctk.ctkPushButton()
        self.exportButton.text = "Export"
        self.exportButton.setFixedWidth(150)
        self.exportButton.setIcon(qt.QIcon("{0}/export-csv.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.exportButton.setIconSize(qt.QSize(24,24))
        self.mainLayout.addWidget(self.exportButton)

        self.removeButton = ctk.ctkPushButton()
        self.removeButton.text = "Clean cache"
        self.removeButton.setIcon(qt.QIcon("{0}/delete.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.removeButton.setIconSize(qt.QSize(24,24))
        self.removeButton.setFixedWidth(150)
        self.mainLayout.addWidget(self.removeButton)

        self.exportButton.connect('clicked()', parent.onExport)
        self.removeButton.connect('clicked()', parent.onRemoveStoredData)
コード例 #3
0
    def setup(self):
        self.saveValuesButton = ctk.ctkPushButton()
        self.saveValuesButton.text = "Save"
        self.saveValuesButton.setIcon(qt.QIcon("{0}/Save.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.saveValuesButton.setIconSize(qt.QSize(24,24))
        self.layout.addWidget(self.saveValuesButton)

        self.openButton = ctk.ctkPushButton()
        self.openButton.text = "Open"
        self.openButton.setIcon(qt.QIcon("{0}/open_file.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.openButton.setIconSize(qt.QSize(24,24))

        self.layout.addWidget(self.openButton)

        self.exportButton = ctk.ctkPushButton()
        self.exportButton.text = "Export"
        self.exportButton.setIcon(qt.QIcon("{0}/export-csv.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.exportButton.setIconSize(qt.QSize(24,24))
        self.layout.addWidget(self.exportButton)

        self.removeButton = ctk.ctkPushButton()
        self.removeButton.setIcon(qt.QIcon("{0}/delete.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.removeButton.setIconSize(qt.QSize(24,24))
        self.removeButton.text = "Clean cache"
        self.layout.addWidget(self.removeButton)

        self.saveValuesButton.connect('clicked()', self.onSave)
        self.exportButton.connect('clicked()', self.onExport)
        self.openButton.connect('clicked()', self.onShowStoredData)
        self.removeButton.connect('clicked()', self.onRemoveStoredData)
コード例 #4
0
    def addTumorContouringToUltrasoundPanel(self):

        self.ultrasoundCollapsibleButton.text = "Tumor contouring"

        self.placeButton = qt.QPushButton("Mark points")
        self.placeButton.setCheckable(True)
        self.placeButton.setIcon(qt.QIcon(":/Icons/MarkupsMouseModePlace.png"))
        setButtonStyle(self.placeButton)
        self.ultrasoundLayout.addRow(self.placeButton)

        self.deleteLastFiducialButton = qt.QPushButton("Delete last")
        self.deleteLastFiducialButton.setIcon(
            qt.QIcon(":/Icons/MarkupsDelete.png"))
        setButtonStyle(self.deleteLastFiducialButton)
        self.deleteLastFiducialButton.setEnabled(False)

        self.deleteAllFiducialsButton = qt.QPushButton("Delete all")
        self.deleteAllFiducialsButton.setIcon(
            qt.QIcon(":/Icons/MarkupsDeleteAllRows.png"))
        setButtonStyle(self.deleteAllFiducialsButton)
        self.deleteAllFiducialsButton.setEnabled(False)

        hbox = qt.QHBoxLayout()
        hbox.addWidget(self.deleteLastFiducialButton)
        hbox.addWidget(self.deleteAllFiducialsButton)
        self.ultrasoundLayout.addRow(hbox)
コード例 #5
0
 def getIcon(iconName, isSystemIcon=False):
     """ Build a new QIcon from the common CIP icons library or from the Slicer system icons
     :param iconName: name of the file (ex: previous.png)
     :param isSystemIcon: True if the icon belongs to the Slicer library. The available files can be found in the
     folder "/Users/Jorge/Projects/BWH/Slicer/Libs/MRML/Widgets/Resources/Icons".
     isSystemIcon=False for CIP icons (in "SlicerCIP/Scripted/CIP_Common/CIP/ui/Resources/Icons/")
     :return: QIcon object
     """
     if not isSystemIcon:
         return qt.QIcon(os.path.join(SlicerUtil.CIP_ICON_DIR, iconName))
     return qt.QIcon(":/Icons/" + iconName)
コード例 #6
0
    def __init__(self, parent, logic, configurationName='Default'):
        self.calibrationCollapsibleButton = None

        Guidelet.__init__(self, parent, logic, configurationName)
        logging.debug('ExampleGuideletGuidelet.__init__')

        self.logic.addValuesToDefaultConfiguration()

        moduleDirectoryPath = slicer.modules.exampleguidelet.path.replace(
            'ExampleGuidelet.py', '')

        # Set up main frame.

        self.sliceletDockWidget.setObjectName('ExampleGuideletPanel')
        self.sliceletDockWidget.setWindowTitle('Example guidelet')
        self.mainWindow.setWindowTitle('ExampleGuidelet')
        self.mainWindow.windowIcon = qt.QIcon(
            moduleDirectoryPath + '/Resources/Icons/ExampleGuidelet.png')

        self.setupScene()

        self.navigationView = self.VIEW_ULTRASOUND_3D

        # Setting button open on startup.
        self.calibrationCollapsibleButton.setProperty('collapsed', False)
コード例 #7
0
  def __init__(self, guideletParent):
    self.guideletParent = guideletParent
    self.captureDeviceName = self.guideletParent.parameterNode.GetParameter('PLUSCaptureDeviceName')
    self.referenceToRas = None

    from PlusRemote import PlusRemoteLogic
    self.plusRemoteLogic = PlusRemoteLogic()

    fileDir = os.path.dirname(__file__)
    iconPathRecord = os.path.join(fileDir, 'Resources', 'Icons', 'icon_Record.png')
    iconPathStop = os.path.join(fileDir, 'Resources', 'Icons', 'icon_Stop.png')

    if os.path.isfile(iconPathRecord):
      self.recordIcon = qt.QIcon(iconPathRecord)
    if os.path.isfile(iconPathStop):
      self.stopIcon = qt.QIcon(iconPathStop)
コード例 #8
0
    def createButtonRow(self, effects, rowLabel=""):

        f = qt.QFrame(self.parent)
        self.parent.layout().addWidget(f)
        self.rowFrames.append(f)
        hbox = qt.QHBoxLayout()
        f.setLayout(hbox)

        if rowLabel:
            label = qt.QLabel(rowLabel)
            hbox.addWidget(label)

        for effect in effects:
            # check that the effect belongs in our list of effects before including
            if (effect in self.effects):
                i = self.icons[effect] = qt.QIcon(
                    self.effectIconFiles[effect, self.effectModes[effect]])
                a = self.actions[effect] = qt.QAction(i, '', f)
                self.effectButtons[effect] = b = self.buttons[
                    effect] = qt.QToolButton()
                b.setDefaultAction(a)
                b.setToolTip(effect)
                if EditBox.displayNames.has_key(effect):
                    b.setToolTip(EditBox.displayNames[effect])
                hbox.addWidget(b)
                if self.disabled.__contains__(effect):
                    b.setDisabled(1)

                # Setup the mapping between button and its associated effect name
                self.effectMapper.setMapping(self.buttons[effect], effect)
                # Connect button with signal mapper
                self.buttons[effect].connect('clicked()', self.effectMapper,
                                             'map()')

        hbox.addStretch(1)
コード例 #9
0
  def __init__( self, stepid ):
    self.initialize( stepid )
    self.setName( '10. Segment' )
    self.setDescription( '' )
    self.icon = qt.QIcon( ":/Icons/EMSegment.png" )

    self.__parent = super( EMSegmentStartSegmentationStep, self )
コード例 #10
0
  def __init__(self, parent):
    self.parent = parent
    self.moduleName = self.__class__.__name__

    parent.title = ""
    parent.categories = []
    parent.dependencies = []
    parent.contributors = ["Andras Lasso (PerkLab, Queen's University), Steve Pieper (Isomics)"]

    parent.helpText = string.Template("""
This module was created from a template and the help section has not yet been updated.
Please refer to <a href=\"$a/Documentation/$b.$c/Modules/ScriptedLoadableModule\">the documentation</a>.
    """).substitute({ 'a':parent.slicerWikiUrl, 'b':slicer.app.majorVersion, 'c':slicer.app.minorVersion })

    parent.acknowledgementText = """
This work is supported by NA-MIC, NAC, BIRN, NCIGT, and the Slicer Community. See <a>http://www.slicer.org</a> for details.
This work is partially supported by PAR-07-249: R01CA131718 NA-MIC Virtual Colonoscopy (See <a href=http://www.slicer.org>http://www.na-mic.org/Wiki/index.php/NA-MIC_NCBC_Collaboration:NA-MIC_virtual_colonoscopy</a>).
    """

    # Set module icon from Resources/Icons/<ModuleName>.png
    moduleDir = os.path.dirname(self.parent.path)
    iconPath = os.path.join(moduleDir, 'Resources/Icons', self.moduleName+'.png')
    if os.path.isfile(iconPath):
      parent.icon = qt.QIcon(iconPath)

    # Add this test to the SelfTest module's list for discovery when the module
    # is created.  Since this module may be discovered before SelfTests itself,
    # create the list if it doesn't already exist.
    try:
      slicer.selfTests
    except AttributeError:
      slicer.selfTests = {}
    slicer.selfTests[self.moduleName] = self.runTest
コード例 #11
0
    def __init__(self, parent):
        parent.title = "Simple Filters"
        parent.categories = ["Filtering"]
        parent.dependencies = []
        parent.contributors = [
            "Bradley Lowekamp (MSC/NLM), Steve Pieper (Isomics), Jean-Christophe Fillion-Robin (Kitware)"
        ]
        parent.helpText = \
    """
This modules provides a basic interface to 250 image filters from the
Insight Toolkit. It provides access to algorithms such as binary
morphology, grayscale morphology, region growing, smoothing, denosing,
distance fields, FFTs, convolutions, automatic thresholding, intensity
math and many advanced algorithms.
<br /><br />

Most algorithms which take multiple input images expect the inputs to
have the same physical locations (spacing, origin, orientation and
largest possible region), and be the same pixel type.
<br /><br />

For general information about the module see the <a href=\"{0}/Documentation/Nightly/Modules/SimpleFilters\">online documentation</a>.
<br /><br />

For detailed information about a specific filter please consult the <a href=\"http://www.itk.org/Doxygen/html/\">Insight Toolkit Doxygen</a>.
 """.format(parent.slicerWikiUrl, slicer.app.majorVersion, slicer.app.minorVersion)

        parent.acknowledgementText = """
The developers would like to thank the support of the Slicer Community, the Insight Toolkit and the ITK Community."
""" # replace with organization, grant and thanks.
        self.parent = parent

        parent.icon = qt.QIcon("%s/ITK.png" % self.ICON_DIR)
コード例 #12
0
ファイル: XnatUtils.py プロジェクト: NrgXnat/XNATSlicer-1
    def generateButton(self, iconOrLabel="", toolTip="", font = qt.QFont('Arial', 10, 10, False),  size = None, enabled=False):
        """ Creates a qt.QPushButton(), with the arguments.  Sets text, font,
        toolTip, icon, size, and enabled state.
        """
        
        button = qt.QPushButton()
        
        
        
        #--------------------
        # Set either Icon or label, depending on
        # whehter the icon file exists.
        #--------------------
        iconPath = os.path.join(self.MODULE.GLOBALS.LOCAL_URIS['icons'], iconOrLabel)
        if os.path.exists(iconPath):
            button.setIcon(qt.QIcon(iconPath))
        else:
            button.setText(iconOrLabel)

        
            button.setToolTip(toolTip)
            button.setFont(font)

        if size:
            button.setFixedHeight(size.height())
            button.setFixedWidth(size.width())

                
                
        button.setEnabled(enabled) 
        return button
コード例 #13
0
ファイル: CIP_Blank.py プロジェクト: trb116/pythonanalyzer
    def setup(self):
        """This is called one time when the module GUI is initialized
        """
        ScriptedLoadableModuleWidget.setup(self)

        # Create objects that can be used anywhere in the module. Example: in most cases there should be just one
        # object of the logic class
        self.logic = CIP_BlankLogic()

        # Create all the widgets. Main Area
        mainAreaCollapsibleButton = ctk.ctkCollapsibleButton()
        mainAreaCollapsibleButton.text = "Main parameters"
        self.layout.addWidget(mainAreaCollapsibleButton)
        # Layout within the dummy collapsible button. See http://doc.qt.io/qt-4.8/layout.html for more info about layouts
        self.mainAreaLayout = qt.QFormLayout(mainAreaCollapsibleButton)

        # Example button with some common properties
        self.exampleButton = ctk.ctkPushButton()
        self.exampleButton.text = "Push me!"
        self.exampleButton.toolTip = "This is the button tooltip"
        self.exampleButton.setIcon(
            qt.QIcon("{0}/Reload.png".format(SlicerUtil.CIP_ICON_DIR)))
        self.exampleButton.setIconSize(qt.QSize(20, 20))
        self.exampleButton.setStyleSheet("font-weight:bold; font-size:12px")
        self.exampleButton.setFixedWidth(200)
        self.mainAreaLayout.addWidget(self.exampleButton)

        # Connections
        self.exampleButton.connect('clicked()', self.onApplyButton)
コード例 #14
0
    def loadExistingSnapshotsFirstLoad(self):
        """Loads all the existing snapshot nodes currently present in the scene.
    It initializes the object self.snapshotsCached that will store the state for all the snapshots.
    It also creates the Reload snapshots button"""
        self.snapshotsCached = dict()
        # Get the nodes of type Snapshot
        snapshotNodes = slicer.mrmlScene.GetNodesByClass(
            'vtkMRMLAnnotationSnapshotNode')

        snapshotNodes.InitTraversal()
        snapshotNode = snapshotNodes.GetNextItemAsObject()
        if not snapshotNode:
            # There is not any snapshot
            self.noItemsLabel.show()
        else:
            # Add all the nodes
            self.noItemsLabel.hide()
            while snapshotNode:
                self.__addNewSnapshot__(snapshotNode)
                snapshotNode = snapshotNodes.GetNextItemAsObject()

        # Reload button
        self.btnReloadSnaps = qt.QPushButton("Reload snapshots")
        self.btnReloadSnaps.toolTip = (
            "Reload all the current snapshots and set them to the initial state (equivalent to the first load of the module)."
            "\nThis is useful if you want to re-upload any snapshots")
        self.btnReloadSnaps.setIcon(
            qt.QIcon(self.CIP_ICON_DIR + "/Reload - 16.png"))
        self.btnReloadSnaps.setStyleSheet("margin-top: 15px")
        self.btnReloadSnaps.setFixedSize(150, 40)

        self.currentSnapshotsLayout.addWidget(self.btnReloadSnaps)

        self.btnReloadSnaps.connect('clicked (bool)',
                                    self.onbtnReloadSnapsClicked)
コード例 #15
0
  def createUserInterface(self):
    self.__layout = self.__parent.createUserInterface()
    
    self.__spacerLabel = qt.QLabel(" ")      
    self.__layout.addRow(self.__spacerLabel)
      
#    self.__segmentationSectionLabel = qt.QLabel("Fix the Level-set Segmentation:")     
#    self.__layout.addRow(self.__segmentationSectionLabel)
      
    self.__ioAdvancedPanel = qt.QFrame(self)
    print "testss"
    self.__ioAdvancedPanel.setFrameStyle(6)
    self.__layout.addRow(self.__ioAdvancedPanel)
#    self.__ioAdvancedToggle.connect("clicked()", self.onIOAdvancedToggle) 
    
    ioAdvancedFormLayout = qt.QFormLayout(self.__ioAdvancedPanel)
          
      
    self.__buttonBox = qt.QDialogButtonBox() 
    self.__resetButton = self.__buttonBox.addButton(self.__buttonBox.RestoreDefaults)
    self.__resetButton.text = "Undersegmentation"
    self.__resetButton.toolTip = "Click to perfom an Undersegmentation."
    self.__previewButton = self.__buttonBox.addButton(self.__buttonBox.Discard)
    self.__previewButton.setIcon(qt.QIcon())
    self.__previewButton.text = "Oversegmentation"
    self.__previewButton.toolTip = "Click to perfom an Oversegmentation."
#      self.__startButton = self.__buttonBox.addButton(self.__buttonBox.Apply)
#      self.__startButton.setIcon(qt.QIcon())
#      self.__startButton.text = "Start!"
#      self.__startButton.enabled = False
#      self.__startButton.toolTip = "Click to start the filtering."
    ioAdvancedFormLayout.addWidget(self.__buttonBox)
コード例 #16
0
    def createButtonRow(self, effects, rowLabel=""):
        """ create a row of the edit box given a list of
    effect names (items in _effects(list) """

        rowFrame = qt.QFrame(self.mainFrame)
        self.mainFrame.layout().addWidget(rowFrame)
        self.rowFrames.append(rowFrame)
        hbox = qt.QHBoxLayout()
        rowFrame.setLayout(hbox)

        if rowLabel:
            label = qt.QLabel(rowLabel)
            hbox.addWidget(label)

        for effect in effects:
            # check that the effect belongs in our list of effects before including
            if (effect in self.effects):
                i = self.icons[effect] = qt.QIcon(self.effectIconFiles[effect])
                a = self.actions[effect] = qt.QAction(i, '', rowFrame)
                self.effectButtons[effect] = b = self.buttons[
                    effect] = qt.QToolButton()
                b.setDefaultAction(a)
                b.setToolTip(effect)
                if EditBox.displayNames.has_key(effect):
                    b.setToolTip(EditBox.displayNames[effect])
                hbox.addWidget(b)

                # Setup the mapping between button and its associated effect name
                self.effectMapper.setMapping(self.buttons[effect], effect)
                # Connect button with signal mapper
                self.buttons[effect].connect('clicked()', self.effectMapper,
                                             'map()')

        hbox.addStretch(1)
コード例 #17
0
    def __init__(self, parent):
        self.parent = parent
        self.moduleName = self.__class__.__name__
        parent.title = "ResectionVolume"
        parent.categories = ["IGT"]
        parent.dependencies = []
        parent.contributors = ["Matt Lougheed (Queen's University)"]
        parent.helpText = """
    This module uses fiducial points to generate a 3D shape. The shape can be adjusted by dragging or adding new fiducials and is used to recolor a label map.
    """
        parent.acknowledgementText = """

"""
        moduleDir = os.path.dirname(self.parent.path)
        iconPath = os.path.join(moduleDir, 'Resources/Icons',
                                self.moduleName + '.png')
        if os.path.isfile(iconPath):
            parent.icon = qt.QIcon(iconPath)

        # Add this test to the SelfTest module's list for discovery when the module
        # is created.  Since this module may be discovered before SelfTests itself,
        # create the list if it doesn't already exist.
        try:
            slicer.selfTests
        except AttributeError:
            slicer.selfTests = {}
        slicer.selfTests['ResectionVolume'] = self.runTest
コード例 #18
0
    def __init__(self, parent):
        import string
        parent.title = "Interactive Segment Tubes"
        parent.categories = ["TubeTK"]
        parent.contributors = ["Johan Andruejol (Kitware)"]
        parent.helpText = """
    <p>This module is an interactive gui wrapping around the <i>Segment Tubes</i>
    module. It automatically processes the seeds points, allowing the user to 
    click its way through an image without having to worry about running the 
    <i>Segment Tubes</i> CLI by hand.

    <p>To use, simply specify the <b>Input image</b>, the <b>Output tube</b> and 
    the <b>Seed points</b> list. The seed list is the list that will contains 
    all the seeds to process. Click the <b>Start</b> button to start 
    processing seeds as they come.\n
    <p>Each new markup added to the list will be queued ('Queued' status) for 
    processing. Once the <i>Segment Tubes</i> CLI processed the queued seeds, 
    their status will change to 'Processed'. The new vessels will be merged to 
    the <b>Output tube</b>."""
        parent.acknowledgementText = """"""

        iconPath = os.path.join(ICON_DIR, 'InteractiveSegmentTubesIcon.png')
        parent.icon = qt.QIcon(iconPath)

        self.parent = parent
コード例 #19
0
    def __init__(self, parent):
        import string
        parent.title = "DICOM"
        parent.categories = ["", "Informatics"]  # top level module
        parent.contributors = ["Steve Pieper (Isomics)"]
        parent.helpText = string.Template("""
The DICOM module integrates DICOM classes from CTK (based on DCMTK).  See <a href=\"$a/Documentation/$b.$c/Modules/DICOM\">the documentaiton</a> for more information.
""").substitute({
            'a': parent.slicerWikiUrl,
            'b': slicer.app.majorVersion,
            'c': slicer.app.minorVersion
        })
        parent.acknowledgementText = """
This work is supported by NA-MIC, NAC, BIRN, NCIGT, and the Slicer Community. See <a href=http://www.slicer.org>http://www.slicer.org</a> for details.  Module implemented by Steve Pieper.  Based on work from CommonTK (http://www.commontk.org).
    """
        parent.icon = qt.QIcon(':Icons/Medium/SlicerLoadDICOM.png')
        self.parent = parent

        if slicer.mrmlScene.GetTagByClassName(
                "vtkMRMLScriptedModuleNode") != 'ScriptedModule':
            slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())

        # initialize the dicom infrastructure
        slicer.dicomDatabase = None
        settings = qt.QSettings()
        # the dicom database is a global object for slicer
        if settings.contains('DatabaseDirectory'):
            databaseDirectory = settings.value('DatabaseDirectory')
            if databaseDirectory:
                slicer.dicomDatabase = ctk.ctkDICOMDatabase()
                slicer.dicomDatabase.openDatabase(
                    databaseDirectory + "/ctkDICOM.sql", "SLICER")
                if not slicer.dicomDatabase.isOpen:
                    # can't open the database, so prompt the user later if they enter module
                    slicer.dicomDatabase = None
                else:
                    # the dicom listener is also global, but only started on app start if
                    # the user so chooses
                    if settings.contains('DICOM/RunListenerAtStart'):
                        if settings.value(
                                'DICOM/RunListenerAtStart') == 'true':
                            if not hasattr(slicer, 'dicomListener'):
                                try:
                                    slicer.dicomListener = DICOMLib.DICOMListener(
                                        slicer.dicomDatabase)
                                    slicer.dicomListener.start()
                                except (UserWarning, OSError) as message:
                                    # TODO: how to put this into the error log?
                                    print(
                                        'Problem trying to start DICOMListener:\n %s'
                                        % message)
                if slicer.dicomDatabase:
                    slicer.app.setDICOMDatabase(slicer.dicomDatabase)

        # Trigger the menu to be added when application has started up
        if not slicer.app.commandOptions().noMainWindow:
            qt.QTimer.singleShot(0, self.addMenu)
        # set the dicom pre-cache tags once all plugin classes have been initialized
        qt.QTimer.singleShot(0, DICOM.setDatabasePrecacheTags)
コード例 #20
0
ファイル: EMSegmentPy.py プロジェクト: rcorredorj/ModelDraw
 def __init__(self, parent):
     parent.title = "EMSegment"
     parent.category = "Segmentation"
     parent.contributor = "--"
     parent.helpText = """<b>EMSegment Module:</b>  Segment a set of set of images (target images) using the tree-based EM segmentation algorithm<br><br>Use the pull down menu to select from a collection of tasks or create a new one.<br>Use the 'Back' and 'Next' to navigate through the stages of filling in the algorithm parameters.\n\nWhen all parameters are specified, use the 'segmentation' button. \n\nFor latest updates, new tasks, and detail help please visit <a>http://www.slicer.org/slicerWiki/index.php/Modules:EMSegmenter-3.6</a> <br><br> <b>The work was reported in:</b> <br>K.M. Pohl et. A hierarchical algorithm for MR brain image parcellation. IEEE Transactions on Medical Imaging, 26(9),pp 1201-1212, 2007."""
     parent.acknowledgementText = """<img src=':/Icons/UPenn_logo.png'><br><br>This module is currently maintained by Daniel Haehn, Dominique Belhachemi, and Kilian Pohl (SBIA,UPenn). The work is currently supported by an ARRA supplement to NAC and the Slicer Community (see also <a>http://www.slicer.org</a>). <br><br>The work was reported in  <br>K.M. Pohl et. A hierarchical algorithm for MR brain image parcellation. IEEE Transactions on Medical Imaging, 26(9),pp 1201-1212, 2007."""
     parent.icon = qt.QIcon(":/Icons/EMSegment.png")
     self.parent = parent
コード例 #21
0
  def createUserInterface( self ):
    '''
    '''
    self.buttonBoxHints = self.ButtonBoxHidden

    self.__layout = self.__parent.createUserInterface()

    # let's load all tasks
    self.loadTasks()
    self.loadPreprocessingTasks()

    selectTaskLabel = qt.QLabel( 'Select Task' )
    selectTaskLabel.setFont( self.__parent.getBoldFont() )
    self.__layout.addRow( selectTaskLabel )

    self.__taskComboBox = qt.QComboBox()
    self.__taskComboBox.toolTip = "Choose a task."

    # fill the comboBox with the taskNames
    self.__taskComboBox.addItems( self.getTaskNames() )
    # TODO select MRI Human Brain as default
    self.__taskComboBox.connect( 'currentIndexChanged(int)', self.onTaskSelected )
    self.__layout.addRow( Helper.CreateSpace( 20 ), self.__taskComboBox )

    # add empty row
    self.__layout.addRow( "", qt.QWidget() )

    chooseModeLabel = qt.QLabel( 'Choose Mode' )
    chooseModeLabel.setFont( self.__parent.getBoldFont() )
    self.__layout.addRow( chooseModeLabel )

    self.__buttonBox = qt.QDialogButtonBox()
    simpleButton = self.__buttonBox.addButton( self.__buttonBox.Discard )
    simpleButton.setIcon( qt.QIcon() )
    simpleButton.text = "Simple"
    simpleButton.toolTip = "Click to use the simple mode."
    advancedButton = self.__buttonBox.addButton( self.__buttonBox.Apply )
    advancedButton.setIcon( qt.QIcon() )
    advancedButton.text = "Advanced"
    advancedButton.toolTip = "Click to use the advanced mode."
    self.__layout.addWidget( self.__buttonBox )

    # connect the simple and advanced buttons
    simpleButton.connect( 'clicked()', self.goSimple )
    advancedButton.connect( 'clicked()', self.goAdvanced )
コード例 #22
0
 def __init__(self, parent):
     parent.title = "Needle Deviation Predictor"
     parent.categories = ["Utilities"]
     parent.contributors = ["Andrew Zheng"]
     parent.helpText = """
     """
     parent.acknowledgementText = """
     Pedro Moreira, PhD, Junichi Tokuda, PhD, Nobuhiko Hata, PhD
     """        
     parent.icon = qt.QIcon(os.path.dirname(os.path.realpath(__file__)) + '/NeedleDeviationPredictor GUI/icon.png')
     self.parent = parent
コード例 #23
0
  def __init__(self, parent=None):
    AbstractInteractiveSegmentTubes.__init__(self)

    self.widget = None
    self.moduleName = 'Interactive Segment Tubes'
    self.logic = InteractiveSegmentTubesLogic()
    self.interactionNode = None

    self.linkIcon = qt.QIcon(os.path.join(ICON_DIR, 'Link.png'))
    self.brokenIcon = qt.QIcon(os.path.join(ICON_DIR, 'Broken.png'))

    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()
コード例 #24
0
    def dialogBoxFunction(self):
        self.deleteAllMsgBox = qt.QDialog(slicer.util.mainWindow())
        #self.deleteAllMsgBox.setWindowTitle("Delete All Fiducials?")
        self.deleteAllMsgBox.setFixedSize(200, 100)
        self.deleteAllMsgBox.show()
        self.deleteAllMsgBox.setLayout(qt.QVBoxLayout())

        messageLabel = qt.QLabel("Delete All Fiducials?")
        font = qt.QFont()
        font.setPointSize(10)
        messageLabel.setFont(font)
        self.deleteAllMsgBox.layout().addWidget(messageLabel, 0, 4)

        yesNoBox = qt.QFrame()
        yesNoBox.setLayout(qt.QHBoxLayout())
        self.deleteAllMsgBox.layout().addWidget(yesNoBox, 0, 4)

        #
        # OK button
        #
        okButton = qt.QPushButton()
        okButton.setText("YES")
        okButton.enabled = True
        okIcon = qt.QIcon(":/Icons/AnnotationOkDone.png")
        okButton.setIcon(okIcon)
        yesNoBox.layout().addWidget(okButton)

        #
        # NO button
        #
        noButton = qt.QPushButton()
        noButton.setText("NO")
        noButton.enabled = True
        noIcon = qt.QIcon(":/Icons/AnnotationCancel.png")
        noButton.setIcon(noIcon)
        yesNoBox.layout().addWidget(noButton)

        # Connections
        okButton.connect("clicked()", self.onDeleteAllButton)
        noButton.connect("clicked()", self.deleteAllMsgBox.hide)
コード例 #25
0
ファイル: XnatSlicerUtils.py プロジェクト: fepegar/XNATSlicer
    def generateButton(iconOrLabel="",
                       toolTip="",
                       font=qt.QFont('Arial', 10, 10, False),
                       size=None,
                       enabled=False):
        """ 
        Creates a qt.QPushButton(), with the arguments.  Sets text, font,
        toolTip, icon, size, and enabled state.

        @param iconOrLabel: Either the icon uri or the label of the button.   
            Defaults to ''.
        @type iconOrLabel: string

        @param toolTip: The tool tip of the button.  Defaults to ''.
        @type toolTip: string

        @param font: The font of the button.  Defaults to 'Arial, 10, plain.'
        @type font: qt.QFont

        @param size: The size of the button.  Defaults QT presets.
        @type size: qt.QSize

        @param enabled: The enabled state of the button.  Defaults to 'False'.
        @type enabled: boolean

        @return: The constructed button to return.
        @rtype: qt.QPushButton
        """

        button = qt.QPushButton()

        #--------------------
        # Set either Icon or label, depending on
        # whehter the icon file exists.
        #--------------------
        iconPath = os.path.join(XnatSlicerGlobals.LOCAL_URIS['icons'],
                                iconOrLabel)
        if os.path.exists(iconPath):
            button.setIcon(qt.QIcon(iconPath))
        else:
            button.setText(iconOrLabel)

            button.setToolTip(toolTip)
            button.setFont(font)

        if size:
            button.setFixedHeight(size.height())
            button.setFixedWidth(size.width())

        button.setEnabled(enabled)
        return button
コード例 #26
0
ファイル: XnatUtils.py プロジェクト: NrgXnat/XNATSlicer-1
 def makeSettingsButton(self, XnatSetting):
     """ Constructs a setting button with a wrench icon that
         opens the appropriate settings tab.
     """
     button = HoverButton()
     button.setIcon(qt.QIcon(os.path.join(self.MODULE.GLOBALS.LOCAL_URIS['icons'], 'wrench.png')) )
     button.setFixedWidth(23)
     button.setFixedHeight(17)
     button.setDefaultStyleSheet('border: 1px solid transparent; border-radius: 2px; background-color: transparent; margin-left: 5px; text-align: left; padding-left: 0px; ')
     button.setHoverStyleSheet('border: 1px solid rgb(150,150,150); border-radius: 2px; background-color: transparent; margin-left: 5px; text-align: left; padding-left: 0px;')
     def openSettings():
         self.MODULE.XnatSettingsWindow.showWindow(XnatSetting.tabTitle)
     button.connect('clicked()', openSettings)
     return button
コード例 #27
0
ファイル: ExtensionWizard.py プロジェクト: Walkkking/Slicer
    def __init__(self, parent):
        parent.title = "Extension Wizard"
        parent.icon = qt.QIcon(":/Icons/Medium/ExtensionWizard.png")
        parent.categories = ["Developer Tools"]
        parent.dependencies = []
        parent.contributors = ["Matthew Woehlke (Kitware)"]
        parent.helpText = """
    This module provides tools to create and manage extensions from within Slicer.
    """
        parent.acknowledgementText = """
    This work is supported by NA-MIC, NAC, BIRN, NCIGT, and the Slicer Community.
    See <a>http://www.slicer.org</a> for details."""
        self.parent = parent

        self.settingsPanel = SettingsPanel()
        slicer.app.settingsDialog().addPanel("Extension Wizard",
                                             self.settingsPanel)
コード例 #28
0
    def __init__(self, parent):
        parent.title = "Workflow"
        parent.categories = ["", "TubeTK"]
        parent.dependencies = []
        parent.contributors = [
            "Julien Finet (Kitware), Johan Andruejol (Kitware)"
        ]
        parent.helpText = """
    Step by step workflow to show the vessels of an image. See the <a href=\"http://public.kitware.com/Wiki/TubeTK\">TubeTK wiki</a> for more information.
    """
        parent.acknowledgementText = """
    This work is supported by the National Institute of Health
    """
        self.parent = parent

        parent.icon = qt.QIcon("%s/Medium/VesselViewLogo.svg" %
                               Widgets.ICON_DIR)
コード例 #29
0
ファイル: EditBox.py プロジェクト: WYZ621/Slicer
  def createButtonRow(self, effects, rowLabel=""):
    """ create a row of the edit box given a list of
    effect names (items in _effects(list) """

    rowFrame = qt.QFrame(self.mainFrame)
    self.mainFrame.layout().addWidget(rowFrame)
    self.rowFrames.append(rowFrame)
    rowFrame.objectName = "RowFrame%s" % len(self.rowFrames)
    hbox = qt.QHBoxLayout()
    rowFrame.setLayout( hbox )

    if rowLabel:
      label = qt.QLabel(rowLabel)
      hbox.addWidget(label)

    for effect in effects:
      # check that the effect belongs in our list of effects before including
      if (effect in self.effects):
        i = self.icons[effect] = qt.QIcon(self.effectIconFiles[effect])
        a = self.actions[effect] = qt.QAction(i, '', rowFrame)
        a.objectName = effect + 'Action'
        self.effectButtons[effect] = b = self.buttons[effect] = qt.QToolButton()
        b.objectName = effect + 'ToolButton'
        b.setDefaultAction(a)
        b.setToolTip(effect)
        if EditBox.displayNames.has_key(effect):
          b.setToolTip(EditBox.displayNames[effect])
        hbox.addWidget(b)

        if effect not in ('EraseLabel', 'PreviousCheckPoint', 'NextCheckPoint'):
          # Mapping between action and its associated effect, is done
          # in function'_onEffectActionTriggered' by retrieving the 'effectName'
          # property.
          a.checkable = True
          a.setProperty('effectName', effect)
          self.effectActionGroup.addAction(a)
        elif effect == 'EraseLabel':
          a.checkable = True
          a.connect('triggered(bool)', self._onEraseLabelActionTriggered)
        elif effect == 'PreviousCheckPoint':
          a.connect('triggered(bool)', self.undoRedo.undo)
        elif effect == 'NextCheckPoint':
          a.connect('triggered(bool)', self.undoRedo.redo)

    hbox.addStretch(1)
コード例 #30
0
    def __init__(self, parent):
        parent.title = "VTK to OBJ converter"
        parent.categories = ["MyModule"]
        parent.dependencies = []
        parent.contributors = [
            "Alessandro Di Girolamo ([email protected])."
        ]
        parent.helpText = """VTK to OBJ format converter. Drag and drop the VTK file you want to convert, then press 
                             the Apply button. A random color is given to the OBJ model and saved in a separated MTL 
                             file. Both the OBJ and the MTL files are saved in the same directory of the input VTK file.
                          """
        # parent.acknowledgementText = """Many thanks to..."""

        # Set module icon
        iconPath = os.path.dirname(os.path.realpath(__file__)) + '/icon.jpeg'
        if os.path.isfile(iconPath):
            parent.icon = qt.QIcon(iconPath)

        self.parent = parent