Package com.pixelmed.dicom

# Class CodedSequenceItem

java.lang.Object
com.pixelmed.dicom.CodedSequenceItem

public class CodedSequenceItem extends Object

A class to encapsulate the attributes contained within a Sequence Item that represents a Coded Sequence item.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected AttributeList`
`list`

## Constructor Summary

Constructors
Constructor
Description
`CodedSequenceItem(AttributeList l)`
Construct a `CodedSequenceItem` from a list of attributes.
`CodedSequenceItem(String tuple)`
Construct a `CodedSequenceItem` from a single string representation of the tuple enclosed in parentheses.
`CodedSequenceItem(String codeValue, String codingSchemeDesignator, String codeMeaning)`
Construct a `CodedSequenceItem` from string values for code value, scheme and meaning.
`CodedSequenceItem(String codeValue, String codingSchemeDesignator, String codingSchemeVersion, String codeMeaning)`
Construct a `CodedSequenceItem` from string values for code value, scheme, version and meaning.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`static CodedSequenceItem[]`
`getArrayOfCodedSequenceItemsOrNull(Attribute a)`
Extract the items of a coded sequence attribute.
`static CodedSequenceItem[]`
`getArrayOfCodedSequenceItemsOrNull(AttributeList list, AttributeTag tag)`
Extract the items of a coded sequence attribute contained within a list of attributes.
`AttributeList`
`getAttributeList()`
Get the list of attributes in the `CodedSequenceItem`.
`String`
`getCodeMeaning()`
Get the code meaning.
`String`
`getCodeValue()`
Get the code value.
`String`
`getCodingSchemeDesignator()`
Get the coding scheme designator.
`String`
`getCodingSchemeVersion()`
Get the coding scheme version.
`static int`
`getItemNumberContainingCodeSequence(AttributeList list, AttributeTag sequenceAttributeTag, AttributeTag codedSequenceItemTag, CodedSequenceItem wanted)`
Find the item of a SequenceAttribute in an AttributeList that contains a coded sequence attribute with a specified value.
`static int`
`getItemNumberContainingCodeSequence(SequenceAttribute a, AttributeTag codedSequenceItemTag, CodedSequenceItem wanted)`
Find the item of a SequenceAttribute that contains a coded sequence attribute with a specified value.
`static CodedSequenceItem`
`getSingleCodedSequenceItemOrNull(Attribute a)`
Extract the first (hopefully only) item of a coded sequence attribute.
`static CodedSequenceItem`
`getSingleCodedSequenceItemOrNull(AttributeList list, AttributeTag tag)`
Extract the first (hopefully only) item of a coded sequence attribute contained within a list of attributes.
`int`
`hashCode()`
`static SequenceAttribute`
`newCodedSequenceAttribute(AttributeTag tag, CodedSequenceItem csi)`
Create a single item coded sequence attribute.
`static SequenceAttribute`
`putSingleCodedSequenceAttribute(AttributeList list, AttributeTag tag, CodedSequenceItem csi)`
Create a single item coded sequence attribute and add it to the list.
`static void`
`putSingleCodedSequenceItem(AttributeList list, AttributeTag tag, String codeValue, String codingSchemeDesignator, String codeMeaning)`
Create a single item coded sequence attribute and add it to the list.
`String`
`toString()`
Get a `String` representation of the contents of the `CodedSequenceItem`.
`String`
`toTabDelimitedString()`
Get a tab-delimited `String` representation of the contents of the `CodedSequenceItem`.

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

`clone, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### list

protected AttributeList list

## Constructor Details

### CodedSequenceItem

public CodedSequenceItem(AttributeList l)

Construct a `CodedSequenceItem` from a list of attributes.

Parameters:
  `l` - the list of attributes to include in the item

### CodedSequenceItem

public CodedSequenceItem(String codeValue, String codingSchemeDesignator, String codeMeaning) throws DicomException

Construct a `CodedSequenceItem` from string values for code value, scheme and meaning.

Parameters:
  `codeValue` - the code value
  `codingSchemeDesignator` - the coding scheme designator
  `codeMeaning` - the code meaning
Throws:
  `DicomException` - if error in DICOM encoding

### CodedSequenceItem

public CodedSequenceItem(String codeValue, String codingSchemeDesignator, String codingSchemeVersion, String codeMeaning) throws DicomException

Construct a `CodedSequenceItem` from string values for code value, scheme, version and meaning.

Parameters:
  `codeValue` - the code value
  `codingSchemeDesignator` - the coding scheme designator
  `codingSchemeVersion` - the coding scheme version
  `codeMeaning` - the code meaning
Throws:
  `DicomException` - if error in DICOM encoding

### CodedSequenceItem

public CodedSequenceItem(String tuple) throws DicomException

Construct a `CodedSequenceItem` from a single string representation of the tuple enclosed in parentheses.

I.e., "(cv,csd,cm)" or "(cv,csd,csv,cm)".

The supplied tuple is expected to be enclosed in parentheses.

Any items of the tuple may be enclosed in double quotes.

White space is ignored (outside quoted strings".

Parameters:
  `tuple` - single string representation of the tuple enclosed in parentheses.
Throws:
  `DicomException` - if error in DICOM encoding

## Method Details

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### getAttributeList

public AttributeList getAttributeList()

Get the list of attributes in the `CodedSequenceItem`.

Returns:
  all the attributes in the `CodedSequenceItem`

### getCodeValue

public String getCodeValue()

Get the code value.

Returns:
  a string containing the code value, or an empty string if none

### getCodingSchemeDesignator

public String getCodingSchemeDesignator()

Get the coding scheme designator.

Returns:
  a string containing the coding scheme designator, or an empty string if none

### getCodingSchemeVersion

public String getCodingSchemeVersion()

Get the coding scheme version.

Returns:
  a string containing the coding scheme version, or an empty string if none

### getCodeMeaning

public String getCodeMeaning()

Get the code meaning.

Returns:
  a string containing the code meaning, or an empty string if none

### toString

public String toString()

Get a `String` representation of the contents of the `CodedSequenceItem`.

Overrides:
  `toString` in class `Object`
Returns:
  a string containing the code value, coding scheme designator, coding scheme version (if present) and code meaning values

### toTabDelimitedString

public String toTabDelimitedString()

Get a tab-delimited `String` representation of the contents of the `CodedSequenceItem`.

Returns:
  a string containing the code value, coding scheme designator, coding scheme version (if present) and code meaning values separated by tabs and without quotes

### getSingleCodedSequenceItemOrNull

public static CodedSequenceItem getSingleCodedSequenceItemOrNull(AttributeList list, AttributeTag tag)

Extract the first (hopefully only) item of a coded sequence attribute contained within a list of attributes.

Parameters:
  `list` - the list in which to look for the Sequence attribute
  `tag` - the tag of the Sequence attribute to extract
Returns:
  the (first) coded sequence item if found, otherwise null

### getSingleCodedSequenceItemOrNull

public static CodedSequenceItem getSingleCodedSequenceItemOrNull(Attribute a)

Extract the first (hopefully only) item of a coded sequence attribute.

Parameters:
  `a` - the attribute
Returns:
  the (first) coded sequence item if found, otherwise null

### getArrayOfCodedSequenceItemsOrNull

public static CodedSequenceItem[] getArrayOfCodedSequenceItemsOrNull(AttributeList list, AttributeTag tag)

Extract the items of a coded sequence attribute contained within a list of attributes.

Parameters:
  `list` - the list in which to look for the Sequence attribute
  `tag` - the tag of the Sequence attribute to extract
Returns:
  the coded sequence items if found, otherwise null

### getArrayOfCodedSequenceItemsOrNull

public static CodedSequenceItem[] getArrayOfCodedSequenceItemsOrNull(Attribute a)

Extract the items of a coded sequence attribute.

Parameters:
  `a` - the attribute
Returns:
  the coded sequence items if found, otherwise null

### putSingleCodedSequenceItem

public static void putSingleCodedSequenceItem(AttributeList list, AttributeTag tag, String codeValue, String codingSchemeDesignator, String codeMeaning) throws DicomException

Create a single item coded sequence attribute and add it to the list.

Parameters:
  `list` - the AttributeList to which to add the new SequenceAttribute
  `tag` - the AttributeTag of the SequenceAttribute to create
  `codeValue` - the code value
  `codingSchemeDesignator` - the coding scheme designator
  `codeMeaning` - the code meaning
Throws:
  `DicomException` - if error in DICOM encoding

### putSingleCodedSequenceAttribute

public static SequenceAttribute putSingleCodedSequenceAttribute(AttributeList list, AttributeTag tag, CodedSequenceItem csi)

Create a single item coded sequence attribute and add it to the list.

Parameters:
  `list` - the AttributeList to which to add the new SequenceAttribute
  `tag` - the AttributeTag of the SequenceAttribute to create
  `csi` - the coded sequence item
Returns:
  the sequence attribute

### newCodedSequenceAttribute

public static SequenceAttribute newCodedSequenceAttribute(AttributeTag tag, CodedSequenceItem csi)

Create a single item coded sequence attribute.

Parameters:
  `tag` - the AttributeTag of the SequenceAttribute to create
  `csi` - the coded sequence item
Returns:
  the sequence attribute

### getItemNumberContainingCodeSequence

public static int getItemNumberContainingCodeSequence(SequenceAttribute a, AttributeTag codedSequenceItemTag, CodedSequenceItem wanted)

Find the item of a SequenceAttribute that contains a coded sequence attribute with a specified value.

Parameters:
  `a` - the SequenceAttribute whose items are to be searched
  `codedSequenceItemTag` - the CodedSequenceItem Attribute wanted
  `wanted` - the value of the CodedSequenceItem wanted
Returns:
  the item number (from 0) or -1 if not found

### getItemNumberContainingCodeSequence

public static int getItemNumberContainingCodeSequence(AttributeList list, AttributeTag sequenceAttributeTag, AttributeTag codedSequenceItemTag, CodedSequenceItem wanted)

Find the item of a SequenceAttribute in an AttributeList that contains a coded sequence attribute with a specified value.

Parameters:
  `list` - the AttributeList in which to look for the SequenceAttribute
  `sequenceAttributeTag` - the SequenceAttribute whose items are to be searched
  `codedSequenceItemTag` - the CodedSequenceItem Attribute wanted
  `wanted` - the value of the CodedSequenceItem wanted
Returns:
  the item number (from 0) or -1 if not found