-
Notifications
You must be signed in to change notification settings - Fork 56
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
Setting value of "Contour Geometric Type". #16
Comments
Hi @mathiasgaede, thanks for the feedback.
That would be awesome, we always are happy help new contributors. Regarding what your are saying with the contours, what would be an ideal fix? We can change between OPEN_PLANAR / CLOSED_PLANAR based on the number of points. We can also provided an interface so that users can enable POINT's instead of |
A quick and dirty fix would just be to use the NumberOfContourPoints value to set the geometric type: 1 = POINT For this part, i don't think you need any user input, as you just need the model output to be successfully transferred to the image software without information loss. The trouble here is with the OPEN_PLANAR part not always being supported, which i will test a few methods for this week. I'm working with Syngo.via from Siemens and Mirada XD from Mirada Medical, but i can also check stuff in Slicer3D, if that is the program you are using. For OPEN_NONPLANAR and CLOSEDPLANAR_XOR i do think you need some kind of user decision to implement them properly, but I'm not familiar enough with your toolbox to suggest a way to implement it yet. To handle empty spaces inside contours, such as dead areas inside a tumour, i currently just inverse the binary mask, discard the largest connected component and give the other components the CLOSEDPLANAR_XOR type. This function has to be manually activated, as it is not a situation that can happen for most image series i work with. I'm sure that there are smarter ways to implement this. I have no personal experience with usage of OPEN_NONPLANAR and i have not yet had a use case for this. Link to Dicom standard for geometric types: |
@mathiasgaede thanks for the detailed response. We are hoping to publish the changes for this sometime over the next week. |
A small update from my side: I ended up converting all POINT and OPEN_PLANAR structures into CLOSED_PLANAR by expanding the number of triplets using the corresponding image serie dimensions to determine the new triplet positions, as this resultet in a better workflow for our physicians. I'm not sure how common this is for other image software, but this approach will work when POINT and OPEN_PLANAR are not supported. |
Very nice RT toolbox you are making! Due to a lack of resources such as this a year ago, i actually ended up writing some RT tools for my hospital department, for transforming mask outputs from DL models, which are also based on cv2 and pydicom. I never found the time to turn them into a well made toolbox for github, so i would love to help you guys expand your toolbox a little instead.
Contour Geometric Type
contour.ContourGeometricType = 'CLOSED_PLANAR' # TODO figure out how to get this value
contour.NumberOfContourPoints = len(contour_data) / 3 # Each point has an x, y, and z value
Setting the geometric value as CLOSED_PLANAR will nearly always work, but i recently had to expand this part myself, as it resulted in a few errors when loading some RTstructs into our image software.
If part of the mask has a lone voxel in a slice, the voxel will be deleted when importing the RTstruct unless the geometric type is set to "POINT".
If only two voxels are connected, they must be set to "OPEN_PLANAR", as the CLOSED_PLANAR value only works for 3+ connected contour points. OPEN_PLANAR is not always supported by image software, so i have had to define cases with two connected voxels as two separate POINT contours.
The text was updated successfully, but these errors were encountered: