Commit 6baf6029 authored by Thomas Vincent's avatar Thomas Vincent

store image roi offset instead of correcting center channel during merge

parent 1fdc7245
......@@ -755,6 +755,12 @@ def _add_edf_data(scan_id,
float(chan_per_deg[1])],
entry=entry)
if center_chan is not None:
# Write center channel corrected with image ROI offset
entry_h5f.set_direct_beam([float(center_chan[0]),
float(center_chan[1])],
entry=entry)
progress[proc_idx] = 2
edf_file = EdfFile.EdfFile(img_f, access='r', fastedf=True)
progress[proc_idx] = 5
......@@ -766,7 +772,7 @@ def _add_edf_data(scan_id,
img_shape = image.shape
row, column = 0, 0 # Offset in images
if image_roi: # Use ROI and clip it with image shape
if image_roi is not None: # Use ROI and clip it with image shape
row, column, height, width = image_roi
if row >= img_shape[0] or column >= img_shape[1]:
raise ValueError('Image ROI defined outside image')
......@@ -777,14 +783,13 @@ def _add_edf_data(scan_id,
_logger.warning(
'Image ROI clipped: It was larger than images')
if center_chan is not None:
# Write center channel corrected with image ROI offset
entry_h5f.set_direct_beam([float(center_chan[0] - row),
float(center_chan[1]) - column],
entry=entry)
# Write image roi offset to file
entry_h5f.set_image_roi_offset((row, column), entry=entry)
dset_shape = n_images, img_shape[0], img_shape[1]
dset_shape = (n_images, img_shape[0], img_shape[1])
chunks = (1, dset_shape[1]//4, dset_shape[2]//4)
# TODO rework chunking
chunks = 1, dset_shape[1]//4, dset_shape[2]//4
with entry_h5f.image_dset_ctx(entry=entry,
create=True,
......
Markdown is supported
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