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

DicomStack.to_nifti(embed_meta=True) fails for 5D and 4D dicoms #91

Open
AlanKuurstra opened this issue Sep 19, 2024 · 0 comments
Open

Comments

@AlanKuurstra
Copy link

When embedding metadata, DicomStack does not account for 5D or 4D data stored in a single dicom.

if len(data.shape) == 5:
if data.shape[3] != 1:
vec_meta = []
for vec_idx in range(data.shape[4]):
start_idx = vec_idx * data.shape[3]
end_idx = start_idx + data.shape[3]
meta = DcmMetaExtension.from_sequence(
vol_meta[start_idx:end_idx], 3)
vec_meta.append(meta)
else:
vec_meta = vol_meta
meta_ext = DcmMetaExtension.from_sequence(vec_meta, 4)
elif len(data.shape) == 4:
meta_ext = DcmMetaExtension.from_sequence(vol_meta, 3)

The if statements on len(data.shape) should also include a condition on len(vol_meta) > 1

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

1 participant