SlicerRt/SlicerRT

BatchStructureSetConversion doesn't work with my dicom

Closed this issue · 6 comments

Dear SliceRT team,

I want to use your script to convert DICOM structures to surface mesh. Unfortunately, the conversion fails (the only empty folder is created). I checked that the Patient name, Patient ID and series instance UID fields were not empty; and also that there were no special characters in the filenames. I work with mac os 11, python 3.7.2 and Slicer 4.13. Could you possibly point me to a test file?
Here is my bug:

``
% /Applications/Slicer.app/Contents/MacOS/Slicer --no-main-window --python-script Downloads/SlicerRT-master/BatchProcessing/BatchStructureSetConversion.py -i Desktop/DICOM_05161_rs -r Desktop/DICOM_05161_all_no_rs -o Desktop/output_mesh
qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added
Start batch RTSTRUCT conversion
BatchStructureSet running in file mode
Import reference anatomy DICOM data from Desktop/DICOM_05161_all_no_rs
Switching to temporary DICOM database: /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase
TagCacheDatabase adding table

E: DcmElement: CommandField (0000,0100) larger (828667202) than remaining bytes in file
Could not load "Desktop/DICOM_05161_all_no_rs/.DS_Store"
DCMTK says: I/O suspension or premature end of stream
Could not read DICOM file:Desktop/DICOM_05161_all_no_rs/.DS_Store
"DICOM indexer has successfully inserted 400 files [0.16s]"
"DICOM indexer has successfully processed 401 files [0.49s]"
"DICOM indexer has updated display fields for 400 files [0.07s]"
Could not load "/private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase/Desktop/DICOM_05161_all_no_rs/_Anon_CT.75073429_285.dcm"
DCMTK says: No such file or directory
File /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase/Desktop/DICOM_05161_all_no_rs/_Anon_CT.75073429_285.dcm could not be initialized.
Could not load "/private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase/Desktop/DICOM_05161_all_no_rs/_Anon_CT.75073429_291.dcm"
DCMTK says: No such file or directory
File /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase/Desktop/DICOM_05161_all_no_rs/_Anon_CT.75073429_291.dcm could not be initialized.
Could not load "/private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150005_TempDICOMDatabase/Desktop/DICOM_05161_all_no_rs/_Anon_CT.75073429_246.dcm"
DCMTK says: No such file or directory
....
....
....
....

Could not load "/private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm"
DCMTK says: No such file or directory
File /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm could not be initialized.
Could not load "/private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm"
DCMTK says: No such file or directory
File /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm could not be initialized.
Loading with imageIOName: GDCM
vtkITKArchetypeImageSeriesReader::ExecuteInformation: Archetype file /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm does not exist.

Algorithm vtkITKArchetypeImageSeriesVectorReaderFile(0x7fae0e221d20) returned failure for request: vtkInformation (0x7fae0e224850)
Debug: Off
Modified Time: 143250
Reference Count: 1
Registered Events: (none)
Request: REQUEST_INFORMATION
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0

Could not read scalar volume using GDCM approach. Error is: FileNotFoundError
Loading with imageIOName: DCMTK
vtkITKArchetypeImageSeriesReader::ExecuteInformation: Archetype file /private/var/folders/vg/7xz3x48s4hl2fl4t3l2qbn0m0000gn/T/Slicer-winnieiii/20210914_150006_TempDICOMDatabase/Desktop/DICOM_05161_rs/Anon_RS.75073429.dcm does not exist.

Algorithm vtkITKArchetypeImageSeriesVectorReaderFile(0x7fae0e225e80) returned failure for request: vtkInformation (0x7fae0e226e40)
Debug: Off
Modified Time: 143356
Reference Count: 1
Registered Events: (none)
Request: REQUEST_INFORMATION
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0

Could not read scalar volume using DCMTK approach. Error is: FileNotFoundError
Convert loaded structure set to labelmap volumes
Save labelmaps to directory Desktop/output_mesh/1
DONE

Does the script have the necessary privileges to access the file itself? Maybe if you try to run it with sudo?

Thanks for your answer!
Even with 'sudo' I get the same error again. I tried to extract the mesh via GUI, and it seems to work, so it shouldn't be a problem of DICOM. I don't understand if there is something that I have to also set at the database level, maybe change some permissions ...Any idea? Thanks a lot!

I think I have fix my bug. If I run the script directly from inside the folder ... so without path it works ... I think there is some problem reading the absolute paths, or maybe it is a specific problem of mac os 11

Interesting, thanks for the update! I'll try the script on Linux (don't have access to Mac but path handling should be the same on the two), and fix if I find the issue.

Sorry for the extremely long delay... I just tried it, and this command works on Ubuntu 20.04.4

./Slicer --no-main-window --python-script /home/csaba/Slicer/_Extensions/SlicerRT/BatchProcessing/BatchStructureSetConversion.py --input-folder /home/csaba/Data/20220325_BatchProcessingTest --output-folder /home/csaba/Data/20220325_BatchProcessingTestOut

Closing due to long inactivity.