Open RebeccaThornley opened 5 months ago
Hi Becky, thanks for flagging this - I think it works now! Adding the force=True statement as an argument in the dcmread function in acr_snr (line 88) forces the function to read the DICOM files even if the prefix is not as expected
Reporting this on behalf of David Price. When trying to run acr_snr on data from a GE scanner, he recieved the following error: pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header. Use force=True to force reading.
Full code from terminal (hazen-venv) davidprice@medphys037-mac ~ % hazen acr_snr ACR_Hd_tra_SNR1 --measured_slice_width=5.2 --subtract ACR_Hd_tra_SNR2 --report 2024-06-13 08:04:32 I [ACRObject.py:sort_dcms:47] image orientation is axial 2024-06-13 08:04:32 I [ACRObject.py:order_phantom_slices:78] Slice order inversion is not required. Traceback (most recent call last): File "/Users/davidprice/hazen-venv/bin/hazen", line 8, in
sys.exit(main())
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/hazenlib/init.py", line 155, in main
result = task.run()
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/hazenlib/tasks/acr_snr.py", line 88, in run
data2 = [pydicom.dcmread(dicom) for dicom in filepaths]
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/hazenlib/tasks/acr_snr.py", line 88, in
data2 = [pydicom.dcmread(dicom) for dicom in filepaths]
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/pydicom/filereader.py", line 1029, in dcmread
dataset = read_partial(
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/pydicom/filereader.py", line 780, in read_partial
preamble = read_preamble(fileobj, force)
File "/Users/davidprice/hazen-venv/lib/python3.9/site-packages/pydicom/filereader.py", line 724, in read_preamble
raise InvalidDicomError(
pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header. Use force=True to force reading.
(hazen-venv) davidprice@medphys037-mac ~ % force=True
(hazen-venv) davidprice@medphys037-mac ~ % hazen acr_snr ACR_Hd_tra_SNR1 --measured_slice_width=5.2 --subtract ACR_Hd_tra_SNR2 --report
I will try and dig out images and send to Molly via email