pydicom.valuerep.PersonName¶
-
class
pydicom.valuerep.
PersonName
(val)¶ Human-friendly class to hold the value of elements with VR of ‘PN’.
The value is parsed into the following properties:
- single-byte, ideographic, and phonetic components (DICOM Standard, Part 5, Section 6.2.1)
- family_name, given_name, middle_name, name_prefix, name_suffix
-
__init__
(val)¶ Initialize the PN properties
Methods
__init__
(val)Initialize the PN properties capitalize
()Return a copy of B with only its first character capitalized (ASCII) and the rest lower-cased. center
(width[, fillchar])Return B centered in a string of length width. count
(sub[, start[, end]])Return the number of non-overlapping occurrences of subsection sub in bytes B[start:end]. decode
Decode the bytes using the codec registered for encoding. encode
(*args)Dummy method to mimic py2 str behavior in py3 bytes subclass endswith
(suffix[, start[, end]])Return True if B ends with the specified suffix, False otherwise. expandtabs
([tabsize])Return a copy of B where all tab characters are expanded using spaces. family_comma_given
()Return name as ‘Family-name, Given-name’ find
(sub[, start[, end]])Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. formatted
(format_str)Return a formatted string according to the format pattern fromhex
Create a bytes object from a string of hexadecimal numbers. hex
()Create a string of hexadecimal numbers from a bytes object. index
(sub[, start[, end]])Return the lowest index in B where subsection sub is found, such that sub is contained within B[start,end]. isalnum
()Return True if all characters in B are alphanumeric and there is at least one character in B, False otherwise. isalpha
()Return True if all characters in B are alphabetic and there is at least one character in B, False otherwise. isascii
()Return True if B is empty or all characters in B are ASCII, False otherwise. isdigit
()Return True if all characters in B are digits and there is at least one character in B, False otherwise. islower
()Return True if all cased characters in B are lowercase and there is at least one cased character in B, False otherwise. isspace
()Return True if all characters in B are whitespace and there is at least one character in B, False otherwise. istitle
()Return True if B is a titlecased string and there is at least one character in B, i.e. isupper
()Return True if all cased characters in B are uppercase and there is at least one cased character in B, False otherwise. join
Concatenate any number of bytes objects. ljust
(width[, fillchar])Return B left justified in a string of length width. lower
()Return a copy of B with all ASCII characters converted to lowercase. lstrip
Strip leading bytes contained in the argument. maketrans
Return a translation table useable for the bytes or bytearray translate method. parse
()Break down the components and name parts partition
Partition the bytes into three parts using the given separator. replace
Return a copy with all occurrences of substring old replaced by new. rfind
(sub[, start[, end]])Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. rindex
(sub[, start[, end]])Return the highest index in B where subsection sub is found, such that sub is contained within B[start,end]. rjust
(width[, fillchar])Return B right justified in a string of length width. rpartition
Partition the bytes into three parts using the given separator. rsplit
Return a list of the sections in the bytes, using sep as the delimiter. rstrip
Strip trailing bytes contained in the argument. split
Return a list of the sections in the bytes, using sep as the delimiter. splitlines
Return a list of the lines in the bytes, breaking at line boundaries. startswith
(prefix[, start[, end]])Return True if B starts with the specified prefix, False otherwise. strip
Strip leading and trailing bytes contained in the argument. swapcase
()Return a copy of B with uppercase ASCII characters converted to lowercase ASCII and vice versa. title
()Return a titlecased version of B, i.e. translate
Return a copy with each character mapped by the given translation table. upper
()Return a copy of B with all ASCII characters converted to uppercase. zfill
(width)Pad a numeric string B with zeros on the left, to fill a field of the specified width. -
encode
(*args)¶ Dummy method to mimic py2 str behavior in py3 bytes subclass
-
family_comma_given
()¶ Return name as ‘Family-name, Given-name’