confused about the use of putAndInsertXXX

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
xargon
Posts: 15
Joined: Mon, 2007-04-30, 13:16

confused about the use of putAndInsertXXX

#1 Post by xargon »

I have a DcmDataSet (ds) object and I am trying to edit some tag values in my code and I am using methods like:

Code: Select all

putAndInsertOFStringArray
putAndInsertString
putAndInsertUint16
putAndInsertFloat64
putAndInsertUint16Array
Now, before I call any of these methods, should I call ds->remove(TAG_IDENTIFIER). I noticed this my accident when I saw some of the tags were not getting updated. For example, the following code does not update the tag value:

Code: Select all

ds->putAndInsertFloat64(DCM_RescaleSlope, 1.0);
However, doing:

Code: Select all

ds->remove(DCM_RescaleSlope);
ds->putAndInsertFloat64(DCM_RescaleSlope, 1.0);
does the trick. So, should remove() be called before using any of the putAndInsertXXX methods?

Thanks!

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

Re: confused about the use of putAndInsertXXX

#2 Post by Michael Onken »

Hi,

I doubt that removing and Rescale Slope using putAndInsertFloat64() to re-insert it works either. The reason is that the method does not support all VRs (DICOM data types). Rescale Slope is of VR Decimal String (DS) while putAndInsertFloat64() only supports FD (Floating Point Double) and in theDCMTK snapshot also the new VR OD (Other Double).

Try (for example) putAndInsertString() instead which works for most VRs including DS.

Best,
Michael

Sergey Prokudaylo
Posts: 11
Joined: Mon, 2020-09-07, 14:47

Re: confused about the use of putAndInsertXXX

#3 Post by Sergey Prokudaylo »

Thank you sir, but my was successfully generated, and tags I try to write in are available in this dcdeftag.h. Perhaps the issue in in somethis different. I'll make a new topic to ask my question.

Post Reply

Who is online

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