def do_load_stack(self, parameters: LoadingParameters, progress): ds = Dataset( loader.load_p(parameters.sample, parameters.dtype, progress)) ds.sample._is_sinograms = parameters.sinograms ds.sample.pixel_size = parameters.pixel_size if parameters.sample.log_file: ds.sample.log_file = loader.load_log(parameters.sample.log_file) if parameters.flat_before: ds.flat_before = loader.load_p(parameters.flat_before, parameters.dtype, progress) if parameters.flat_before.log_file: ds.flat_before.log_file = loader.load_log( parameters.flat_before.log_file) if parameters.flat_after: ds.flat_after = loader.load_p(parameters.flat_after, parameters.dtype, progress) if parameters.flat_after.log_file: ds.flat_after.log_file = loader.load_log( parameters.flat_after.log_file) if parameters.dark_before: ds.dark_before = loader.load_p(parameters.dark_before, parameters.dtype, progress) if parameters.dark_after: ds.dark_after = loader.load_p(parameters.dark_after, parameters.dtype, progress) if parameters.proj_180deg: ds.sample.proj180deg = loader.load_p(parameters.proj_180deg, parameters.dtype, progress) return ds
def add_log_to_sample(self, images_id: uuid.UUID, log_file: str): images = self.get_images_by_uuid(images_id) if images is None: raise RuntimeError log = loader.load_log(log_file) log.raise_if_angle_missing(images.filenames) images.log_file = log
def ensure_sample_log_consistency(self, field: Field, file_name, image_filenames): if file_name is None or file_name == "": return log = load_log(file_name) log.raise_if_angle_missing(image_filenames) self._update_field_action(field, file_name)
def add_log_to_sample(self, stack_name: str, log_file: str): stack_dock = self.get_stack_by_name(stack_name) if stack_dock is None: raise RuntimeError(f"Failed to get stack with name {stack_name}") stack: StackVisualiserView = stack_dock.widget() # type: ignore log = loader.load_log(log_file) log.raise_if_angle_missing(stack.presenter.images.filenames) stack.presenter.images.log_file = log
def do_load_dataset(self, parameters: LoadingParameters, progress) -> Dataset: sample = loader.load_p(parameters.sample, parameters.dtype, progress) ds = Dataset(sample) sample._is_sinograms = parameters.sinograms sample.pixel_size = parameters.pixel_size if parameters.sample.log_file: ds.sample.log_file = loader.load_log(parameters.sample.log_file) if parameters.flat_before: flat_before = loader.load_p(parameters.flat_before, parameters.dtype, progress) ds.flat_before = flat_before if parameters.flat_before.log_file: flat_before.log_file = loader.load_log( parameters.flat_before.log_file) if parameters.flat_after: flat_after = loader.load_p(parameters.flat_after, parameters.dtype, progress) ds.flat_after = flat_after if parameters.flat_after.log_file: flat_after.log_file = loader.load_log( parameters.flat_after.log_file) if parameters.dark_before: dark_before = loader.load_p(parameters.dark_before, parameters.dtype, progress) ds.dark_before = dark_before if parameters.dark_after: dark_after = loader.load_p(parameters.dark_after, parameters.dtype, progress) ds.dark_after = dark_after if parameters.proj_180deg: sample.proj180deg = loader.load_p(parameters.proj_180deg, parameters.dtype, progress) self.datasets[ds.id] = ds return ds