Empty series and slice mask functions column rather than row first
Hi!
I noticed when working with uneven MRI volumes that the order of rows and columns is not consistent throughout. In most parts of the repo the order is correctly row-major, but for creating empty series and slice masks the order is reversed to column-major. Is this intentional and if so why?
def create_empty_series_mask(series_data):
ref_dicom_image = series_data[0]
mask_dims = (
int(ref_dicom_image.Columns),
int(ref_dicom_image.Rows),
len(series_data),
)
mask = np.zeros(mask_dims).astype(bool)
return mask
def create_empty_slice_mask(series_slice):
mask_dims = (int(series_slice.Columns), int(series_slice.Rows))
mask = np.zeros(mask_dims).astype(bool)
return mask
Would be happy to send a PR changing these methods to row-major as well.
Thanks!
Hello @nieag,
Thanks for your message. I can't think of any reason why the order should be reversed for those two functions... it is possible that this is a bug. As far as I know, numpy also stores its data row-major by default. Perhaps we've missed this since working with CT data, slice size always have 512 x 512 dimensions so rows == columns...? (@carluri any thoughts?)
I'd say it's a bug and needs fix. Could you please open up a PR? It'd be really important if you could test it with non-square slice dimensions so that we can see that the current implementation is buggy, and the PR would fix it. I'd be very happy to review this PR.
Thank you so much for your contributions and for using the tool!
Best regards,
Pedro
Hey, Sorry, this got dropped a bit during vacation. I'll see if I can put together a test case and PR with the proposed fix!
Thanks!