Exemplo n.º 1
0
  def _createSmall(self):
    """Make the internals of the widget to display in the
    Data Probe frame (lower left of slicer main window by default)"""

    # this method makes SliceView Annotation
    self.sliceAnnotations = DataProbeLib.SliceAnnotations()

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()

    # image view: To ensure the height of the checkbox matches the height of the
    # viewerFrame, it is added to a frame setting the layout and hard-coding the
    # content margins.
    # TODO: Revisit the approach and avoid hard-coding content margins
    self.showImageFrame = qt.QFrame(self.frame)
    self.frame.layout().addWidget(self.showImageFrame)
    self.showImageFrame.setLayout(qt.QHBoxLayout())
    self.showImageFrame.layout().setContentsMargins(0, 3, 0, 3)
    self.showImageBox = qt.QCheckBox('Show Zoomed Slice', self.showImageFrame)
    self.showImageFrame.layout().addWidget(self.showImageBox)
    self.showImageBox.connect("toggled(bool)", self.onShowImage)
    self.showImageBox.setChecked(False)

    self.imageLabel = qt.QLabel()

    # qt.QSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding)
    # fails on some systems, therefore set the policies using separate method calls
    qSize = qt.QSizePolicy()
    qSize.setHorizontalPolicy(qt.QSizePolicy.Expanding)
    qSize.setVerticalPolicy(qt.QSizePolicy.Expanding)
    self.imageLabel.setSizePolicy(qSize)
    #self.imageLabel.setScaledContents(True)
    self.frame.layout().addWidget(self.imageLabel)
    self.onShowImage(False)

    # top row - things about the viewer itself
    self.viewerFrame = qt.QFrame(self.frame)
    self.viewerFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.viewerFrame)
    self.viewerColor = qt.QLabel(self.viewerFrame)
    self.viewerFrame.layout().addWidget(self.viewerColor)
    self.viewInfo = qt.QLabel()
    self.viewerFrame.layout().addWidget(self.viewInfo)

    self.viewerFrame.layout().addStretch(1)

    def _setFixedFontFamily(widget, family='Monospace'):
      font = widget.font
      font.setFamily(family)
      widget.font = font

    _setFixedFontFamily(self.viewInfo)

    # the grid - things about the layers
    # this method makes labels
    self.layerGrid = qt.QFrame(self.frame)
    layout = qt.QGridLayout()
    self.layerGrid.setLayout(layout)
    self.frame.layout().addWidget(self.layerGrid)
    layers = ('L', 'F', 'B')
    self.layerNames = {}
    self.layerIJKs = {}
    self.layerValues = {}
    for (row, layer) in enumerate(layers):
      col = 0
      layout.addWidget(qt.QLabel(layer), row, col)
      col += 1
      self.layerNames[layer] = qt.QLabel()
      layout.addWidget(self.layerNames[layer], row, col)
      col += 1
      self.layerIJKs[layer] = qt.QLabel()
      layout.addWidget(self.layerIJKs[layer], row, col)
      col += 1
      self.layerValues[layer] = qt.QLabel()
      layout.addWidget(self.layerValues[layer], row, col)
      layout.setColumnStretch(col, 100)

      _setFixedFontFamily(self.layerNames[layer])
      _setFixedFontFamily(self.layerIJKs[layer])
      _setFixedFontFamily(self.layerValues[layer])

    # information collected about the current crosshair position
    # from displayable managers registered to the current view
    self.displayableManagerInfo = qt.QLabel()
    self.displayableManagerInfo.indent = 6
    self.displayableManagerInfo.wordWrap = True
    self.frame.layout().addWidget(self.displayableManagerInfo)
    # only show if not empty
    self.displayableManagerInfo.hide()

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()
Exemplo n.º 2
0
 def ColorBarEnabled(self):
     """ it Makes appear the scalar bar for the background volumes"""
     sliceAnnotations = DataProbeLib.SliceAnnotations()
     sliceAnnotations.scalarBarEnabled = 1
     sliceAnnotations.updateSliceViewFromGUI()
Exemplo n.º 3
0
  def createSmall(self):
    """Make the internals of the widget to display in the
    Data Probe frame (lower left of slicer main window by default)"""

    # this method makes SliceView Annotation
    self.sliceAnnotations = DataProbeLib.SliceAnnotations()

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()

    # top row - things about the viewer itself
    self.viewerFrame = qt.QFrame(self.frame)
    self.viewerFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.viewerFrame)
    self.viewerColor = qt.QLabel(self.viewerFrame)
    self.viewerFrame.layout().addWidget(self.viewerColor)
    self.viewerName = qt.QLabel(self.viewerFrame)
    self.viewerFrame.layout().addWidget(self.viewerName)
    self.viewerRAS = qt.QLabel()
    self.viewerFrame.layout().addWidget(self.viewerRAS)
    self.viewerOrient = qt.QLabel()
    self.viewerFrame.layout().addWidget(self.viewerOrient)
    self.viewerSpacing = qt.QLabel()
    self.viewerFrame.layout().addWidget(self.viewerSpacing)
    self.viewerFrame.layout().addStretch(1)

    # the grid - things about the layers
    # this method makes labels
    self.layerGrid = qt.QFrame(self.frame)
    self.layerGrid.setLayout(qt.QGridLayout())
    self.frame.layout().addWidget(self.layerGrid)
    layers = ('L', 'F', 'B')
    self.layerNames = {}
    self.layerIJKs = {}
    self.layerValues = {}
    row = 0
    for layer in layers:
      col = 0
      self.layerGrid.layout().addWidget(qt.QLabel(layer), row, col)
      col += 1
      self.layerNames[layer] = qt.QLabel()
      self.layerGrid.layout().addWidget(self.layerNames[layer], row, col)
      col += 1
      self.layerIJKs[layer] = qt.QLabel()
      self.layerGrid.layout().addWidget(self.layerIJKs[layer], row, col)
      col += 1
      self.layerValues[layer] = qt.QLabel()
      self.layerGrid.layout().addWidget(self.layerValues[layer], row, col)
      self.layerGrid.layout().setColumnStretch(col,100)
      col += 1
      row += 1

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()
Exemplo n.º 4
0
  def createSmall(self):
    """Make the internals of the widget to display in the
    Data Probe frame (lower left of slicer main window by default)"""

    # this method makes SliceView Annotation
    self.sliceAnnotations = DataProbeLib.SliceAnnotations()

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()

    # image view
    self.showImageBox = qt.QCheckBox('Show Zoomed Slice', self.frame)
    self.frame.layout().addWidget(self.showImageBox)
    self.showImageBox.connect("toggled(bool)", self.onShowImage)
    self.showImageBox.setChecked(False)

    self.imageLabel = qt.QLabel()
    self.imagePixmap = qt.QPixmap()
    # qt.QSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding)
    # fails on some systems, therefore set the policies using separate method calls
    qSize = qt.QSizePolicy()
    qSize.setHorizontalPolicy(qt.QSizePolicy.Expanding)
    qSize.setVerticalPolicy(qt.QSizePolicy.Expanding)
    self.imageLabel.setSizePolicy(qSize)
    #self.imageLabel.setScaledContents(True)
    self.frame.layout().addWidget(self.imageLabel)
    self.onShowImage(False)

    # top row - things about the viewer itself
    self.viewerFrame = qt.QFrame(self.frame)
    self.viewerFrame.setLayout(qt.QHBoxLayout())
    self.frame.layout().addWidget(self.viewerFrame)
    self.viewerColor = qt.QLabel(self.viewerFrame)
    self.viewerFrame.layout().addWidget(self.viewerColor)
    self.viewInfo = qt.QLabel()
    self.viewerFrame.layout().addWidget(self.viewInfo)

    self.viewerFrame.layout().addStretch(1)

    def _setFixedFontFamily(widget, family='Monospace'):
      font = widget.font
      font.setFamily(family)
      widget.font = font

    _setFixedFontFamily(self.viewInfo)

    # the grid - things about the layers
    # this method makes labels
    self.layerGrid = qt.QFrame(self.frame)
    layout = qt.QGridLayout()
    self.layerGrid.setLayout(layout)
    self.frame.layout().addWidget(self.layerGrid)
    layers = ('L', 'F', 'B')
    self.layerNames = {}
    self.layerIJKs = {}
    self.layerValues = {}
    for (row, layer) in enumerate(layers):
      col = 0
      layout.addWidget(qt.QLabel(layer), row, col)
      col += 1
      self.layerNames[layer] = qt.QLabel()
      layout.addWidget(self.layerNames[layer], row, col)
      col += 1
      self.layerIJKs[layer] = qt.QLabel()
      layout.addWidget(self.layerIJKs[layer], row, col)
      col += 1
      self.layerValues[layer] = qt.QLabel()
      layout.addWidget(self.layerValues[layer], row, col)
      layout.setColumnStretch(col, 100)

      _setFixedFontFamily(self.layerNames[layer])
      _setFixedFontFamily(self.layerIJKs[layer])
      _setFixedFontFamily(self.layerValues[layer])

    # goto module button
    self.goToModule = qt.QPushButton('->', self.frame)
    self.goToModule.setToolTip('Go to the DataProbe module for more information and options')
    self.frame.layout().addWidget(self.goToModule)
    self.goToModule.connect("clicked()", self.onGoToModule)
    # hide this for now - there's not much to see in the module itself
    self.goToModule.hide()