You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As we discussed, I think it could be beneficial to have the possibility to skip the processing of a patient/specific Series if one of the DICOM files in the Series/folder is corrupted or, in general, if it cannot be read by pydicom's dcmread()†.
† as I reported at the end of the issue, this is already done in some cases - so I'm sorry if the title is a bit misleading but I didn't know how to name this properly!
For the sake of completeness, I'm pasting here the example I already shared privately:
Considering file XXXXXXXXXXXXXXXXXXXXXXXXX.dcm
ERROR, UNEXPECTED EXCEPTION
'bytes' object has no attribute 'name'
Traceback (most recent call last):
File "dicomsort.py", line 493, in <module>
if not sorter.renameFiles():
File "dicomsort.py", line 214, in renameFiles
if self.renameFile(file):
File "dicomsort.py", line 232, in renameFile
ds = dicom.read_file(file,stop_before_pixels=True)
File "/home/dennis/.local/lib/python3.6/site-packages/pydicom/filereader.py", line 1034, in dcmread
specific_tags=specific_tags,
File "/home/dennis/.local/lib/python3.6/site-packages/pydicom/filereader.py", line 874, in read_partial
if class_uid and class_uid.name == "Media Storage Directory Storage":
AttributeError: 'bytes' object has no attribute 'name'
If it can help in any way, apparently another .dcm file in the dataset was not readable - and was put under the folder UnknownPatientID/UnknownStudyInstanceUID/UnknownSeriesInstanceUID.
When I tried to open that single .dcm file, pydicom wasn't happy again and raised an exception (unfortunately, I removed the file without thinking this through, but it was something almost identical to this problem here - except the tags were different).
That exception was somehow handled correctly by DICOMSort (even if the file was not readable - I guess the exception raised was probably different and correctly caught).
The text was updated successfully, but these errors were encountered:
Plus let's add a catch-all except at as a fallback. Probably we should be printing the errors for the other cases, probably with some logging level controls.
Steve,
As we discussed, I think it could be beneficial to have the possibility to skip the processing of a patient/specific Series if one of the DICOM files in the Series/folder is corrupted or, in general, if it cannot be read by pydicom's
dcmread()
†.† as I reported at the end of the issue, this is already done in some cases - so I'm sorry if the title is a bit misleading but I didn't know how to name this properly!
For the sake of completeness, I'm pasting here the example I already shared privately:
If it can help in any way, apparently another .dcm file in the dataset was not readable - and was put under the folder
UnknownPatientID/UnknownStudyInstanceUID/UnknownSeriesInstanceUID
.When I tried to open that single .dcm file, pydicom wasn't happy again and raised an exception (unfortunately, I removed the file without thinking this through, but it was something almost identical to this problem here - except the tags were different).
That exception was somehow handled correctly by DICOMSort (even if the file was not readable - I guess the exception raised was probably different and correctly caught).
The text was updated successfully, but these errors were encountered: