Commit a765355c authored by Henri Payno's avatar Henri Payno Committed by Henri Payno
Browse files

[core][normalization] readapt the normalization to fit latest ewoks

parent 268b99c4
......@@ -34,6 +34,7 @@ __license__ = "MIT"
__date__ = "25/06/2021"
from tomwer.core.process.task import Task
from .params import (
IntensityNormalizationParams,
Method,
......@@ -41,9 +42,7 @@ from .params import (
_ValueCalculationMethod,
_ValueCalculationFct,
)
from tomwer.core.process.baseprocess import SingleProcess, _input_desc, _output_desc
from processview.core.superviseprocess import SuperviseProcess
from tomwer.core.scan.scanbase import TomwerScanBase
from silx.io.url import DataUrl
from silx.io.utils import get_data
from processview.core.dataset import DatasetIdentifier
......@@ -60,21 +59,15 @@ from tomoscan.normalization import Method as TomoScanMethod
_logger = logging.getLogger(__name__)
class IntensityNormalizationProcess(SingleProcess, SuperviseProcess):
class IntensityNormalizationProcess(
Task, SuperviseProcess, input_names=("data",), output_names=("data",)
):
"""
Main process to launch several reconstruction of a single slice with
several Center Of Rotation (cor) values
Task to define the normalization to apply to a sinogram
"""
inputs = [
_input_desc(
name="data", type=TomwerScanBase, handler="pathReceived", doc="scan path"
),
]
outputs = [_output_desc(name="data", type=TomwerScanBase, doc="scan path")]
def __init__(self, process_id=None, dump_process=True):
SingleProcess.__init__(self)
def __init__(self, process_id=None, varinfo=None, inputs=None, label=None):
Task.__init__(self, varinfo=varinfo, inputs=inputs, label=label)
SuperviseProcess.__init__(self, process_id=process_id)
self._dry_run = False
......@@ -87,9 +80,10 @@ class IntensityNormalizationProcess(SingleProcess, SuperviseProcess):
def set_configuration(self, configuration: dict) -> None:
self.set_properties(configuration)
def process(self, scan: typing.Union[None, TomwerScanBase] = None):
def run(self):
scan = self.inputs.data
if scan is None:
return None
return
scan.intensity_normalization.tomwer_processing_res_code = None
params = IntensityNormalizationParams.from_dict(self._settings)
try:
......@@ -125,7 +119,7 @@ class IntensityNormalizationProcess(SingleProcess, SuperviseProcess):
extra_infos=params.extra_infos,
)
return scan
self.outputs.data = scan
def _compute_from_manual_roi(self, scan):
params = IntensityNormalizationParams.from_dict(self.get_configuration())
......
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