DICOM missing TransferSyntaxUID

Dear FLUKA experts!
There is an error when I input DICOM file. How can I solve this error.



your CT dicom files seems to be missing the TransferSyntaxUID record needed by the pydicom library to decode the pixel array.

Could you sens us (privately) one of the CT slices to see if we can find a solution to the problem?

Dear @vasilis
It can be opened by other users. I don’t know why my flair can’t be opened.No information entered.


Dear @vasilis
I found that I can open the DICOM file directly copied from the CT equipment, but the above error will appear when I open the DICOM file output from the accelerator treatment planning system. What is the reason for this?


Thanks for the information. I’ve added a check in all places, when the TransferSyntaxUID is not defined to fall back to the default LittleEndian

Dear @vasilis
May I ask whether this situation can be solved. What should I do if this problem can be solved.


I’ve corrected it on the devel version of flair, which will be released in the next days (after some testing).
In the mean time one option would be to add this attribute to each CT file externally with a python program like the following

import sys
import pydicom
ds = pydicom.read_file(sys.argv[1], force=True)
if "TransferSyntaxUID" not in ds.file_meta:
	ds.file_meta.TransferSyntaxUID = pydicom.uid.ImplicitVRLittleEndian
pydicom.write_file(sys.argv[2], ds)

Save the python program in a file like add_transfersyntax.py and then run it for every CT dcm file you have like
python add_transfersyntax.py input.dcm output.dcm
You can make a bash loop to make it easier and write the output in a different directory

Dear @vasilis
Sorry, I don’t know how to operate. Where should I put this file and How do I run this file? What should I do in this step (python add_transfersyntax.py input.dcm output.dcm), How do I call this file to flair,Can you explain the following to me in detail? thank you.


Not from flair, but from the command line

  1. Imagine your CT dicom files are located in a folder called dicom enter to the folder
    cd dicom
  2. Copy the code inside a file called add_transfersyntax.py
    inside the dicom folder.
  3. mkdir ../dicom_new
    to create a new folder called dicom_new on the parent directory
  4. Then run the program for all files there as
    for i in *.dcm; do python3 add_transfersyntax.py $i ../dicom_new/$i;done

If successful, you should have all dicom files with the added attributed inside the dicom_new folder.
Open flair with the new files and it should work

Dear @vasilis
Thank you very much, The DICOM display error has been solved with your help.