When I try to run a script in order to analyze some dicom images via pylinac, I get the error:
The argument C:\Users\user\Desktop\SNC_Machine_manuscript\measurements\Vital1\kVs_VB1_baselines\kV 60 mAs 1.07 1\DicomFile20191218 103723-0.dcm was not found to be a valid DICOM file, Image file, or array
I know that the images which I try to analyze are valid DICOM files.
For more details please see the attached image.
Any ideas regarding how to fix this error?
The file path appears to not be valid.
Generally speaking, it’s safer to use os.path.join() or the new pathlib library to define paths. You can then check that the file is valid before passing it to pylinac. So instead of + strings, you can do path = Path('/path/to/dir/') and then join paths by doing full_path = path / dir / file. And check it’s a real file by doing full_path.isfile(). Or, if you just want to leave your code as is use os.path.isfile() to check that it’s a file first before loading. If this is false, it’s a file path issue and I suggest the above.
In addition to os.path.join() which is very helpful and so is full_path.isfile()
As a quick band-aid you can try:
yourFolderLocation= r"C:\Users\user\Desktop\SNC_Machine_manuscript\measurements\Vital1\kVs_VB1_baselines\kV 60 mAs 1.07 1\DicomFile20191218 103723-0.dcm"
This allows me to use "" as used in Windows - naturally.
Sorry for the late response.
I tried the os.path.isfile() and it returned true.
Do you think that is a file path issue?
Is it possible that the python version causes the issue? (I have Python 3.9.5)
When I try to run the demo SNCkV DICOM file, I get the same error message.
Please see the attached screenshots, for more details.
Thank you all for your help!!!
Στις Τρί, 14 Σεπ 2021 στις 10:05 μ.μ., ο/η James Kerns <jkerns100@gmail.com> έγραψε:
If the demo won’t run then something is really fishy. Try 2 things:
Try loading the image in pydicom to see if there is an error:
ds = pydicom.dcmread(path/to/file, force=True)
Try loading other demo images like the QC-3, Las Vegas, etc and see what happens.
StandardImagingQC3.from_demo_image()
LasVegas.from_demo_image()
SNCkV.from_demo_image()
SNCMV.from_demo_image()
I tried to load the image in pydicom, as you suggested and I got this error:AttributeError: ‘FileMetaDataset’ object has no attribute ‘FileMetaInformationGroupLength’
I tried to load the demo files in pydicom and I got again the same error:
AttributeError: ‘FileMetaDataset’ object has no attribute ‘FileMetaInformationGroupLength’
Please see the attached screenshots.
Any ideas regarding how to fix this?
Thank you!
Στις Δευτέρα, 20 Σεπτεμβρίου 2021 στις 12:44:17 π.μ. UTC+3, ο χρήστης jker...@gmail.com έγραψε:
I turned on pydicom.config.debug() and as you can see in the attached screenshots, I believe that the problem has something to do with the tag (0008,0000).
Do you think that this is a problem of pydicom usage or pydicom itself?
Do you have any ideas on how to fix this?
Thank you in advance!!
Στις Δευτέρα, 20 Σεπτεμβρίου 2021 στις 12:39:09 μ.μ. UTC+3, ο χρήστης Anna-Maria Fanou έγραψε:
Unfortunately when it comes to DICOM I’m not very good. If pydicom won’t read it then it’d be best to post on the pydicom forums: pydicom - Google Groups. It would also probably be helpful to attach the file itself.