nifti mask to RT-struct dicom
qurit-frizi opened this issue · 6 comments
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.
I will add a function to solve this issue.
Hi @qurit-frizi could I ask what your solution was for this? I'm having the same problem...
Hi @qurit-frizi
I'm in a similar situation.
Any ideas to fix would be really helpful.
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
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 😔)
I had to eventually do arr.swapaxes(0, 1)
instead of rotation on the data returned by nibabel.
Still open for feedback.