Ejemplo n.º 1
0
    def load_projection_angles(self):
        stack_selector = StackSelectorDialog(
            main_window=self,
            title="Stack Selector",
            message=self.LOAD_PROJECTION_ANGLES_DIALOG_MESSAGE)
        # Was closed without accepting (e.g. via x button or ESC)
        if QDialog.DialogCode.Accepted != stack_selector.exec():
            return

        stack_name = stack_selector.selected_stack

        selected_file, _ = QFileDialog.getOpenFileName(
            caption=self.LOAD_PROJECTION_ANGLES_FILE_DIALOG_CAPTION,
            filter="All (*.*)")
        if selected_file == "":
            return

        pafp = ProjectionAngleFileParser(selected_file)
        projection_angles = pafp.get_projection_angles()

        self.presenter.add_projection_angles_to_sample(stack_name,
                                                       projection_angles)
        QMessageBox.information(
            self, "Load complete",
            f"Angles from {selected_file} were loaded into into "
            f"{stack_name}.")
Ejemplo n.º 2
0
    def load_180_deg_dialog(self):
        stack_selector = StackSelectorDialog(
            main_window=self,
            title="Stack Selector",
            message="Which stack is the 180 degree projection being loaded for?"
        )
        # Was closed without accepting (e.g. via x button or ESC)
        if QDialog.Accepted != stack_selector.exec():
            return
        stack_to_add_180_deg_to = stack_selector.selected_stack

        # Open file dialog
        file_filter = "Image File (*.tif *.tiff)"
        selected_file, _ = QFileDialog.getOpenFileName(
            caption="180 Degree Image",
            filter=f"{file_filter};;All (*.*)",
            initialFilter=file_filter)
        # Cancel/Close was clicked
        if selected_file == "":
            return

        _180_dataset = self.presenter.add_180_deg_to_sample(
            stack_name=stack_to_add_180_deg_to, _180_deg_file=selected_file)
        self.create_new_stack(_180_dataset,
                              self.presenter.create_stack_name(selected_file))
Ejemplo n.º 3
0
    def load_sample_log_dialog(self):
        stack_selector = StackSelectorDialog(
            main_window=self,
            title="Stack Selector",
            message="Which stack is the log being loaded for?")
        # Was closed without accepting (e.g. via x button or ESC)
        if QDialog.Accepted != stack_selector.exec():
            return
        stack_to_add_log_to = stack_selector.selected_stack

        # Open file dialog
        file_filter = "Log File (*.txt *.log)"
        selected_file, _ = QFileDialog.getOpenFileName(
            caption="Log to be loaded",
            filter=f"{file_filter};;All (*.*)",
            initialFilter=file_filter)
        # Cancel/Close was clicked
        if selected_file == "":
            return

        self.presenter.add_log_to_sample(stack_name=stack_to_add_log_to,
                                         log_file=selected_file)

        QMessageBox.information(
            self, "Load complete", f"{selected_file} was loaded as a log into "
            f"{stack_to_add_log_to}.")
Ejemplo n.º 4
0
    def load_sample_log_dialog(self):
        stack_selector = StackSelectorDialog(
            main_window=self,
            title="Stack Selector",
            message="Which stack is the log being loaded for?")
        # Was closed without accepting (e.g. via x button or ESC)
        if QDialog.DialogCode.Accepted != stack_selector.exec():
            return
        stack_to_add_log_to = stack_selector.selected_stack

        # Open file dialog
        selected_file = self._get_file_name("Log to be loaded",
                                            "Log File (*.txt *.log *.csv)")

        # Cancel/Close was clicked
        if selected_file == "":
            return

        self.presenter.add_log_to_sample(stack_name=stack_to_add_log_to,
                                         log_file=selected_file)

        QMessageBox.information(
            self, "Load complete", f"{selected_file} was loaded as a log into "
            f"{stack_to_add_log_to}.")