Creating a multi-frame image out of several jpgs

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
RobertHa
Posts: 3
Joined: Wed, 2024-01-10, 17:09

Creating a multi-frame image out of several jpgs

#1 Post by RobertHa »

Hello everyone,

I'm currently working on sending multiple images as a pdf-like multi-frame image to a PACS-server. The images (jpg) are generated by another component that takes every page of a pdf (report for a blood pressure measurement) and converts these pages into separate images (10 pages = 10 images). The question is, does any module like img2dcm of the toolbox have the ability to do so?

So far,I've attempted to use dcmodify to insert raw pixel data of all images.dcm (image-->DCM-image-->RawData). However, this approach only overwrites one image with another.
I've also searched in the documentation of img2dcm, but contrary to what I read about it and how I understood it, it seems to lack such a command.

As a workaround, I'm sending all images.dcm in a folder with the module storescu, using the same Study-UID of the received worklist, the same series-UID and different SOP Instance UIDs to the test-server(ORTHANC) at the same time. The server groups them up under the same study and same series as 10 instances. However, this is not an elegant solution.

Best regards
Robert

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Creating a multi-frame image out of several jpgs

#2 Post by Marco Eichelberg »

img2dcm has the ability to take multiple images and write them into a DICOM Multiframe Secondary Capture Image file.
You need to use the --new-sc command line option and can then simply specify multiple input files on the command line.

RobertHa
Posts: 3
Joined: Wed, 2024-01-10, 17:09

Re: Creating a multi-frame image out of several jpgs

#3 Post by RobertHa »

Thank you very much for the information. It now works as intended. Is it normal that, with an input of e.g. 4 JPGs with a size of approximately 400-700 kB each, the output DICOM file has a size of 170 MB? That seems somewhat excessive to me. In my case, the DICOM file gets deleted from the local save after sending it succesfully to the PACS server, so there is not a problem with space on a local hard drive. As for the PACS server, I'm not sure.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Creating a multi-frame image out of several jpgs

#4 Post by Marco Eichelberg »

That does not sound normal. img2dcm should produce a file that is not much larger than the combined size of the JPEG files, plus a few kbytes max. The DICOM file will still be in compressed format. If you decompress it (e.g. by using dcmdjpeg), the size will of course increase. If you manually convert the JPEG files to BMP and add their file size, that should give about the file size of the uncompressed DICOM file.

RobertHa
Posts: 3
Joined: Wed, 2024-01-10, 17:09

Re: Creating a multi-frame image out of several jpgs

#5 Post by RobertHa »

I adapted my code so that the report, consisting of 10 pages (black and white, with multiple single measurements), is now converted into 10 *.bmp images. At 120 DPI and a resolution of 992x1043 pixels, each image is approximately 5 MB, resulting in a total size of about 45 MB for the *.dcm file. This is significantly smaller, roughly 7 times, compared to using 10 *.jpgs (converted using img2dcm into dcmdjpeg). It appears that dcmdjpeg inflates the file size. However, I encounter an issue when trying to send the *dcm file to the PACS server without the dcmdjpeg due to the following error: 'Unable to convert dataset from ''JPEG Baseline'' transfer syntax to ''Little Endian Explicit''. How can I work around this error? Should I explore another approach, and if yes, which module might be more suitable?

Full DOS message:

'I: determining input files ...'#$D#$A'I: checking input files ...'#$D#$A'I: Requesting Association'#$D#$A'I: Association Accepted (Max Send PDV: 16372)'#$D#$A'I: Sending file: C:\Test\DICOM_Image\DICOM_DCM\P_REPORT_AV35674_AV35674OT240115.dcm'#$D#$A'I: Converting transfer syntax: JPEG Baseline -> Little Endian Explicit'#$D#$A'I: Sending Store Request (MsgID 1, SCc)'#$D#$A'XMIT: W: DIMSE Warning: (Test,ORTHANC): sendMessage: unable to convert dataset from ''JPEG Baseline'' transfer syntax to ''Little Endian Explicit'''#$D#$A'E: Store Failed, file: C:\Test\DICOM_Image\DICOM_DCM\P_REPORT_AV35674_AV35674OT240115.dcm:'#$D#$A'E: 0006:020e DIMSE Failed to send message'#$D#$A'E: Store SCU Failed: 0006:020e DIMSE Failed to send message'#$D#$A'I: Aborting Association'#$D#$A

Command for console (img2dcm):

Command := 'cd /d ' + dcmtkPath + '&&img2dcm -ll info -p --new-sc '+ ALotOfJPGPaths + ' -k'+PN+' -k'+PI+' -k'+PB+' -k'+PS+........;

Edit: Is dcmsend another option for storescu for sending multi-frame images.dcm without using dcmdjpeg?
Edit2: Indeed, dcmsend does work around the issue. Thanks for the help! :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 1 guest