public class SequenceAttribute extends Attribute
A concrete class specializing Attribute
for
Sequence (SQ) attributes.
Though an instance of this class may be created
using its constructors, there is also a factory class, AttributeFactory
.
SequenceItem
,
Attribute
,
AttributeFactory
,
AttributeList
valueLength, valueMultiplicity
Constructor and Description |
---|
SequenceAttribute(AttributeTag t)
Construct an (empty) attribute.
|
Modifier and Type | Method and Description |
---|---|
void |
addItem(AttributeList item)
Add an item to the sequence (after any existing items).
|
void |
addItem(AttributeList item,
long byteOffset)
Add an item to the sequence (after any existing items), keeping tracking of input byte offsets.
|
void |
addItem(SequenceItem item)
Add an item to the sequence (after any existing items).
|
static java.lang.String[] |
getArrayOfSingleStringValueOrDefaultOfNamedAttributeWithinSequenceItems(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag,
java.lang.String dflt)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
|
static java.lang.String[] |
getArrayOfSingleStringValueOrDefaultOfNamedAttributeWithinSequenceItems(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag,
java.lang.String dflt,
java.text.NumberFormat format)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
|
static java.lang.String[] |
getArrayOfSingleStringValueOrEmptyStringOfNamedAttributeWithinSequenceItems(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
|
static AttributeList |
getAttributeListFromSelectedItemWithinSequence(SequenceAttribute sequenceAttribute,
int index)
Extract the AttributeList of the particular item in the sequence.
|
static AttributeList |
getAttributeListFromWithinSequenceWithSingleItem(AttributeList list,
AttributeTag sequenceTag)
Extract the AttributeList of the first item from a specified sequence from within a list of attributes.
|
static AttributeList |
getAttributeListFromWithinSequenceWithSingleItem(SequenceAttribute sequenceAttribute)
Extract the AttributeList of the first item from a sequence.
|
java.lang.String |
getDelimitedStringValuesOrDefault(java.lang.String dflt,
java.text.NumberFormat format)
Get all the string values for all the items.
|
SequenceItem |
getItem(int index)
Get particular item in the sequence.
|
static java.lang.String |
getMeaningOfCodedSequenceAttributeOrDefault(AttributeList list,
AttributeTag sequenceTag,
java.lang.String dflt)
Extract the code meaning attribute value from within the first item of the specified code sequence from within a list of attributes.
|
static java.lang.String |
getMeaningOfCodedSequenceAttributeOrEmptyString(AttributeList list,
AttributeTag sequenceTag)
Extract the code meaning attribute value from within the first item of the specified code sequence from within a list of attributes.
|
static Attribute |
getNamedAttributeFromWithinSelectedItemWithinSequence(AttributeList list,
AttributeTag sequenceTag,
int index,
AttributeTag namedTag)
Extract the specified attribute from within the particular item of the specified sequence from within a list of attributes.
|
static Attribute |
getNamedAttributeFromWithinSelectedItemWithinSequence(SequenceAttribute sequenceAttribute,
int index,
AttributeTag namedTag)
Extract the specified attribute from within the particular item in the sequence.
|
static Attribute |
getNamedAttributeFromWithinSequenceWithSingleItem(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
|
static Attribute |
getNamedAttributeFromWithinSequenceWithSingleItem(SequenceAttribute sequenceAttribute,
AttributeTag namedTag)
Extract the specified attribute from the first item of the specified sequence.
|
int |
getNumberOfItems()
Get the number of items in the sequence.
|
static double |
getSingleDoubleValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag,
double dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
|
static double |
getSingleIntegerValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag,
int dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
|
static java.lang.String |
getSingleStringValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag,
java.lang.String dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
|
static java.lang.String |
getSingleStringValueOfNamedAttributeFromWithinSequenceWithSingleItemOrEmptyString(AttributeList list,
AttributeTag sequenceTag,
AttributeTag namedTag)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
|
byte[] |
getVR()
Get the value representation of this attribute (SQ).
|
java.util.Iterator<SequenceItem> |
iterator()
Get an
Iterator of the items in the sequence. |
void |
remove(SequenceItem item)
Remove an item from the sequence.
|
void |
removeValues()
Remove any existing values, making the attribute empty (zero length).
|
java.lang.String |
toString(DicomDictionary dictionary)
Dump the contents of the attribute as a human-readable string.
|
void |
write(DicomOutputStream o)
Write the entire attribute (including values) to the output stream.
|
addValue, addValue, addValue, addValue, addValue, addValue, addValue, getByteValues, getByteValues, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getDoubleValues, getElement, getFloatValues, getFloatValues, getFloatValues, getGroup, getIntegerValues, getIntegerValues, getIntegerValues, getLengthOfEncodedValue, getLongValues, getLongValues, getLongValues, getOriginalStringValues, getPaddedVL, getShortValues, 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, getStringValues, getTag, getVL, getVM, getVRAsString, isValid, repairValues, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValues, setValues, setValues, setValues, setValues, setValues, setValues, toString, writeBase
public SequenceAttribute(AttributeTag t)
Construct an (empty) attribute.
t
- the tag of the attributepublic void addItem(AttributeList item)
item
- the list of attributes that comprise the itempublic void addItem(AttributeList item, long byteOffset)
item
- the list of attributes that comprise the itembyteOffset
- the byte offset in the input stream of the start of the itempublic void addItem(SequenceItem item)
item
- public static java.lang.String[] getArrayOfSingleStringValueOrDefaultOfNamedAttributeWithinSequenceItems(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag, java.lang.String dflt)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencedflt
- what to return if there is no (valid) string valuepublic static java.lang.String[] getArrayOfSingleStringValueOrDefaultOfNamedAttributeWithinSequenceItems(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag, java.lang.String dflt, java.text.NumberFormat format)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencedflt
- what to return if there is no (valid) string valueformat
- the format to use for each numerical or decimal value (null if none)public static java.lang.String[] getArrayOfSingleStringValueOrEmptyStringOfNamedAttributeWithinSequenceItems(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag)
Extract the string values of the specified attribute from within all the items of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencepublic static AttributeList getAttributeListFromSelectedItemWithinSequence(SequenceAttribute sequenceAttribute, int index)
Extract the AttributeList of the particular item in the sequence.
sequenceAttribute
- the sequence attribute that has one item (may be null in which case returns null)index
- which item to return, numbered from zeropublic static AttributeList getAttributeListFromWithinSequenceWithSingleItem(AttributeList list, AttributeTag sequenceTag)
Extract the AttributeList of the first item from a specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itempublic static AttributeList getAttributeListFromWithinSequenceWithSingleItem(SequenceAttribute sequenceAttribute)
Extract the AttributeList of the first item from a sequence.
sequenceAttribute
- the sequence attribute that has one item (may be null in which case returns null)public java.lang.String getDelimitedStringValuesOrDefault(java.lang.String dflt, java.text.NumberFormat format)
Get all the string values for all the items.
If there is no string value for an individual value or an exception trying to fetch it, the supplied default is returned for each Attribute.
A canonicalized (unpadded) form is returned for each Attribute value, not the original string.
getDelimitedStringValuesOrDefault
in class Attribute
dflt
- what to return if there are no (valid) string valuesformat
- the format to use for each numerical or decimal value (null if none)String
public SequenceItem getItem(int index)
index
- which item to return, numbered from zeroSequenceItem
, null if no items or no such itempublic static java.lang.String getMeaningOfCodedSequenceAttributeOrDefault(AttributeList list, AttributeTag sequenceTag, java.lang.String dflt)
Extract the code meaning attribute value from within the first item of the specified code sequence from within a list of attributes.
list
- the list that contains the code sequence (may not be null)sequenceTag
- the tag of the code sequence attribute that has one itemdflt
- what to return if there is no such sequence attribute or it is empty or has no code meaning attributepublic static java.lang.String getMeaningOfCodedSequenceAttributeOrEmptyString(AttributeList list, AttributeTag sequenceTag)
Extract the code meaning attribute value from within the first item of the specified code sequence from within a list of attributes.
list
- the list that contains the code sequence (may not be null)sequenceTag
- the tag of the code sequence attribute that has one itempublic static Attribute getNamedAttributeFromWithinSelectedItemWithinSequence(AttributeList list, AttributeTag sequenceTag, int index, AttributeTag namedTag)
Extract the specified attribute from within the particular item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemindex
- which item to return, numbered from zeronamedTag
- the tag of the attribute within the item of the sequencepublic static Attribute getNamedAttributeFromWithinSelectedItemWithinSequence(SequenceAttribute sequenceAttribute, int index, AttributeTag namedTag)
Extract the specified attribute from within the particular item in the sequence.
sequenceAttribute
- the sequence attribute that has one item (may be null in which case returns null)index
- which item to return, numbered from zeronamedTag
- the tag of the attribute within the item of the sequencepublic static Attribute getNamedAttributeFromWithinSequenceWithSingleItem(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencepublic static Attribute getNamedAttributeFromWithinSequenceWithSingleItem(SequenceAttribute sequenceAttribute, AttributeTag namedTag)
Extract the specified attribute from the first item of the specified sequence.
sequenceAttribute
- the sequence attribute that has one item (may be null in which case returns null)namedTag
- the tag of the attribute within the item of the sequencepublic int getNumberOfItems()
public static double getSingleDoubleValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag, double dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencedflt
- what to return if there is no such sequence attribute or it is empty or the attribute is not foundpublic static double getSingleIntegerValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag, int dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencedflt
- what to return if there is no such sequence attribute or it is empty or the attribute is not foundpublic static java.lang.String getSingleStringValueOfNamedAttributeFromWithinSequenceWithSingleItemOrDefault(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag, java.lang.String dflt)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencedflt
- what to return if there is no such sequence attribute or it is empty or the attribute is not foundpublic static java.lang.String getSingleStringValueOfNamedAttributeFromWithinSequenceWithSingleItemOrEmptyString(AttributeList list, AttributeTag sequenceTag, AttributeTag namedTag)
Extract the specified attribute from within the first item of the specified sequence from within a list of attributes.
list
- the list that contains the sequence (may not be null)sequenceTag
- the tag of the sequence attribute that has one itemnamedTag
- the tag of the attribute within the item of the sequencepublic byte[] getVR()
Get the value representation of this attribute (SQ).
getVR
in class Attribute
ValueRepresentation
public java.util.Iterator<SequenceItem> iterator()
Iterator
of the items in the sequence.Iterator
of items, each encoded as an SequenceItem
public void remove(SequenceItem item)
item
- public void removeValues()
Attribute
Remove any existing values, making the attribute empty (zero length).
removeValues
in class Attribute
public java.lang.String toString(DicomDictionary dictionary)
Attribute
Dump the contents of the attribute as a human-readable string.
No new line is appended.
The result is of the form:
(0xgggg,0xeeee) Name VR=<XX> VL=<0xnnnn> <...>
For example:
(0x0018,0x0020) ScanningSequence VR=<CS> VL=<0x2> <GR>
public void write(DicomOutputStream o) throws DicomException, java.io.IOException
Attribute
Write the entire attribute (including values) to the output stream.
write
in class Attribute
o
- java.io.IOException
DicomException