pyplati / platipy

Processing Library and Analysis Toolkit for Medical Imaging in Python
https://pyplati.github.io/platipy/
Apache License 2.0
103 stars 24 forks source link

Error when reshaping contour array in transform_point_set_from_dicom_struct #205

Open MarkGardnerUSyd opened 1 year ago

MarkGardnerUSyd commented 1 year ago

This might be a bit of a weird error but I ran process_dicom_directory with a dicom structure set with ct and struct dicom files and got the following error:

process_dicom_directory(dicomDir, output_directory= outputDir) File "~\platipy\platipy\dicom\io\crawl.py", line 923, in process_dicom_directory for ( File "~\platipy\platipy\dicom\io\crawl.py", line 667, in process_dicom_series ) = transform_point_set_from_dicom_struct(image, dicom_object) File "~\platipy\platipy\dicom\io\crawl.py", line 318, in transform_point_set_from_dicom_struct vertexArr_physical = struct_slice_contour_data.reshape( ValueError: cannot reshape array of size 239 into shape (79,3)

This hasn't happened for other patient data in the dataset, and it seems like a really odd thing as if they are coordinates they should be divisible by 3? Anyway not sure if anyone has encountered anything similar.

pchlap commented 1 year ago

Thanks for reporting this @MarkGardnerUSyd. I haven't seen this error before, but I must admit that the DICOM crawler in platipy isn't really being maintained anymore... We are starting to move towards an add-on library we've been making called pydicer: https://github.com/AustralianCancerDataNetwork/pydicer

But this error does look like there might be an issue with that structure set... As you say it expects the coordinates to be divisible by 3 because the contour points come in a list of [x, y, z, x, y, z, x, y, z...].