As outline in PydicomUserGuide , can delete a data element from a dataset using
the tag. But should be able to do so using the name, just as for getting and
setting DICOM data elements, e.g. del ds.PatientId
Steps:
add delattr method to Dataset in dataset.py:
(The code should be similar to that in setattr)
check if attribute already exists (i.e. is not a DICOM name), delete
normally if it is.
If not a normal attribute, then get tag by TagForName(name) and delete the
tag from the dataset if it exists; if not, raise appropriate error
(AttributeError)
write unit tests -- need to test delete of attributes that exist and that
attempt to del one that doesn't exist raises AttributeError
modify example programs that delete data elements (anonymize.py for sure;
others?) to use the new format with the name
Then I will need to also edit the deletion part of the PydicomUserGuide to
show how to use the new method.
From darcymason@gmail.com on June 11, 2009 22:26:44
As outline in PydicomUserGuide , can delete a data element from a dataset using the tag. But should be able to do so using the name, just as for getting and setting DICOM data elements, e.g. del ds.PatientId
Steps:
Then I will need to also edit the deletion part of the PydicomUserGuide to show how to use the new method.
Original issue: http://code.google.com/p/pydicom/issues/detail?id=50