I am trying to edit a private tag from a RTPLAN with Pydicom
First, I read the dicom file : ds = dicom.read_file('dicomfile')
I tried the command : ds[0x4001, 0x1012] = 'test'
but it returns the following error :
TypeError: Dataset items must be 'DataElement' instances
How could I modify the value of that tag ?
The simple answer, since the private data element already exists in this case, is to simply change its value:
ds[0x4001,0x1012].value = b'test'
Another answer is to look at the documentation on working with Private Data Elements where more flexible ways of working with them are described.