Insert meta header to dataset

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
mail2vguna
Posts: 41
Joined: Tue, 2013-07-23, 12:15
Location: Chennai, India

Insert meta header to dataset

#1 Post by mail2vguna »

Hi
I am working dcmtk 3.6.0.

I need to insert meta header(DcmMetaInfo) tag 0002,0016 to dataset (DcmDataset)? Does it possible to do that? if yes how can i do that?

Thanks in Advance.
Thanks
Guna

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Insert meta header to dataset

#2 Post by Michael Onken »

Hi,

do something like this (add error checks where necessary):

Code: Select all

DcmFileFormat dcmff;
dcmff.loadFile("file.dcm");
// Most relevant part:
dcmff.getMetaInfo()->putAndInsertOFStringArray(DCM_SourceApplicationEntityTitle, "DESIREDAETITLE");
dcmff.saveFile();
Best regards,
Michael

mail2vguna
Posts: 41
Joined: Tue, 2013-07-23, 12:15
Location: Chennai, India

Re: Insert meta header to dataset

#3 Post by mail2vguna »

Hi

Not like that.

I have meta header information(8 elements) in DcmMetaInfo metaInfo variable.
I have dataset information (all dataset elements) in DcmDataset dataset variable.

now i need to insert 0002,0016 from metaInfo variable to dataset variable dataset without saving the file/image.

Did you get my problem? Thanks.
Thanks
Guna

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Insert meta header to dataset

#4 Post by Michael Onken »

Hi,

yes, understood. But the tag 0002,0016 (i.e. group number 0002) is not permitted in a dataset according to the DICOM standard.

Otherwise just copy the value to any other tag:

Code: Select all

OFString val;
metainfo->findAndGetOFStringValue(DCM_SourceApplicationEntityTitle​, val);
dataset->putAndInsertOFStringArray(DCM_ImageComments, val);
Fell free to find another tag that makes more sense to you.

I think DCMTK will also accept

Code: Select all

dataset->putAndInsertOFStringArray(DCM_SourceApplicationEntityTitle​, val); 
but writing or transferring such a dataset is not standard conform, will not work or will cause errors at the receiver's side.

Best regards,
Michael

mail2vguna
Posts: 41
Joined: Tue, 2013-07-23, 12:15
Location: Chennai, India

Re: Insert meta header to dataset

#5 Post by mail2vguna »

Hi

Thanks. Its worked.

Once again thank you so much.
Thanks
Guna

Post Reply

Who is online

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