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.
Original issue reported on code.google.com by darcymason@gmail.com on 12 Jun 2009 at 2:26
Original issue reported on code.google.com by
darcymason@gmail.com
on 12 Jun 2009 at 2:26