public class StructuredReport
extends java.lang.Object
implements javax.swing.tree.TreeModel
The StructuredReport
class implements a
TreeModel
to abstract the contents of a list of attributes
representing a DICOM Structured Report as
a tree in order to provide support for a StructuredReportBrowser
.
For details of some of the methods implemented here see javax.swing.tree.TreeModel
.
A main method is provided for testing that reads a DICOM file containing an SR and dumps its contents in a human-readable form to System.err.
ContentItem
,
ContentItemFactory
,
StructuredReportBrowser
Constructor and Description |
---|
StructuredReport(AttributeList list)
Construct an internal tree representation of a structured report from
a list of DICOM attributes.
|
StructuredReport(ContentItem root)
Construct an internal tree representation of a structured report from an existing root content item.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener tml) |
static java.util.Vector |
findAllContainedSOPInstances(ContentItem root,
ContentItem item)
Find all coordinate and image references within content items of the sub-tree rooted at the specified node (which may be the root).
|
AttributeList |
getAttributeList()
Return the entire content tree of a structured report as an
AttributeList . |
java.lang.Object |
getChild(java.lang.Object node,
int index) |
int |
getChildCount(java.lang.Object parent) |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child) |
java.lang.Object |
getRoot() |
boolean |
isLeaf(java.lang.Object node) |
static void |
main(java.lang.String[] arg)
Dump the SR encoded in the file name on the console.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener tml) |
java.lang.String |
toString()
Dump the entire tree as a
String . |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue) |
static java.lang.String |
walkTreeBuldingString(ContentItem node,
java.lang.String location)
Dump the tree starting at the specified node as a
String . |
public StructuredReport(AttributeList list) throws DicomException
Construct an internal tree representation of a structured report from a list of DICOM attributes.
list
- the list of attributes in which the structured report is encodedDicomException
public StructuredReport(ContentItem root) throws DicomException
Construct an internal tree representation of a structured report from an existing root content item.
root
- the root content itemDicomException
public void addTreeModelListener(javax.swing.event.TreeModelListener tml)
addTreeModelListener
in interface javax.swing.tree.TreeModel
tml
- public static java.util.Vector findAllContainedSOPInstances(ContentItem root, ContentItem item)
Find all coordinate and image references within content items of the sub-tree rooted at the specified node (which may be the root).
The annotation of the reference is derived from the value of the Concept Name of the parent (and its parent, if a NUM content item).
root
- the root node, for dereferencing by-reference relationshipsitem
- the node to start searching fromVector
of SpatialCoordinateAndImageReference
public AttributeList getAttributeList()
Return the entire content tree of a structured report as an AttributeList
.
Has the side effect of creating (or replacing) the ContentSequence attributes of the AttributeList
of each ContentItem
to represent the tree structure.
AttributeList
representing the content tree, or null if empty root.public java.lang.Object getChild(java.lang.Object node, int index)
getChild
in interface javax.swing.tree.TreeModel
node
- index
- public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
parent
- public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
parent
- child
- public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public boolean isLeaf(java.lang.Object node)
isLeaf
in interface javax.swing.tree.TreeModel
node
- public static void main(java.lang.String[] arg)
Dump the SR encoded in the file name on the console.
arg
- public void removeTreeModelListener(javax.swing.event.TreeModelListener tml)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
tml
- public java.lang.String toString()
Dump the entire tree as a String
.
toString
in class java.lang.Object
String
representing the treepublic void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface javax.swing.tree.TreeModel
path
- newValue
- public static java.lang.String walkTreeBuldingString(ContentItem node, java.lang.String location)
Dump the tree starting at the specified node as a String
.
node
- location
- the dotted numeric string describing the location of the starting nodeString
representing the tree fragment