Class ContentItem
- All Implemented Interfaces:
TreeNode
- Direct Known Subclasses:
ContentItemWithReference
,ContentItemWithValue
An abstract class for representing a node in an internal representation of a structured reporting
tree (an instance of StructuredReport
).
The constructor is protected. Instances of specific types of content items should normally be created by using
the ContentItemFactory
.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Construct a content item for a list of attributes, and add it as a child of the specified parent.protected
ContentItem
(ContentItem p, String relationshipType) Construct a content item of a specified type and relationship, creating a newAttributeList
, and add it as a child of the specified parent.protected
ContentItem
(ContentItem p, String relationshipType, String observationDateTime, String observationUID) Construct a content item of a specified type and relationship, creating a newAttributeList
, and add it as a child of the specified parent. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChild
(ContentItem child) Add a child to this content item.void
addSibling
(ContentItem sibling) Add a sibling to this content item (a child to the parent of this content item).children()
Returns the children of this node as anEnumeration
.static boolean
contentItemNameMatchesCodeValueAndCodingSchemeDesignator
(ContentItem ci, String cvWanted, String csdWanted) Test if the coded concept name of the content item matches the specified code value and coding scheme designator.abstract boolean
contentItemNameMatchesCodeValueAndCodingSchemeDesignator
(String cvWanted, String csdWanted) Test if the coded concept name of the content item matches the specified code value and coding scheme designator.boolean
Always returns true, since children may always be added.Get the attribute list of this content item.getChildAt
(int index) Returns the child at the specified index.int
Return the number of children that this node contains.Get the Concept Name.Get a string representation of the concept name and the value of the concept.Get the value of the code meaning of the Concept Name as a string, if present and applicable.Get the value of the code value of the Concept Name as a string, if present and applicable.Get the value of the coding scheme designator of the Concept Name as a string, if present and applicable.abstract String
Get a string representation of the value of the concept.float[]
Get the Graphic Data of this content item, if present and applicable.Get the Graphic Type of this content item, if present and applicable.int
Returns the index of the specified child from amongst this node's children, if present.Retrieve the named child as defined by its ConceptName The code meaning of the concept is ignored, and only the code value and coding scheme designator are compared in the search.getNamedChild
(String codingSchemeDesignator, String codeValue) Retrieve the named child as defined by its ConceptNameGet the ObservationDateTime of this content item.Get the ObservationUID of this content item.Returns the parent node of this node.Get the parent content item of this content item.Get the position in the tree relative to the top parent as a String to use as a Referenced Content Item Identifier.Get the Referenced Content Item Identifier, if present.int[]
Get the Referenced Content Item Identifier, if present.Get the Referenced SOP Class UID of this content item, if present and applicable.Get the Referenced SOP Instance UID of this content item, if present and applicable.Get the relationship type of this content item.Retrieve the string value of selfstatic String
getSingleStringValueOrNullOfNamedChild
(ContentItem parent, String codingSchemeDesignator, String codeValue) Retrieve the string value of the named child as defined by its ConceptNamegetSingleStringValueOrNullOfNamedChild
(String codingSchemeDesignator, String codeValue) Retrieve the string value of the named child as defined by its ConceptNameGet the value type of this content item.boolean
isLeaf()
Returns true if the receiver is a leaf (has no children).
-
Field Details
-
relationshipType
-
observationDateTime
-
observationUID
-
-
Constructor Details
-
ContentItem
Construct a content item for a list of attributes, and add it as a child of the specified parent.
The constructor is protected. Instances of specific types of content items should normally be created by using the
ContentItemFactory
.- Parameters:
p
- the parentl
- the list of attributes
-
ContentItem
protected ContentItem(ContentItem p, String relationshipType, String observationDateTime, String observationUID) throws DicomException Construct a content item of a specified type and relationship, creating a new
AttributeList
, and add it as a child of the specified parent.The constructor is protected. Instances of specific types of content items should normally be created by using the
ContentItemFactory
.- Parameters:
p
- the parentrelationshipType
- added only if not null or zero lengthobservationDateTime
- Observation DateTime, added only if not null or zero lengthobservationUID
- Observation UID, added only if not null or zero length- Throws:
DicomException
- if error in DICOM encoding
-
ContentItem
Construct a content item of a specified type and relationship, creating a new
AttributeList
, and add it as a child of the specified parent.The constructor is protected. Instances of specific types of content items should normally be created by using the
ContentItemFactory
.- Parameters:
p
- the parentrelationshipType
- added only if not null or zero length- Throws:
DicomException
- if error in DICOM encoding
-
-
Method Details
-
getParent
Returns the parent node of this node.
-
getChildAt
Returns the child at the specified index.
- Specified by:
getChildAt
in interfaceTreeNode
- Parameters:
index
- the index of the child to be returned, numbered from 0- Returns:
- the child
TreeNode
at the specified index
-
getIndex
Returns the index of the specified child from amongst this node's children, if present.
-
getAllowsChildren
public boolean getAllowsChildren()Always returns true, since children may always be added.
- Specified by:
getAllowsChildren
in interfaceTreeNode
- Returns:
- always true
-
isLeaf
public boolean isLeaf()Returns true if the receiver is a leaf (has no children).
-
getChildCount
public int getChildCount()Return the number of children that this node contains.
- Specified by:
getChildCount
in interfaceTreeNode
- Returns:
- the number of children, 0 if none
-
children
Returns the children of this node as an
Enumeration
. -
addChild
Add a child to this content item.
- Parameters:
child
- the child content item to add
-
addSibling
Add a sibling to this content item (a child to the parent of this content item).
- Parameters:
sibling
- the sibling content item to add- Throws:
DicomException
- thrown if there is no parent
-
getParentAsContentItem
Get the parent content item of this content item.
This method saves the caller from having to cast the value returned from
TreeNode.getParent()
.- Returns:
- the parent content item
-
getAttributeList
Get the attribute list of this content item.
- Returns:
- the attribute list of this content item
-
getValueType
Get the value type of this content item.
- Returns:
- the value type (the string used in the DICOM standard in the Value Type attribute)
-
getRelationshipType
Get the relationship type of this content item.
- Returns:
- the relationship type (the string used in the DICOM standard in the Relationship Type attribute)
-
getObservationUID
Get the ObservationUID of this content item.
- Returns:
- the value of the ObservationUID Attribute
-
getObservationDateTime
Get the ObservationDateTime of this content item.
- Returns:
- the value of the ObservationDateTime Attribute
-
getReferencedSOPClassUID
Get the Referenced SOP Class UID of this content item, if present and applicable.
- Returns:
- the Referenced SOP Class UID, or null
-
getReferencedSOPInstanceUID
Get the Referenced SOP Instance UID of this content item, if present and applicable.
- Returns:
- the Referenced SOP Instance UID, or null
-
getGraphicType
Get the Graphic Type of this content item, if present and applicable.
- Returns:
- the Graphic Type, or null
-
getGraphicData
public float[] getGraphicData()Get the Graphic Data of this content item, if present and applicable.
- Returns:
- the Graphic Data, or null
-
getConceptNameAndValue
Get a string representation of the concept name and the value of the concept.
The exact form of the returned string is specific to the type of ContentItem.
- Returns:
- a String representation of the name and value, or an empty string
-
getConceptValue
Get a string representation of the value of the concept.
The exact form of the returned string is specific to the type of ContentItem.
- Returns:
- a String representation of the name and value, or an empty string
-
getConceptName
Get the Concept Name.
- Returns:
- the Concept Name
-
getConceptNameCodeMeaning
Get the value of the code meaning of the Concept Name as a string, if present and applicable.
- Returns:
- the code meaning of the Concept Name, or an empty string
-
getConceptNameCodeValue
Get the value of the code value of the Concept Name as a string, if present and applicable.
- Returns:
- the code value of the Concept Name, or an empty string
-
getConceptNameCodingSchemeDesignator
Get the value of the coding scheme designator of the Concept Name as a string, if present and applicable.
- Returns:
- the coding scheme designator of the Concept Name, or an empty string
-
getReferencedContentItemIdentifier
Get the Referenced Content Item Identifier, if present.
- Returns:
- the period (not backslash) delimited item references, or an empty string
-
getReferencedContentItemIdentifierArray
public int[] getReferencedContentItemIdentifierArray()Get the Referenced Content Item Identifier, if present.
- Returns:
- an array of integers representing the separated components of the Referenced Content Item Identifier, including the first (root) identifier of 1, or null if none or empty
-
getPositionInTreeToUseAsReferencedContentItemIdentifier
Get the position in the tree relative to the top parent as a String to use as a Referenced Content Item Identifier.
Returns a valid result only if the entire parent content tree back to the root has already been populated.
- Returns:
- the period (not backslash) delimited item references, or "1" if we have no parent
-
getNamedChild
Retrieve the named child as defined by its ConceptName- Parameters:
codingSchemeDesignator
- the coding scheme designatorcodeValue
- the code value- Returns:
- the (first, if multiple) named child, or null if absent
-
getNamedChild
Retrieve the named child as defined by its ConceptName The code meaning of the concept is ignored, and only the code value and coding scheme designator are compared in the search.- Parameters:
item
- the coded sequence item of the concept name wanted- Returns:
- the (first, if multiple) named child, or null if absent
-
getSingleStringValueOrNull
Retrieve the string value of self- Returns:
- the value , or null if absent
-
getSingleStringValueOrNullOfNamedChild
public String getSingleStringValueOrNullOfNamedChild(String codingSchemeDesignator, String codeValue) Retrieve the string value of the named child as defined by its ConceptName- Parameters:
codingSchemeDesignator
- the coding scheme designatorcodeValue
- the code value- Returns:
- the value of the (first, if multiple) named child, or null if absent
-
getSingleStringValueOrNullOfNamedChild
public static String getSingleStringValueOrNullOfNamedChild(ContentItem parent, String codingSchemeDesignator, String codeValue) Retrieve the string value of the named child as defined by its ConceptName- Parameters:
parent
- the parentcodingSchemeDesignator
- the coding scheme designatorcodeValue
- the code value- Returns:
- the value of the (first, if multiple) named child, or null if absent
-
contentItemNameMatchesCodeValueAndCodingSchemeDesignator
public abstract boolean contentItemNameMatchesCodeValueAndCodingSchemeDesignator(String cvWanted, String csdWanted) Test if the coded concept name of the content item matches the specified code value and coding scheme designator. This is more robust than checking code meaning, which may have synomyms, and there is no need to also test code meaning. Does NOT follow references.- Parameters:
cvWanted
- the code value wantedcsdWanted
- the coding scheme designator wanted- Returns:
- true if matches
-
contentItemNameMatchesCodeValueAndCodingSchemeDesignator
public static boolean contentItemNameMatchesCodeValueAndCodingSchemeDesignator(ContentItem ci, String cvWanted, String csdWanted) Test if the coded concept name of the content item matches the specified code value and coding scheme designator. This is more robust than checking code meaning, which may have synomyms, and there is no need to also test code meaning. Does NOT follow references.- Parameters:
ci
- the content item to checkcvWanted
- the code value of the coded concept name wantedcsdWanted
- the coding scheme designator of the coded concept name wanted- Returns:
- true if matches
-