Commit 8108b99f authored by Thomas Vincent's avatar Thomas Vincent

fix test of mask size with image ROI

parent b840ae13
......@@ -328,11 +328,15 @@ class QSpaceConverter(object):
if mask.ndim != 2:
raise ValueError('Mask is not an image')
# TODO this might be a problem when saving a subset of the images
with XsocsH5.XsocsH5(self.__xsocsH5_f) as xsocsH5:
image_size = xsocsH5.image_size()
if image_size != mask.shape:
raise ValueError('Mask has not the size of the images')
image_roi_offset = xsocsH5.image_roi_offset()
if image_roi_offset is None:
image_roi_offset = 0, 0
if (image_size[0] + image_roi_offset[0] > mask.shape[0] or
image_size[1] + image_roi_offset[1] > mask.shape[1]):
raise ValueError(
'Mask is too small for image size and ROI information')
self.__params['mask'] = mask
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment