Exemplo n.º 1
0
    def __init__(self, centre_sx_sy, grid_size_selector, sem, stage, ovm, acq,
                 img_inspector, viewport_trigger):
        super().__init__()
        loadUi('..\\gui\\stub_ov_dlg.ui', self)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowIcon(QIcon('..\\img\\icon_16px.ico'))
        self.setFixedSize(self.size())
        self.show()
        self.sem = sem
        self.stage = stage
        self.ovm = ovm
        self.acq = acq
        self.img_inspector = img_inspector
        self.viewport_trigger = viewport_trigger
        self.acq_in_progress = False
        self.error_msg_from_acq_thread = ''

        # Set up trigger and queue to update dialog GUI during acquisition
        self.stub_dlg_trigger = utils.Trigger()
        self.stub_dlg_trigger.signal.connect(self.process_thread_signal)
        self.abort_queue = Queue()
        self.pushButton_acquire.clicked.connect(self.start_stub_ov_acquisition)
        self.pushButton_abort.clicked.connect(self.abort)
        self.spinBox_X.setValue(centre_sx_sy[0])
        self.spinBox_Y.setValue(centre_sx_sy[1])
        self.grid_size_selector = grid_size_selector
        self.durations = []

        # Show available grid sizes and the corresponding estimated
        # durations in min
        tile_width = self.ovm['stub'].frame_size[0]
        tile_height = self.ovm['stub'].frame_size[1]
        overlap = self.ovm['stub'].overlap
        pixel_size = self.ovm['stub'].pixel_size
        cycle_time = self.ovm['stub'].tile_cycle_time()
        motor_move_time = self.stage.stage_move_duration(
            *self.ovm['stub'][0].sx_sy, *self.ovm['stub'][1].sx_sy)

        self.grid_size_list = []
        for grid_size in self.ovm['stub'].GRID_SIZE:
            rows, cols = grid_size
            width = int(
                (cols * tile_width - (cols - 1) * overlap) * pixel_size / 1000)
            height = int((rows * tile_height - (rows - 1) * overlap) *
                         pixel_size / 1000)
            duration = int(
                round(
                    (rows * cols * (cycle_time + motor_move_time) + 30) / 60))

            self.grid_size_list.append(
                str(width) + ' µm × ' + str(height) + ' µm')
            self.durations.append('Up to ~' + str(duration) + ' min')
        # Grid size selection
        self.comboBox_sizeSelector.addItems(self.grid_size_list)
        self.comboBox_sizeSelector.setCurrentIndex(self.grid_size_selector)
        self.comboBox_sizeSelector.currentIndexChanged.connect(
            self.update_duration)
        self.label_duration.setText(self.durations[self.grid_size_selector])
        self.previous_centre_sx_sy = self.ovm['stub'].centre_sx_sy
        self.previous_grid_size_selector = self.ovm['stub'].grid_size_selector
Exemplo n.º 2
0
 def update_viewport_with_delay(self):
     """Redraw the viewport without suppressing labels/previews after at
     least 0.3 seconds have passed since last update of the rotation angle."""
     finish_trigger = utils.Trigger()
     finish_trigger.signal.connect(self.draw_with_labels)
     current_time = self.time_of_last_rotation
     while (current_time - self.time_of_last_rotation < 0.3):
         sleep(0.1)
         current_time += 0.1
     self.rotation_in_progress = False
     finish_trigger.signal.emit()
Exemplo n.º 3
0
    def __init__(self, centre_sx_sy, sem, stage, ovm, acq, img_inspector,
                 viewport_trigger):
        super().__init__()
        loadUi('..\\gui\\stub_ov_dlg.ui', self)
        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowIcon(QIcon('..\\img\\icon_16px.ico'))
        self.setFixedSize(self.size())
        self.show()
        self.sem = sem
        self.stage = stage
        self.ovm = ovm
        self.acq = acq
        self.img_inspector = img_inspector
        self.viewport_trigger = viewport_trigger
        self.acq_in_progress = False
        self.error_msg_from_acq_thread = ''

        # Set up trigger and queue to update dialog GUI during acquisition
        self.stub_dlg_trigger = utils.Trigger()
        self.stub_dlg_trigger.signal.connect(self.process_thread_signal)
        self.abort_queue = Queue()
        self.pushButton_acquire.clicked.connect(self.start_stub_ov_acquisition)
        self.pushButton_abort.clicked.connect(self.abort)
        self.spinBox_X.setValue(centre_sx_sy[0])
        self.spinBox_Y.setValue(centre_sx_sy[1])
        self.spinBox_rows.setValue(ovm['stub'].size[0])
        self.spinBox_cols.setValue(ovm['stub'].size[1])
        self.spinBox_rows.valueChanged.connect(
            self.update_dimension_and_duration_display)
        self.spinBox_cols.valueChanged.connect(
            self.update_dimension_and_duration_display)
        self.update_dimension_and_duration_display()
        # Save previous settings. If user aborts the stub OV acquisition
        # revert to these settings.
        self.previous_centre_sx_sy = self.ovm['stub'].centre_sx_sy
        self.previous_grid_size = self.ovm['stub'].size