Example #1
0
    def __init__(self, parent: QWidget):
        ImageView.__init__(self, parent, "MaskView")
        # self.getHistogramWidget().hide()
        self.ui.roiBtn.hide()
        self.ui.menuBtn.hide()

        self.mask: Mask = None
Example #2
0
File: image.py Project: untzag/pydm
    def __init__(self, parent=None, image_channel=None, width_channel=None):
        """Initialize widget."""
        # Set the default colormap.
        self._colormap = PyDMColorMap.Inferno
        self._cm_colors = None
        self._imagechannel = None
        self._widthchannel = None
        self.image_waveform = np.zeros(0)
        self._image_width = 0
        self._normalize_data = False
        self._auto_downsample = True
        self._show_axes = False

        # Set default reading order of numpy array data to Fortranlike.
        self._reading_order = ReadingOrder.Fortranlike

        self._redraw_rate = 30

        # Set color map limits.
        self.cm_min = 0.0
        self.cm_max = 255.0

        plot_item = PlotItem()
        ImageView.__init__(self, parent, view=plot_item)
        PyDMWidget.__init__(self)
        self._channels = [None, None]
        self.thread = None
        self.axes = dict({'t': None, "x": 0, "y": 1, "c": None})
        self.showAxes = self._show_axes
        self.imageItem.setOpts(axisOrder="row-major")

        # Hide some itens of the widget.
        self.ui.histogram.hide()
        self.getImageItem().sigImageChanged.disconnect(
            self.ui.histogram.imageChanged)
        self.ui.roiBtn.hide()
        self.ui.menuBtn.hide()

        # Make a right-click menu for changing the color map.
        self.cm_group = QActionGroup(self)
        self.cmap_for_action = {}
        for cm in self.color_maps:
            action = self.cm_group.addAction(cmap_names[cm])
            action.setCheckable(True)
            self.cmap_for_action[action] = cm

        self.colorMap = self._colormap

        # Setup the redraw timer.
        self.needs_redraw = False
        self.redraw_timer = QTimer(self)
        self.redraw_timer.timeout.connect(self.redrawImage)
        self.maxRedrawRate = self._redraw_rate
        self.newImageSignal = self.getImageItem().sigImageChanged
        # Set live channels if requested on initialization
        if image_channel:
            self.imageChannel = image_channel or ''
        if width_channel:
            self.widthChannel = width_channel or ''
Example #3
0
    def __init__(self, parent=None, image_channel=None, width_channel=None):
        """Initialize widget."""
        ImageView.__init__(self, parent)
        PyDMWidget.__init__(self)
        self._channels = [None, None]
        self.thread = None
        self.axes = dict({'t': None, "x": 0, "y": 1, "c": None})
        self._imagechannel = None
        self._widthchannel = None
        self.image_waveform = np.zeros(0)
        self._image_width = 0
        self._normalize_data = False
        self._auto_downsample = True

        # Hide some itens of the widget.
        self.ui.histogram.hide()
        self.getImageItem().sigImageChanged.disconnect(
            self.ui.histogram.imageChanged)
        self.ui.roiBtn.hide()
        self.ui.menuBtn.hide()

        # Set color map limits.
        self.cm_min = 0.0
        self.cm_max = 255.0

        # Set default reading order of numpy array data to Fortranlike.
        self._reading_order = ReadingOrder.Fortranlike

        # Make a right-click menu for changing the color map.
        self.cm_group = QActionGroup(self)
        self.cmap_for_action = {}
        for cm in self.color_maps:
            action = self.cm_group.addAction(cmap_names[cm])
            action.setCheckable(True)
            self.cmap_for_action[action] = cm

        # Set the default colormap.
        self._colormap = PyDMColorMap.Inferno
        self._cm_colors = None
        self.colorMap = self._colormap

        # Setup the redraw timer.
        self.needs_redraw = False
        self.redraw_timer = QTimer(self)
        self.redraw_timer.timeout.connect(self.redrawImage)
        self._redraw_rate = 30
        self.maxRedrawRate = self._redraw_rate
        self.newImageSignal = self.getImageItem().sigImageChanged
        # Set live channels if requested on initialization
        if image_channel:
            self.imageChannel = image_channel or ''
        if width_channel:
            self.widthChannel = width_channel or ''
Example #4
0
 def __init__(self, parent=None, image_channel=None, width_channel=None):
     ImageView.__init__(self, parent)
     PyDMWidget.__init__(self)
     self.axes = dict({'t': None, "x": 0, "y": 1, "c": None})
     self._imagechannel = image_channel
     self._widthchannel = width_channel
     self.image_waveform = np.zeros(0)
     self.image_width = 0
     self.ui.histogram.hide()
     self.getImageItem().sigImageChanged.disconnect(
         self.ui.histogram.imageChanged)
     self.ui.roiBtn.hide()
     self.ui.menuBtn.hide()
     self.cm_min = 0.0
     self.cm_max = 255.0
     self.data_max_int = None  # This is the max value for the image waveform's data type.  It gets set when the waveform updates.
     # Make a right-click menu for changing the color map.
     cm_menu = self.getView().getMenu(None).addMenu("Color Map")
     self.cm_group = QActionGroup(self)
     self.cmap_for_action = {}
     for cm in self.color_maps:
         action = self.cm_group.addAction(cmap_names[cm])
         action.setCheckable(True)
         cm_menu.addAction(action)
         self.cmap_for_action[action] = cm
     cm_menu.triggered.connect(self.changeColorMap)
     # Set the default colormap.
     self._colormap = PyDMColorMap.Inferno
     self._cm_colors = None
     self.set_color_map_to_preset(self._colormap)
     # Setup the redraw timer.
     self.needs_redraw = False
     self.redraw_timer = QTimer(self)
     self.redraw_timer.timeout.connect(self.redrawImage)
     self._redraw_rate = 30
     self.maxRedrawRate = self._redraw_rate