Passing pydicom data set to Pylinac

Hi James

I’m using pydicom to open and display DICOM images. Is it possible to instantiate a pylinac class using a pydicom dataset? I.e. I want to do something along the lines of the following:

ds = pydicom.dcmread(filename, force=True)
# do some pydicom stuff
pf = picketfence.PicketFence(ds,  mlc='HD Millenium')
pf.analyze()
# do some pylinac stuff

Currently it seems you can only instantiate classes with a valid filename.
Regards
Alan

Not out of the box. But for picketfence specifically, you can modify this line to be PFDicomImage.from_dataset(ds=filename) and use the syntax you have above.

Thanks James

I’ll take a look.

Regards
Alan

I borrowed the code from PFDicomImage.from_dataset and did:

ds = pydicom.dcmread(filename, force=True)
# do some pydicom stuff
stream = io.BytesIO()
ds.save_as(stream)
pf = picketfence.PicketFence(stream,  mlc='HD Millenium')
pf.analyze()
# do some pylinac stuff

This worked and eliminated the disk write/read.
Thanks for your help.

Regards
Alan

Awesome; Good work Alan!