Wildcards in DICOM tag statements

28 views
Skip to first unread message

Marcel Daamen

unread,
Aug 25, 2020, 1:06:37 PM8/25/20
to pydicom
Hello,

maybe I missed this in the documentation: Is there a possibility in pydicom to address tag elements in a wildcard fashion? 

Practical example: The Philips Save Private Attributes declaration defines the SUV factor tag as (7053,xx00). While I currently only know data using (7053,1000), it would like to prepare for the possibility of deviating cases.

Thanks in advance...

Best wishes,

Marcel

Darcy Mason

unread,
Aug 27, 2020, 9:45:07 AM8/27/20
to pydicom
Hi Marcel,

You could start with using Dataset's group_dataset method to return the data elements in the 7053 group.  Then iterate through that group dataset using a FF mask with python binary AND ("&" operator) (untested, `data_elem.tag & 0xFF == 0`) to find the ones that are an exact match to the xx00. There are similar methods to deal with what pydicom calls "repeaters" near the top of datadict.py, although likely a little more complex there than what you need as it is generalized for the "x"'s in any location.

Also, you could look at the private data element handling built into pydicom, which could also be helpful to navigate these more elegantly.

Hope that helps,
Darcy

Marcel Daamen

unread,
Aug 27, 2020, 4:38:03 PM8/27/20
to pyd...@googlegroups.com
Hi Darcy,

thanks a lot for your helpful suggestion.

I was exactly seeking for this FF mask option. Actually, the combined expression...

((data_element.tag.group == 0x7053) & (data_element.tag & 0xFF == 0))

... seems to produce the behavior I need in my script.

Best wishes,

Marcel


--
You received this message because you are subscribed to a topic in the Google Groups "pydicom" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pydicom/C2RJtdjnmnE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pydicom+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pydicom/c21abcf8-c627-4b5c-a77a-29b54e7e6f8cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages