Hi Randy,
Thanks for getting back to me. Apologies but I'd put my previous code wrong, I didn't actually have the string quotes in QATrack+, they were there because I copy pasted it from my local IDLE when working with a file directly (which is working).
I also tried as you said with using BIN_FILE directly and still have the same problem. Side question; is there any difference to using BIN_FILE vs BIN_FILE.path?
Here is the code now, copied correctly from QATrack+;
import io
from pylinac import CatPhan604
import matplotlib.pyplot as plt
from zipfile import ZipFile
import pydicom
mycbct = CatPhan604.from_zip(BIN_FILE)
mycbct.analyze(hu_tolerance=40, scaling_tolerance=1, thickness_tolerance=0.2,
low_contrast_tolerance=1, cnr_threshold=15, zip_after=False)
#Get DICOM tag (0018,103E) User provided description of the Series. Used to name pdf report by scan protocol.
with ZipFile(BIN_FILE, 'r') as zf:
file = zf.namelist()
list_dcm_files = [s for s in file if ".dcm" in s]
dcm_file = zf.open(list_dcm_files[0])
try:
ds = pydicom.dcmread(dcm_file, stop_before_pixels=True)
series_description = ds.SeriesDescription
except AttributeError:
series_description = 'CBCT' #If series description not found then it's because it's a CBCT image from TrueBeam
#etc
And the fail error in QATrack+;
Invalid Test Procedure: catphan_604_analysis.py", line 18, in Test: Catphan 604 Upload & Analysis
File "/home/generic/venvs/qatrack3/lib/python3.6/site-packages/pydicom/filereader.py", line 871, in dcmread
force=force, specific_tags=specific_tags)
File "/home/generic/venvs/qatrack3/lib/python3.6/site-packages/pydicom/filereader.py", line 668, in read_partial
preamble = read_preamble(fileobj, force)
File "/home/generic/venvs/qatrack3/lib/python3.6/site-packages/pydicom/filereader.py", line 625, in read_preamble
logger.debug("{0:08x}: 'DICM' prefix found".format(fp.tell() - 4))
io.UnsupportedOperation: seek
Thanks for your help,
Ben