PDF to Dicom
I have an upcoming project where we are being asked to take a PDF result and send it to a PACS system as a DICOM encapsulated PDF. I am wondering if anyone has done this and if so can you share your experience?
Thanks,
Comments
Hi Tom, You can have a look at this documentation : https://cedocs.intersystems.com/latest/csp/docbook/Doc.View.cls?KEY=EDICOM_filestorage_production to help you to create a dicom production to send document to pacs.
If you are not on Ensemble, you have in the community installer for ENSDEMO production : https://openexchange.intersystems.com/package/irishealth-ensdemo
But in short, you have to create an EnsLib.DICOM.Document Fill it with information about the patient, ect. e.g
Set pDocOut = ##class(EnsLib.DICOM.Document).%New()
// Set patient data
$$$THROWONERROR(tSC, pDocOut.SetValueAt("Toto^Toto", "DataSet.PatientName"))
$$$THROWONERROR(tSC, pDocOut.SetValueAt(1, "DataSet.PatientID"))
//Set pdf in EncapsulatedDocument
$$$THROWONERROR(tSC, pDocOut.SetValueAt("application/pdf","DataSet.MIMETypeOfEncapsulatedDocument"))
/// File is you binary pdf document
IF '$IsObject(file) $$$THROWONERROR(tSC, $$$ERROR($$$FailedToNewClass, "%Stream.TmpBinary"))
// DICOM Standard PS3.5: The Value Field containing Pixel Data, like all other Value Fields in DICOM, shall be an even number of bytes in length
// Thanks Michel Liberado for this hack
IF (($L(binary) # 2) '= 0) {
// Any char would be fine but I want to have the End Of Transmission ASCII character
$$$THROWONERROR(tSC, file.Write($CHAR(4)))
}
$$$THROWONERROR(tSC, pDocOut.SetValueAt(file,"DataSet.EncapsulatedDocument"))
Once you have your pDocOut you can send it to business process Demo.DICOM.Process.Storage