2

I can add private tag in existing dicom header using dcm4che2 : -

 private int privateTagForOldData = 0x78610010;
 private int privateTagCreator = 0x78611010;

 dicomObject.putString(dicomObject.resolveTag(privateTagForOldData, "Test", true), VR.LT,
                        "private tag description");
 LOGGER.info("Private tag added");

How to do using dcm4che3, as method resolveTag doesn't exist

attributes.setString(ds.resolveTag(privateTagForOldData, "Test", true), VR.LT,
                        "private tag description")
Shan
  • 295
  • 1
  • 5
  • 16

1 Answers1

0

In dcm4che3, setString(int tag, VR vr, String s) method will also be used to create a tag, as shown below :-

attributes.setString(2019622928, VR.LT, "Test");
attributes.setString(2019627024, VR.LT, "private tag description");

Note : I have converted hex to decimal for the value i posted in question

Shan
  • 295
  • 1
  • 5
  • 16
  • You saved the new tag in a `dcm` file? If yes, how you saved this tag to the `dcm` file? –  Jun 28 '18 at 10:40
  • what version of dcm4che are you using? – Shan Jun 28 '18 at 11:46
  • I use: dcm4che3, 5.13.2 more exactly [ https://mvnrepository.com/artifact/org.dcm4che/dcm4che-core/5.13.2 ] –  Jun 28 '18 at 12:59
  • Did you try any code ? I am not sure if i can post the answer here as your question is different. in dcm4che3 , first read the dicom file using `readDataset` method of DicomInputStream then add/modify changes then to write back into the same or new file using `writeDataset` of DicomOutputStream. For example you can refer `transcode` method in this link https://github.com/dcm4che/dcm4che/blob/master/dcm4che-tool/dcm4che-tool-dcm2dcm/src/main/java/org/dcm4che3/tool/dcm2dcm/Dcm2Dcm.java – Shan Jul 05 '18 at 12:14