How to create a new Dicom file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ilia71
Posts: 22
Joined: Wed, 2016-10-19, 13:13

How to create a new Dicom file

#1 Post by ilia71 »

Hello all,

Can anyone please help me with the following issue: I need to take existing multiframe DICOM files, add additional text and drawings on pictures, and create new multiframe DICOM with the same metainfo as the original existing DICOM.
In C++, I didn’t find any good example of how to write multiframe DICOM. So I’m using C# with dcm2xml.exe to create xml with all the data of the DICOM, creating jpeg pictures frame by frame, and inserting them in pixel-data sequence as pixel-item in the appropriate xml tags.
The problem is when I use xml2dcm.exe to create the DICOM file, the created file is empty, with 2kb only.
The output of xml2dcm is:

I: reading XML input file: C:\converted\temp2.xml
--- libxml parsing ------
-------------------------
I: parsing file-format ...
I: parsing meta-header ...
I: parsing data-set ...
I: writing DICOM output file: C:\Users\Ofir\Desktop\converted\temp2.dcm
D: DcmFileFormat::checkMetaHeaderValue() Version of MetaHeader is ok: 0x0100
D: DcmFileFormat::checkMetaHeaderValue() use new TransferSyntaxUID [JPEG Baseline] on writing following Dataset
D: DcmFileFormat: Found 8 Elements in DcmMetaInfo 'metinf'


a) What am i doing wrong?
b) If there is a more efficient way to do that, i would be more then happy to hear it

Thank you,

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: How to create a new Dicom file

#2 Post by J. Riesmeier »

My first question would be: why don't you use a DICOM Presentation State object for this purpose?

Then, more specifically: what is the contents of your "temp2.xml" file?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest