org.dcm4che.srom
Interface Content

All Known Subinterfaces:
CodeContent, CompositeContent, ContainerContent, DateContent, DateTimeContent, ImageContent, KeyObject, NumContent, PNameContent, ReferencedContent, SCoordContent, SCoordContent.Circle, SCoordContent.Ellipse, SCoordContent.MultiPoint, SCoordContent.Point, SCoordContent.Polyline, SRDocument, TCoordContent, TCoordContent.Begin, TCoordContent.End, TCoordContent.MultiPoint, TCoordContent.MultiSegment, TCoordContent.Point, TCoordContent.Segment, TextContent, TimeContent, UIDRefContent, WaveformContent

public interface Content

The Content interface is the primary datatype for the entire SR Object Model. It represents a single Content Item in the document tree.

Version:
0.9.9
Author:
gunter.zeilinger@tiani.com
See Also:
"DICOM Part 3: Information Object Definitions, Annex C.17.3 SR Document Content Module"

Nested Class Summary
static class Content.RelationType
          Enumeration of Relationship Types between the (enclosing) Source Content Item and the Target Content Item.
static class Content.ValueType
          Enumeration of Value Types of Content Items.
 
Field Summary
static org.apache.log4j.Logger log
           
 
Method Summary
 Content appendChild(Content.RelationType rel, Content node)
          Adds the content newChild with the specified RelationType at the end of the list of children.
 Content clone(boolean deep)
          Returns a duplicate of this content.
 Content getFirstChild()
          Gets first child of this content.
 Content getFirstChildBy(Content.RelationType rel, Code name)
          Gets first child with the specified RelationType and name of this content, If there is no such child content, this returns null.
 int[] getID()
          Returns the Content Item Identifier< of this content, specifying its position in the document tree.
 Content getLastChild()
          Gets last child of this content.
 Code getName()
          Returns the Concept Name Code of this content.
 Content getNextSibling()
          Gets the content immediately following this content.
 Content getNextSiblingBy(Content.RelationType rel, Code name)
          Gets the next content following this content with the specified RelationType to its parent and Concept Name Code.
 java.util.Date getObservationDateTime(boolean inherit)
          Gets the Observation DateTime associated with this content.
 KeyObject getOwnerDocument()
          Gets the SRDocument or KeyObject object associated with this content.
 Content getParent()
          Gets (enclosing) parent content.
 Content getPreviousSibling()
          Gets the content immediately preceding this content.
 Content.RelationType getRelationType()
          Gets type of relationship between (enclosing) parent content and this (child) content.
 Template getTemplate()
          Gets the Template that describes the content of this Content Item.
 Content.ValueType getValueType()
          Gets type of the value encoded in this Content Item.
 boolean hasChildren()
          Returns whether this content has any children.
 Content insertBefore(Content.RelationType rel, Content newChild, Content refChild)
          Inserts the content newChild with the specified RelationType before the existing child content refChild.
 Content removeChild(Content oldChild)
          Removes the child content indicated by oldChild from the list of children, and returns it.
 Content replaceChild(Content.RelationType rel, Content node, Content old)
          Replaces the child content oldChild with newChild and the specified RelationType in the list of children, and returns the oldChild content.
 void setName(Code newName)
          Sets new Concept Name Code of this content.
 void toDataset(Dataset ds)
           
 

Field Detail

log

static final org.apache.log4j.Logger log
Method Detail

getID

int[] getID()
Returns the Content Item Identifier< of this content, specifying its position in the document tree. Returns null, if this content is not inserted in the document tree yet.

Returns:
Content Item Identifier.

getName

Code getName()
Returns the Concept Name Code of this content. Returns null, if no name is associated with this content.

Returns:
Concept Name Code of this Content Item.

setName

void setName(Code newName)
Sets new Concept Name Code of this content.

Parameters:
newName - new Concept Name Code of this Content Item.

getOwnerDocument

KeyObject getOwnerDocument()
Gets the SRDocument or KeyObject object associated with this content. This is also the SRDocument or KeyObject object used to create this ontent.

Returns:
SRDocument or KeyObject object associated with this content.

getObservationDateTime

java.util.Date getObservationDateTime(boolean inherit)
Gets the Observation DateTime associated with this content. Returns null if inherit is false, and there is no Observation DateTime (0040,A032) directly associated with this content. If inherit is true, the function searchs for a parent content with an associated Observation DateTime, and returns that value. If there is also no parent content with an associated Observation DateTime, the function returns the Content DataTime of the associated SRDocument.

Parameters:
inherit - specifies whether to inherit value from parents.
Returns:
Observation DateTime associated with this content.

getTemplate

Template getTemplate()
Gets the Template that describes the content of this Content Item. Returns null, if no code>Template is associated with this content.

