suyashkumar/dicom

How can I edit value of a tag?

iamatsundere opened this issue · 2 comments

As the question, how can I edit the data in the tag value?

bench commented

I am also interested by this answer 😊

EDIT:

Actually you can perform that with the following snippet (no errecheck here)

tag, _ := dataset.FindElementByTag(tag.Tag{Group: 0x8, Element: 0x70})
tag.Value, _ = dicom.NewValue([]string{"MY NEW VALUE"})

Thanks @bench. Yep you can create new values through the API above, and use the dicom.Writer APIs to write updated tags out to a new dicom file.