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

'FileDataset' object has no attribute 'SliceLocation' #19

Closed
sama2689 opened this issue May 3, 2021 · 5 comments · Fixed by #26
Closed

'FileDataset' object has no attribute 'SliceLocation' #19

sama2689 opened this issue May 3, 2021 · 5 comments · Fixed by #26

Comments

@sama2689
Copy link

sama2689 commented May 3, 2021

I have an rt-struct.dcm file by itself, I want to extract a 3D volumetric mask from this. From loading the Rt-struct using dicominfo on MATLAB I can see that it has no SliceLocation attribute. However, it does have ROI contour attributes. All I am trying to do is extract these ROI contours (which are currently stored in Cartesian coordinates) as a mask. Is it possible to do this with rt-utils?

@awtkns
Copy link
Contributor

awtkns commented May 6, 2021

@carluri is this something you want to be supporting? It was written under the assumption that we would always the actual DCM files associated with the RT-STUCTS as there is quite a bit of information you need from the DCM files to generate the RT struct.

If you wanted to change this this should point you in the right direction:

C:\Users\cadam\programming\rt-utils>git grep -n SliceLocation
rt_utils/image_helper.py:25:    series_data.sort(key=lambda ds: ds.SliceLocation, reverse=False)
rt_utils/image_helper.py:138:    z_indicies = np.ones((contour.shape[0], 1)) * series_slice.SliceLocation

@clarkbab
Copy link

clarkbab commented May 11, 2021

I'm getting the same error when using RTStructBuilder.create_new(dicom_series_path='/path') with an existing DICOM series. I notice that SliceLocation is an optional attribute, could the same sorting information be obtained from ImagePositionPatient?

@SimonBiggs
Copy link

I came here from @pchlap's comment in #21 (comment). I vendored into PyMedPhys some code by @Fincap and @sjswerdloff that achieves this.

The code that does this sorting within PyMedPhys is over at:

https://github.com/pymedphys/pymedphys/blob/9b16b9cbc293276422e7209c658160962405fba9/lib/pymedphys/_dicom/sorting.py#L1-L57

The original code is over at:

https://github.com/didymo/OnkoDICOM/blob/cfab3aefb1427ab251a5de3df1b04d729ecd4b5d/src/Model/ImageLoading.py#L112-L130

And the relicensing discussion occurred over at:

pymedphys/pymedphys#1458 (comment)

@SimonBiggs
Copy link

@DylanHsu
Copy link

Hi, I'm having the same issue rasterizing structures on some CT series that are missing the optional SliceLocation attribute. It's possible to sanitize our files in the short term, but in the future it would be great to rely on ImagePositionPatient.

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

Successfully merging a pull request may close this issue.

6 participants