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

nifti mask to RT-struct dicom #84

Closed
qurit-frizi opened this issue Feb 27, 2023 · 6 comments
Closed

nifti mask to RT-struct dicom #84

qurit-frizi opened this issue Feb 27, 2023 · 6 comments

Comments

@qurit-frizi
Copy link
Collaborator

qurit-frizi commented Feb 27, 2023

I’ve recently designed a model which gives an output mask in nifti format. As I need to have rtstruct created as well, I am leveraging your rt_utils library.
Below is the code I wrote for the same. I am getting the rtstruct which seems to be rotated of flipped. The snapshot shows both nifti mask and generated Dicom rtstruct. Just wanted to check if you’ve happened to see such behavior? It would be great if you could share your thought/recommendations to address this issue.

image

image

@qurit-frizi
Copy link
Collaborator Author

I will add a function to solve this issue.

@MattAWard
Copy link

MattAWard commented Mar 17, 2023

Hi @qurit-frizi could I ask what your solution was for this? I'm having the same problem...

rotated_screengrab

@pritamrungta
Copy link

Hi @qurit-frizi
I'm in a similar situation.
Any ideas to fix would be really helpful.

@MattAWard
Copy link

MattAWard commented Jul 12, 2023

Hi @pritamrungta I ended up just rotating the arrays manually...

nii = nib.load(path\to\nii\file)
arr = np.array(nii.dataobj, dtype = bool)
rot_arr = np.rot90(arr)
rtstruct.add_roi(mask=rot_arr, name=roi_name)

iterate this over every mask and it should come out fine

@pritamrungta
Copy link

Hi @MattAWard
Thanks for the info.
I had thought of something in the similar lines,
but turns out it isn't a generalized solution (atleast didn't work for my images 😔)

@pritamrungta
Copy link

I had to eventually do arr.swapaxes(0, 1) instead of rotation on the data returned by nibabel.
Still open for feedback.

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

3 participants