Package com.pixelmed.dicom

# Class PersonNameAttribute

java.lang.Object
com.pixelmed.dicom.Attribute
com.pixelmed.dicom.StringAttribute
com.pixelmed.dicom.StringAttributeAffectedBySpecificCharacterSet
com.pixelmed.dicom.PersonNameAttribute

public class PersonNameAttribute extends StringAttributeAffectedBySpecificCharacterSet

A concrete class specializing `Attribute` for Person Name (PN) attributes.

Though an instance of this class may be created using its constructors, there is also a factory class, `AttributeFactory`.

See Also:
  - `Attribute`
  - `AttributeFactory`
  - `AttributeList`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected static final int`
`MAX_LENGTH_SINGLE_VALUE`

### Fields inherited from class com.pixelmed.dicom.StringAttribute

`specificCharacterSet`

### Fields inherited from class com.pixelmed.dicom.Attribute

`valueLength, valueMultiplicity`

## Constructor Summary

Constructors
Constructor
Description
`PersonNameAttribute(AttributeTag t)`
Construct an (empty) attribute.
`PersonNameAttribute(AttributeTag t, long vl, DicomInputStream i, SpecificCharacterSet specificCharacterSet)`
Read an attribute from an input stream.
`PersonNameAttribute(AttributeTag t, SpecificCharacterSet specificCharacterSet)`
Construct an (empty) attribute.
`PersonNameAttribute(AttributeTag t, Long vl, DicomInputStream i, SpecificCharacterSet specificCharacterSet)`
Read an attribute from an input stream.

## Method Summary

Modifier and Type
Method
Description
`static String`
`getCanonicalForm(String value)`
Get a canonical form of the supplied person name value.
`static String`
`getCanonicalForm(String value, boolean forQuery)`
Get a canonical form of the supplied person name value.
`final int`
`getMaximumLengthOfSingleValue()`
`static Vector<String>`
`getNameComponentGroups(String value)`
Get the name component groups from a DICOM delimited form of Person Name.
`static Vector<String>`
`getNameComponents(String value)`
Get the name components from a DICOM delimited form of Person Name.
`static String`
`getPhoneticName(String name)`
Get a phonetic encoding name of the family and given name components of a DICOM delimited form of Person Name.
`static String`
`getPhoneticName(String name, boolean forQuery)`
Get a phonetic encoding name of the family and given name components of a DICOM delimited form of Person Name.
`byte[]`
`getVR()`
Get the value representation of this attribute (PN).
`static void`
`main(String[] arg)`
Test read the DICOM files listed on the command line, get the patient name and make canonical form.
`static String`
`swap(String name)`
Get the family and given name components of a DICOM delimited form of Person Name and swap them.

### Methods inherited from class com.pixelmed.dicom.StringAttribute

`addValue, addValue, addValue, addValue, addValue, addValue, addValue, allowRepairOfIncorrectLength, allowRepairOfInvalidCharacterReplacement, areCharactersInValuesValid, areLengthsOfValuesValid, areValuesWellFormed, flushCachedCopies, getByteValues, getDoubleValues, getFloatValues, getIntegerValues, getInvalidCharacterReplacement, getLongValues, getOriginalStringValues, getPadByte, getPaddedVL, getShortValues, getSpecificCharacterSet, getStringValues, isCharacterInValueValid, isValid, removeValues, repairValues, setSpecificCharacterSet, toString, translateByteArrayToString, translateStringToByteArray, write`

### Methods inherited from class com.pixelmed.dicom.Attribute

`getByteValues, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getElement, getFloatValues, getFloatValues, getGroup, getIntegerValues, getIntegerValues, getLengthOfBaseOfEncodedAttribute, getLengthOfEncodedValue, getLengthOfEntireEncodedAttribute, getLongValues, getLongValues, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getTag, getVL, getVM, getVRAsString, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValues, setValues, setValues, setValues, setValues, setValues, setValues, toString, writeBase`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### MAX_LENGTH_SINGLE_VALUE

protected static final int MAX_LENGTH_SINGLE_VALUE

See Also:
  - Constant Field Values

## Constructor Details

### PersonNameAttribute

public PersonNameAttribute(AttributeTag t)

Construct an (empty) attribute.

Parameters:
  `t` - the tag of the attribute

### PersonNameAttribute

public PersonNameAttribute(AttributeTag t, SpecificCharacterSet specificCharacterSet)

Construct an (empty) attribute.

Parameters:
  `t` - the tag of the attribute
  `specificCharacterSet` - the character set to be used for the text

### PersonNameAttribute

public PersonNameAttribute(AttributeTag t, long vl, DicomInputStream i, SpecificCharacterSet specificCharacterSet) throws IOException, DicomException

Read an attribute from an input stream.

Parameters:
  `t` - the tag of the attribute
  `vl` - the value length of the attribute
  `i` - the input stream
  `specificCharacterSet` - the character set to be used for the text
Throws:
  `IOException`
  `DicomException`

### PersonNameAttribute

public PersonNameAttribute(AttributeTag t, Long vl, DicomInputStream i, SpecificCharacterSet specificCharacterSet) throws IOException, DicomException

Read an attribute from an input stream.

Parameters:
  `t` - the tag of the attribute
  `vl` - the value length of the attribute
  `i` - the input stream
  `specificCharacterSet` - the character set to be used for the text
Throws:
  `IOException`
  `DicomException`

## Method Details

### getMaximumLengthOfSingleValue

public final int getMaximumLengthOfSingleValue()

Specified by:
  `getMaximumLengthOfSingleValue` in class `StringAttribute`

### getVR

public byte[] getVR()

Get the value representation of this attribute (PN).

Overrides:
  `getVR` in class `Attribute`
Returns:
  'P','N' in ASCII as a two byte array; see `ValueRepresentation`

### getCanonicalForm

public static String getCanonicalForm(String value)

Get a canonical form of the supplied person name value.

Parameters:
  `value` - a single person name value
Returns:
  a canonical form of the person name value

### getCanonicalForm

public static String getCanonicalForm(String value, boolean forQuery)

Get a canonical form of the supplied person name value.

For queries, wildcard characters for queries are left untouched; if a component is empty then a '*' is inserted instead of zero length.

Parameters:
  `value` - a single person name value
  `forQuery` - if application is query and wildcards need to be handled
Returns:
  a canonical form of the person name value

### getNameComponentGroups

public static Vector<String> getNameComponentGroups(String value)

Get the name component groups from a DICOM delimited form of Person Name.

Parameters:
  `value` - a single person name value
Returns:
  a Vector of String containing the name component groups

### getNameComponents

public static Vector<String> getNameComponents(String value)

Get the name components from a DICOM delimited form of Person Name.

Parameters:
  `value` - a single person name value
Returns:
  a Vector of String containing the name components

### swap

public static String swap(String name)

Get the family and given name components of a DICOM delimited form of Person Name and swap them.

Parameters:
  `name` - a single person name value with family and given name components
Returns:
  a DICOM delimited form of name with the family and given name components swapped, or the supplied value if not two componenbts

### getPhoneticName

public static String getPhoneticName(String name)

Get a phonetic encoding name of the family and given name components of a DICOM delimited form of Person Name.

Parameters:
  `name` - a single person name value with family and given name components
Returns:
  a DICOM delimited form of name with phonetic equivalents substituted for family and given name components

### getPhoneticName

public static String getPhoneticName(String name, boolean forQuery)

Get a phonetic encoding name of the family and given name components of a DICOM delimited form of Person Name.

Note that wildcards used in queries are removed by the encoding process, though initial and terminal wildcard characters are restored in each component if present.

Parameters:
  `name` - a single person name value with family and given name components
  `forQuery` - if application is query and wildcards need to be handled
Returns:
  a DICOM delimited form of name with phonetic equivalents substituted for family and given name components

### main

public static void main(String[] arg)

Test read the DICOM files listed on the command line, get the patient name and make canonical form.

Parameters:
  `arg` - a list of DICOM file names or directories to search for such