Commit 47c1a579 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

Plug sinogram array normalization in FF pipeline

parent 80450156
......@@ -2,6 +2,7 @@ import os
import posixpath
import numpy as np
from silx.io import get_data
from silx.io.url import DataUrl
from ...utils import copy_dict_items, compare_dicts
from ...io.utils import hdf5_entry_exists, get_h5_value
from ...io.reader import import_h5_to_dict
......@@ -33,6 +34,7 @@ class ProcessConfig(ProcessConfigBase):
self._update_rotation_angles()
self._get_translation_file("reconstruction", "translation_movements_file", "translations")
self._get_translation_file("phase", "ctf_translations_file", "ctf_translations")
self._get_user_sino_normalization()
def _get_translation_file(self, config_section, config_key, dataset_info_attr):
......@@ -143,6 +145,23 @@ class ProcessConfig(ProcessConfigBase):
self.dataset_info.axis_position = cor
def _get_user_sino_normalization(self):
self._sino_normalization_arr = None
norm = nabu_config["preproc"]["sino_normalization"]
if norm not in ["subtraction", "division"]:
return
norm_path = "silx://" + self.nabu_config["preproc"]["sino_normalization_file"].strip()
url = DataUrl(norm_path)
try:
norm_array = get_data(url)
except (ValueError, OSError) as exc:
self.logger.error(
"Could not load sino_normalization_file %s. The error was:" % norm_path
)
self.logger.error(str(exc))
self._sino_normalization_arr = norm_array.astype("f")
@property
def do_halftomo(self):
"""
......@@ -312,8 +331,10 @@ class ProcessConfig(ProcessConfigBase):
if nabu_config["preproc"]["sino_normalization"] is not None:
tasks.append("sino_normalization")
options["sino_normalization"] = {
"method": nabu_config["preproc"]["sino_normalization"]
"method": nabu_config["preproc"]["sino_normalization"],
"normalization_array": self._sino_normalization_arr
}
#
# Sinogram-based rings artefacts removal
#
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment