qie.createDICOMFromImage¶
Signature: qie.createDICOMFromImage(imageData, mimeType*)
Returns: DICOM Message message - the created DICOM message object
Creates DICOM from image data.
Note
This method inspects JPEG Format to set the appropriate DICOM Transfer Syntax. For example, if JPEG Baseline the Transfer Syntax is set to "1.2.840.10008.1.2.4.50", and a JPEG Extended 12Bit image will have a Transfer Syntax of "1.2.840.10008.1.2.4.51".
Note
A default set of DICOM tags are created in the new DICOM object. Populating these DICOM tags can be done after calling this method.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| byte[] | imageData | the bytes of the image file | |
| String | mimeType* | (optional) the mimeType of the file | image/jpeg |
Example¶
// Read image bytes from disk
var imageBytes = qie.readFile("/tmp/foot.jpg");
// Create a DICOM message from the image data
var dicomMessage = qie.createDICOMFromImage(imageBytes); // DICOM Message
// Write the generated DICOM file to disk
qie.writeFile(
"/tmp/footDicom.dcm",
dicomMessage.getDICOMBytesForFile()
);