Commit faf92356 authored by payno's avatar payno Committed by Henri Payno
Browse files

[core][normalization] clamp manual ROI if / when necessary

parent b99e8938
......@@ -197,6 +197,11 @@ class IntensityNormalizationProcess(SingleProcess, SuperviseProcess):
start_y = int(start_y)
end_x = int(end_x)
end_y = int(end_y)
# clamp ROI with 0 border
start_x = max(0, start_x)
start_y = max(0, start_y)
end_x = max(0, end_x)
end_y = max(0, end_y)
scan = dataset_identifier.recreate_dataset()
projections = scan.projections
if calc_area is _CalculationArea.VOLUME:
......@@ -244,6 +249,13 @@ class IntensityNormalizationProcess(SingleProcess, SuperviseProcess):
append_url(url)
data = silx.io.get_data(url)
if data.ndim < 2:
raise ValueError("data is expected to be at least 2D")
# clamp ROI with frame size
start_x = min(data.shape[-1], start_x)
start_y = min(data.shape[-2], start_y)
end_x = min(data.shape[-1], end_x)
end_y = min(data.shape[-2], end_y)
def retrieve_data_proj_indexes(url_):
urls = []
......
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