Commit 21248ad8 authored by Thomas Vincent's avatar Thomas Vincent

Merge branch 'fix-centroid' into 'master'

fixed calculation of center of mass in the presence of ROIs

See merge request !99
parents d9c0fd18 1c32377a
Pipeline #6781 passed with stages
in 5 minutes and 13 seconds
......@@ -367,18 +367,18 @@ def _fit_process(index,
qspace_h5, axes, hits = _per_process_cache
# Load qspace
qspace = qspace_h5.qspace_slice(index)
# apply Qspace ROI
if roi_indices is not None:
dim0_slice = slice(roi_indices[0][0], roi_indices[0][1], 1)
dim1_slice = slice(roi_indices[1][0], roi_indices[1][1], 1)
dim2_slice = slice(roi_indices[2][0], roi_indices[2][1], 1)
axes = [axis[roi] for axis, roi in
zip(axes, (dim0_slice, dim1_slice, dim2_slice))]
hits = hits[dim0_slice, dim1_slice, dim2_slice]
qspace = qspace[dim0_slice, dim1_slice, dim2_slice]
qslice = numpy.s_[roi_indices[0][0]:roi_indices[0][1],
axes = [axis[roi] for axis, roi in zip(axes, qslice)]
qspace = qspace_h5.qspace_slice((index,) + qslice)
hits = hits[qslice]
qspace = qspace_h5.qspace_slice(index)
# Normalize with hits and project to axes
projections = project(qspace, hits)
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