pydicom / deid

best effort anonymization for medical images using python
https://pydicom.github.io/deid/
MIT License
138 stars 43 forks source link

How can I get the value of a tag each dicom files in get_identifiers? #220

Closed NirutaDhimal closed 1 year ago

NirutaDhimal commented 1 year ago

How can I get the value of a tag of each dicom files in get_identifiers?

vsoch commented 1 year ago

That function returns a dictionary that has all fields -> values. https://pydicom.github.io/deid/examples/func-replace/

NirutaDhimal commented 1 year ago

Hi, can you please specify which function? The above link took me to examples section

vsoch commented 1 year ago

Look on that page at:

items = get_identifiers(dicom_files, expand_sequences=True)

and see the example output below it. Try running it on your own to see the same.

NirutaDhimal commented 1 year ago

Thanks

vsoch commented 1 year ago

Sure thing! Closing, ping again if you need.

NirutaDhimal commented 1 year ago

I tried to implement items = get_identifiers(dicom_files, expand_sequences=True) but I am getting error newerr1 newerr2 @vsoch Can you help here? What am I doing wrong? I also checked deid documentation but I couldn't find any expand_sequences argument. https://deid.readthedocs.io/en/latest/source/deid.dicom.html?highlight=get_identifiers#deid.dicom.header.get_identifiers

vsoch commented 1 year ago

Sorry about that must be a typo - the function has strip_sequences and not expand_sequences! https://github.com/pydicom/deid/blob/b1556a72c9fbfbfb7967da774e67057f7c437a02/deid/dicom/header.py#L25

vsoch commented 1 year ago

And actually, it's a bug! It should be there - it was erroneously removed. I'll get a PR in to fix it asap!

vsoch commented 1 year ago

ok it's fixed! If you are using the older version the default for expand_sequences (internal to the function) is True, so safe to just move it from the above. Thanks for catching the error!