Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty series and slice mask functions column rather than row first #88

Open
nieag opened this issue Jun 1, 2023 · 2 comments
Open

Empty series and slice mask functions column rather than row first #88

nieag opened this issue Jun 1, 2023 · 2 comments
Assignees

Comments

@nieag
Copy link

nieag commented Jun 1, 2023

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!

@plesqui
Copy link
Collaborator

plesqui commented Jul 31, 2023

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

@plesqui plesqui self-assigned this Jul 31, 2023
@nieag
Copy link
Author

nieag commented Aug 24, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants