Skip to content

Add support for advanced person name attributes (suffix, middle, prefix) #11

@zgypa

Description

@zgypa

Currently, only supports family name and given name (first and last). However, DICOM PN also support suffixe, middle and prefix. To be able to add Dr., for example, that level of implementation would be needed.

Currently, i have written my own helper function. However, i could use the pydicom.valuerep.PersonName as documented in https://pydicom.github.io/pydicom/stable/reference/generated/pydicom.valuerep.PersonName.html . Limitation is that out of the box it doesn't support adding name attributes after having set one. So setting first name then setting last name would result in a last name only.

This is how a simple implementation could look like:

from pydicom.valuerep import PersonName

...

    @ property
    def patient_firstname(self):
        return PersonName(self._ds.PatientName).given_name
        
    @ patient_firstname.setter
    def patient_firstname(self, firstname):
        self._ds.PatientName = PersonName.from_named_components(
            given_name=firstname
        )

Question is: how important is this?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions