I’d like to upload scanned documents (the patient’s written consent form) into Orthanc. I see that create-dicom is called during the DrawingDicomizer after toDataURL() converts the canvas into PNG.
1.Is there any way to send a JPG to create-dicom for it to be dicomized? At the moment, I think the only way is to convert it to PNG first… but I was just wondering if there’s any other way.
2. Is there a way to assign PatientID when calling create-dicom? I believe that a work-around using /patient/modify should work, but it’d be a lot easier if create-dicom can assign PatientID from the outset.
I know that create-dicom is listed as “experimental”, but at the moment, it has the potential to be the simplest way for me to get scanned documents into PACS.
Alternatively, would it be possible to convert the scanned JPEG into DCM locally first and then use http://orthanc:8042/instances to upload the DCM file?
And either pass the PatientID / PatientName / StudyDate together at the same time or get the instanceID so that I can use /instance/{id}/modify?
Just an update. Sebastien replied personally to me that PatientID should be able to be assigned when calling create-dicom. However, I’ve tried this, but Orthanc simply won’t process if I pass the PatientID to create-dicom. Sebastien has promised to look into this potential bug when he’s able to.
In the meantime, I’ve managed to get create-dicom to accept an upload of an image file to be DICOMized!
Summary:
Make a POST to createDicom.php with PatientID, PatientName and image file to be uploaded (uploadDicom.html). (Be aware that php default max file upload size is 2Mb).
createDicom.php uses php_gd2 to convert incoming file to PNG, does a base64 encode, and passes it to orthanc/tools/create-dicom, together with PatientName and various DICOM tags.
create-dicom makes a new instance (#1) with auto-generated PatientID.
PatientID cannot be injected into create-dicom under Orthanc 0.8.2, so the auto-generated PatientID of instance (#1) is modified into the POSTed PatientID (from step 1) using instance/{id}/modify into another instance (#2)
Instance #2 is stored into orthanc by POSTing to /instance
Instance #1 is deleted
Issues:
My hospital uses Siemens Syngo Imaging XS (an old PACs) which likely needs more DICOM tags defined before it will accept the DICOMized image. Will be looking into this.
However, my hospital also uses Syngo.Via and OSIRIX, which have no trouble accepting the DICOMized image with the tags I had already defined in the current createDicom.php.
1.Is there any way to send a JPG to create-dicom for it to be dicomized? At the moment, I think the only way is to convert it to PNG first…
JPEG is not supported for “/tools/create-dicom”, because JPEG decompression is non-normative. This means that two different decoders could decode the same JPEG file differently, which I find very dangerous as far as medical images are concerned. For this reason, I prefer to only accept incoming PNG files, the decoding process of which is fully standardized.
Alternatively, would it be possible to convert the scanned JPEG into DCM locally first and then use http://orthanc:8042/instances to upload the DCM file?
Of course, you can create locally a DICOM file from your JPEG scan, then upload it to Orthanc, either through the DICOM protocol or by POST-ing it to “/instances”.
Please however read the content of the entry “Orthanc Fails to Store a DICOM File, Complaining About an Inexistent Tag” in our FAQ, that lists the 4 mandatory DICOM tags that must be present in your DICOM file for Orthanc to accept it: https://code.google.com/p/orthanc/wiki/FAQ
Is there a way to assign PatientID when calling create-dicom?
Thank you so much for this wonderful application of Orthanc.
Wish to share that we are using XAMP along with Orthanc to facilitate conversion of jpeg to dcm files.
We were able to convert the jpeg file to scanned.png. However, we are unable to utilize the code for converting it to .dcm and feeding it into Orthanc. Could you please shed some light on /tools/create-dicom. We didn’t its use at the Orthanc Rest API documentation.
Wish to share the output that we are getting at the browser -
Warning: Use of undefined constant Ymd - assumed ‘Ymd’ (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\createDicom.php on line 33
Warning: Use of undefined constant Ymd - assumed ‘Ymd’ (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\createDicom.php on line 34
Done