dcmdata: Value Copying

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
EngEmmanuel
Posts: 1
Joined: Thu, 2020-12-17, 08:27

dcmdata: Value Copying

#1 Post by EngEmmanuel » Thu, 2020-12-17, 17:52

I am trying to write two functions with dcmdata and would like some advice on the best way to do it please.

For the first function, I would like to copy the value of an element into another element (with compatible VR) in the same file. So the only thing that should change in the element I am copying TO is the value and value length as far as I am aware. The closest method I can find is "findAndInsertCopyOfElement()" in dcitem.h. However, from my understanding, this method copies the element whole i.e. tag included, therefore I can't actually copy the data into a different element/tag.

Is there any way to do this without having to retrieve the actual value which would then require a lot of if statements to handle the possible types/vr of the value?

In the second function, I would like to retrieve the actual value of the element and perform operations on it, such as appending in the case of a string, then put it back into the same element. I expect I will have to worry about the data types in this case but would love to hear if there are other functions in dcmdata that I may have missed that allows me to avoid this.

Here is how I have started:

Code: Select all

DcmFileFormat fileformat;
DcmDataset* dset;

fileformat.loadFile("path");

dset = fileformat.getDataset();

/* Here I would like to grab a copy of the value from one tag,
   then paste it into another */

fileformat.saveFile("path")

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

Re: dcmdata: Value Copying

#2 Post by J. Riesmeier » Thu, 2020-12-17, 19:20

Regarding the first function you are searching for, see DCMTK Feature #796.

Post Reply

Who is online

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