pydicom.valuerep.PersonName¶
-
class
pydicom.valuerep.PersonName(val)[source]¶ 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
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.
centerReturn a centered string of length width.
count(sub[, start[, end]])Return the number of non-overlapping occurrences of subsection sub in bytes B[start:end].
decodeDecode 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.
expandtabsReturn a copy where all tab characters are expanded using spaces.
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
fromhexCreate a bytes object from a string of hexadecimal numbers.
hexCreate a str 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.
joinConcatenate any number of bytes objects.
ljustReturn a left-justified string of length width.
lower()Return a copy of B with all ASCII characters converted to lowercase.
lstripStrip leading bytes contained in the argument.
maketransReturn a translation table useable for the bytes or bytearray translate method.
parse()Break down the components and name parts
partitionPartition the bytes into three parts using the given separator.
replaceReturn 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].
rjustReturn a right-justified string of length width.
rpartitionPartition the bytes into three parts using the given separator.
rsplitReturn a list of the sections in the bytes, using sep as the delimiter.
rstripStrip trailing bytes contained in the argument.
splitReturn a list of the sections in the bytes, using sep as the delimiter.
splitlinesReturn 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.
stripStrip 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.
translateReturn a copy with each character mapped by the given translation table.
upper()Return a copy of B with all ASCII characters converted to uppercase.
zfillPad a numeric string with zeros on the left, to fill a field of the given width.