SeiictyUsui / pydicom

Automatically exported from code.google.com/p/pydicom
0 stars 0 forks source link

Delete data element by name #50

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Done in revision 5aa5d9e255, including unit tests. Wiki edited in my local 
clone.

Original comment by darcymason@gmail.com on 6 Nov 2009 at 5:44