Returns:
Template that describes the content of this Content Item

getRelationType

Content.RelationType getRelationType()
Gets type of relationship between (enclosing) parent content and this (child) content. Returns null, if this content is not inserted in the document tree yet or it is the root content of the document.

Returns:
type of relationship between the parent content and this (child) content.

getValueType

Content.ValueType getValueType()
Gets type of the value encoded in this Content Item.

Returns:
type of the value encoded in this Content Item.

getParent

Content getParent()
Gets (enclosing) parent content. Returns null, if this content is not inserted in the document tree yet or it is the root content of the document.

Returns:
parent content.

getFirstChild

Content getFirstChild()
Gets first child of this content. If there is no child content, this returns null.

Returns:
first child of this content.

getFirstChildBy

Content getFirstChildBy(Content.RelationType rel,
                        Code name)
Gets first child with the specified RelationType and name of this content, If there is no such child content, this returns null.

Parameters:
rel - specifies RelationType; null for any RelationType.
name - specifies Concept Name Code; null for any Concept Name Code.
Returns:
first child with the specified RelationType and name of this content.

getLastChild

Content getLastChild()
Gets last child of this content. If there is no child content, this returns null.

Returns:
last child of this content.

getPreviousSibling

Content getPreviousSibling()
Gets the content immediately preceding this content. If there is no such content, this returns null.

Returns:
immediately preceding content.

getNextSibling

Content getNextSibling()
Gets the content immediately following this content. If there is no such content, this returns null.

Returns:
immediately following content.

getNextSiblingBy

Content getNextSiblingBy(Content.RelationType rel,
                         Code name)
Gets the next content following this content with the specified RelationType to its parent and Concept Name Code.

Parameters:
rel - specifies RelationType; null for any RelationType.
name - specifies Concept Name Code; null for any Concept Name Code.
Returns:
next content following this content with the specified RelationType to its parent and Concept Name Code.

insertBefore

Content insertBefore(Content.RelationType rel,
                     Content newChild,
                     Content refChild)
Inserts the content newChild with the specified RelationType before the existing child content refChild. If refChild is null, inserts newChild at the end of the list of children.

Parameters:
rel - RelationType of the new child to this content.
newChild - The content to insert.
refChild - The reference content, i.e., the content before which the new content must be inserted.
Returns:
The content being inserted.
Throws:
java.lang.IllegalArgumentException - if newChild is not associated to the same SRDocument as this content, or newChild is already in the tree, or refChild is not a child of this content, or RelationType or the RelationType of newChild violates constraints of the IOD, associated with the SOP Class, specified by the SOP Class UID of the associated SRDocument.

replaceChild

Content replaceChild(Content.RelationType rel,
                     Content node,
                     Content old)
Replaces the child content oldChild with newChild and the specified RelationType in the list of children, and returns the oldChild content.

Parameters:
rel - RelationType of the new child to this content.
newChild - The content to insert.
oldChild - The content to replace.
Returns:
The content replaced.
Throws:
java.lang.IllegalArgumentException - if newChild is not associated to the same SRDocument as this content, or newChild is already in the tree, or oldChild is not a child of this content, or RelationType or the RelationType of newChild violates constraints of the IOD, associated with the SOP Class, specified by the SOP Class UID of the associated SRDocument.

removeChild

Content removeChild(Content oldChild)
Removes the child content indicated by oldChild from the list of children, and returns it.

Parameters:
oldChild - The content being removed.
Returns:
The content removed.
Throws:
java.lang.IllegalArgumentException - if oldChild is not a child of this content.

appendChild

Content appendChild(Content.RelationType rel,
                    Content node)
Adds the content newChild with the specified RelationType at the end of the list of children.

Parameters:
rel - RelationType of the new child to this content.
newChild - The content to insert.
Returns:
The content being inserted.
Throws:
java.lang.IllegalArgumentException - if newChild is not associated to the same SRDocument as this content, or newChild is already in the tree, or RelationType or the RelationType of newChild violates constraints of the IOD, associated with the SOP Class, specified by the SOP Class UID of the associated SRDocument.

hasChildren

boolean hasChildren()
Returns whether this content has any children.

Returns:
true if this content has any children, false otherwise.

clone

Content clone(boolean deep)
Returns a duplicate of this content. The duplicate content has no parent and is associated with the same SRDocument object as this content. Use SRDocument.importContent instead, to change the associated SRDocument object.

The Observation DateTime of the duplicate content is explicitly set to this.getObservationDateTime(true) .

Parameters:
deep - If true, recursively clone the subtree under the specified content; if false, clone only the content itself.
Returns:
The duplicate content.

toDataset

void toDataset(Dataset ds)