DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Sat, 2017-09-23, 19:00

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun, 2017-04-02, 05:28 
Offline

Joined: Mon, 2014-03-03, 09:53
Posts: 5
Hi Members,

I am trying to add private tags in exiting dicom file using DCMTK V3.6.
I have found some stuff after finding the string "Howto: Add private data elements to a DICOM dataset" and using the same in my code..
Private creator tag writing successful but getting error as below
"ERROR 0001:0007 Illegal call, perhaps wrong parameter" while writing private tags(tag1,tag2).

I have created private dictionary and tag writing code as below.

Code:
=================================================================================================
DcmDataDictionary &dict = dcmDataDict.wrlock();
dict.loadDictionary("C:\\Tprivate.dic");
dcmDataDict.unlock();

DcmFileFormat inFile;
inFile.loadFile("c:\\0002.dcm");
DcmDataset *dset = inFile.getDataset();

if (!dset->tagExists(DcmTag(0x0029, 0x0010))) //private creator exists
{
dset->putAndInsertString(DcmTag(0x0029, 0x0010,EVR_LO), "mycomp"); //private creator

DcmTag tag1(0x0029, 0x1023);
tag1.setPrivateCreator("mycomp");
dset->putAndInsertString(tag1, "T1"); //private tag writing

DcmTag tag2(0x0029, 0x1027);
tag2.setPrivateCreator("mycomp");
dset->putAndInsertString(tag2, "T2"); //private tag writing

inFile.saveFile("c:\\2_edit.dcm");

}
=================================================================================================



Private Dictionary:
-----------------------------------------------------
(0029,"mycomp",1023) LO Unknown 1
(0029,"mycomp",1027) DS Unknown 1

-----------------------------------------------------

Please help me to resolve the above query.

Thanks & Regards
Akshay


Top
 Profile  
 
PostPosted: Fri, 2017-08-18, 15:19 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Tue, 2004-11-02, 17:22
Posts: 1203
Location: Oldenburg, Germany
Lookup of Value Representations based on a private creator is not active when you create a dataset.
You have to include the VR explicitly in your call to putAndInsertString, just as you do here:
Code:
putAndInsertString(DcmTag(0x0029, 0x0010,EVR_LO), "mycomp")


Top
 Profile  
 
PostPosted: Fri, 2017-08-18, 16:23 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1847
Location: Oldenburg, Germany
Alternatively, you could pass the Private Creator string to the DcmTag constructor as a third parameter (introduced 2011-08-23).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

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


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group