예제 #1
0
    def update_roi_params(roi: pg.RectROI):
        if gv.h5f is None:
            return

        _pos = [roi.pos().x(), roi.pos().y()]
        _size = [roi.size().x(), roi.size().y()]

        gv.w.gb_roi.le_roi_data.setText(
            'Pos {:.1f}/{:.1f} / Size {:.1f}/{:.1f}'.format(*_pos, *_size))
        if gv.KEY_PROCESSED in gv.h5f:
            processed = gv.h5f[gv.KEY_PROCESSED]
            mark = False
            if gv.KEY_ATTR_FILT_ROI_POS in processed.attrs and gv.KEY_ATTR_FILT_ROI_SIZE in processed.attrs:
                _pos_prev = processed.attrs[gv.KEY_ATTR_FILT_ROI_POS]
                _size_prev = processed.attrs[gv.KEY_ATTR_FILT_ROI_SIZE]

                mark = not (np.all(np.isclose(_pos, _pos_prev))
                            and np.all(np.isclose(_size, _size_prev)))

            if mark:
                gv.w.gb_roi.le_roi_data.setStyleSheet('color:#FF0000')
            else:
                gv.w.gb_roi.le_roi_data.setStyleSheet('color:#000000')

        gv.h5f.attrs[gv.KEY_ATTR_FILT_ROI_POS] = _pos
        gv.h5f.attrs[gv.KEY_ATTR_FILT_ROI_SIZE] = _size

        gv.w.update_roi_len_params('xy')
예제 #2
0
    def __init__(self, value: RoiParameters):
        AbstractROI.__init__(self, value)
        RectROI.__init__(self, pos=(0, 0), size=(1, 1))

        self.init_roi()
        self.handle = self.handles[0]['item']
        self.sigRegionChanged.connect(self.handle_is_moving)
예제 #3
0
    def __init__(self, roi: Roi, enable_context: bool = True, **kwargs):
        AbstractRoiWidget.__init__(self, roi, enable_context=enable_context, **kwargs)
        RectROI.__init__(self, pos=(0, 0), size=(1, 1), centered=False, sideScalers=False)

        self.addScaleHandle([0.5, 0], [0.5, 1])
        self.addScaleHandle([0.5, 1], [0.5, 0])
        self.addScaleHandle([0, 0.5], [1, 0.5])
        self.addScaleHandle([1, 0.5], [0, 0.5])

        self.handle = self.handles[0]['item']
        self.handles.pop(0)
        self.handle.disconnectROI(self)
        self.handle.hide()  # how to remove???
        self.sigRegionChanged.connect(self._handle_is_moving)
        self.update_roi()

        if App().debug_tracker:
            App().debug_tracker.add_object(self, roi.name)
예제 #4
0
    def update_scan_area_type(self):

        if self.settings.child('scan_options',
                               'scan_type').value() == 'Scan1D':
            scan_area_type = 'PolyLines'
        else:
            scan_area_type = 'Rect'

        self.remove_scan_selector()
        if scan_area_type == 'Rect':
            self.scan_selector = RectROI([0, 0], [10, 10])

        elif scan_area_type == 'PolyLines':
            self.scan_selector = PolyLineROI_custom([(0, 0), [10, 10]])
        if self.scan_selector_source is not None:
            self.scan_selector.sigRegionChangeFinished.connect(
                self.update_scan)
            self.scan_selector_source.image_widget.plotitem.addItem(
                self.scan_selector)
            self.show_scan_selector()

            self.scan_selector.sigRegionChangeFinished.emit(self.scan_selector)
예제 #5
0
 def mouseDragEvent(self, ev):
     if self.roi.movable:
         RectROI.mouseDragEvent(self, ev)
         self.send_move()
예제 #6
0
 def mouseDragEvent(self, ev):
     RectROI.mouseDragEvent(self, ev)
     self.send_value()