I have a dicom file I am modifying. I can happily open/read/modify/save the file, except for the tags found inside the meta-header. I've tried putAndInsert'ing it using the dataset pointer, and using the metaheader pointer. Neither returns a bad code condition, but the written out file does not have a modified value at that tag (according to dcmdump)
Some bits code (... means I chopped out the rest of the line):
Code: Select all
// set a new UID in two fields (same UID).
// this one is not in the meta-header:
key.set(0x0008, 0x0018);
cond = ((DcmItem *)tempdataset)->findAndGetOFString(key, UID);
snprintf(cUID,99,"...
cond = ((DcmItem *)tempdataset)->putAndInsertString(key, cUID);
// the above works beautifully
// neither way to set the tag 0002/0003 works
key.set(0x0002, 0x0003);
cond = ((DcmItem *)tempdataset)->putAndInsertString(key, cUID);
if(cond.bad())
cout << "error: " << cond.text() << endl;
DcmMetaInfo *metinf = dfile.getMetaInfo();
cond = metinf->putAndInsertString(key, cUID);
if(cond.bad())
cout << "error: " << cond.text() << endl;
// just in case it helps, lets try validating:
cond = tempfile.validateMetaInfo(EXS_Unknown);
// we then save out the file
cond = tempfile.saveFile(filename, metinf->getOriginalXfer()....
Thanks,
Rex[/code]