javadcm4che

How to add custom private tag using dcm4che3


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")

Solution

  • 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