Пример #1
0
    def completed(self):
        self.check_for_unsaved_changes()

        state = {'rect': []}
        files = []
        for key, val in self.edited_images.items():
            HexrdConfig().add_detector(key, 'default')
            HexrdConfig().set_instrument_config_val(
                ['detectors', key, 'pixels', 'columns', 'value'],
                int(val['width']))
            HexrdConfig().set_instrument_config_val(
                ['detectors', key, 'pixels', 'rows', 'value'],
                int(val['height']))
            state['rect'].append(val['rect'])
            files.append([val['img']])
        HexrdConfig().remove_detector('default')
        ilm = ImageLoadManager()
        ilm.read_data(files, parent=self.ui)
        ilm.set_state(state)
        ilm.begin_processing()
        self.new_config_loaded.emit()

        self.reset_panel()
        self.parent().action_show_toolbar.setEnabled(True)
        self.parent().action_show_toolbar.setChecked(True)
Пример #2
0
    def finalize(self):
        self.it.cropped_image
        img = self.it.masked_image

        ilm = ImageLoadManager()
        self.cmap.block_updates(True)
        ilm.read_data([[img]], parent=self.ui)
        if self.instrument == 'PXRDIP':
            ilm.set_state({'trans': [UI_TRANS_INDEX_ROTATE_90]})
            ilm.begin_processing(postprocess=True)
            img = HexrdConfig().image(self.detector, 0)
        self.cmap.block_updates(False)

        self.it.update_image(img)
        self.edited_images[self.detector] = {
            'img': img,
            'height': img.shape[0],
            'width': img.shape[1],
            'tilt': self.it.rotation
        }
        self.canvas.axes_images[0].set_extent(
            (0, img.shape[1], img.shape[0], 0))

        self.it.redraw()
        self.clear_boundry()