public class MCdicomDir.MCdirRecord
extends java.lang.Object
The attributes of a record can be accessed through the methods of the sequence item object
returned by the getRecordItem()
method.
See the documentation of MCdicomDir
class for a description on how to navigate the
records in a DICOMDIR.
Modifier and Type | Method and Description |
---|---|
MCdicomDir.MCdirRecord |
addChildRecord(java.lang.String newRecordName)
Adds a lower level directory record to the current record.
|
void |
delete()
Deletes this directory record and any entities it references.
|
void |
deleteChildren()
Deletes all lower level directory records.
|
void |
dispose() |
MCdicomDir.MCdirRecord |
findRecord(int tag,
java.lang.String value)
Searches for the directory record containing the attribute with the specified value.
|
int |
getChildCount()
Gets the number of child records of the current record.
|
MCdicomDir |
getDir()
Gets the DICOMDIR object containing this record.
|
MCdicomDir.MCdirRecord |
getFirstChild()
Gets the first lower level record.
|
MCdicomDir.MCdirRecord |
getNextChild()
Get the next lower level record of this record.
|
MCdicomDir.MCdirRecord |
getParent()
Get the parent of the current directory record.
|
MCitem |
getRecordItem()
Gets the item that contains the attributes of this record.
|
java.lang.String |
getRecordName()
Gets the name of this record.
|
int |
getReferencedRecordCount()
Gets a count of the number of records contained "below" this record.
|
boolean |
isLast()
Tells whether this record is the last child of the parent record.
|
void |
list()
Lists the content of this attribute set in a human readable form to the "standard" output stream
System.out . |
void |
list(java.io.PrintStream dest)
Lists the contents of this record including all child records.
|
java.lang.String |
toString()
Returns a string representation of this record.
|
public MCdicomDir getDir()
MCdir
instance to which this record belongs.public boolean isLast()
true
if this record is the last child of the parent record.public java.lang.String getRecordName()
The name of a record is the name of the sequence item name it contains, as defined in the mergecom.srv configuration file in the 'ITEM_TABLE' section, except for the root record in a DICOMDIR whose name is "ROOT". For example the name of a Patient Directory record is "DIR_REC_PATIENT" and the name of a Study Directory record is "DIR_REC_STUDY".
public MCitem getRecordItem()
The returned item is linked to this record object and can not be added as a value to sequence attributes.
If this record is deleted, the item becomes invalid and should not be used.
MCitem
containing the attributes of this record
or null
if this is the root record.public MCdicomDir.MCdirRecord getParent()
MCdirRecord
instance or null
if this is the root record.public int getReferencedRecordCount()
The count returned is computed during this function call. Because this count is generated on the fly, there is a performance penalty associated with this call. During this call, each record referenced by this record is traversed, and the total number of items is generated.
MCexception
- if there is an error with the Message Information configuration file
or the toolkit has found a corrupted record ID in a directory record offset attribute while
trying to traverse the DICOMDIR. See the log file for more details.public int getChildCount()
The count returned is maintained internally whenever records are added or deleted from a DICOMDIR. Because this count is maintained internally, there is no performance penalty associated with this function call.
MCexception
- if there is an error with the Message Information configuration file
or the toolkit has found a corrupted record ID in a directory record offset attribute while
trying to traverse the DICOMDIR. See the log file for more details.public MCdicomDir.MCdirRecord getFirstChild()
MCdirRecord
representing the lower level record
or null
if the current record does not have child records.MCexception
- if the toolkit has found a corrupted record ID in a directory
record offset attribute while trying to traverse the DICOMDIR. See the log file for more details.public MCdicomDir.MCdirRecord getNextChild()
This method can be called in a loop to obtain all lower level records of this
record. It is recommended to call getFirstChild()
before the first call
to this method to obtain the first child record.
MCdirRecord
representing the next lower level record
or null
if the current record does not have more child records.MCexception
- if the toolkit has found a corrupted record ID in a directory
record offset attribute while trying to traverse the DICOMDIR. See the log file for more details.public MCdicomDir.MCdirRecord addChildRecord(java.lang.String newRecordName)
The name provided is used to access configuration information which describes the
attributes of the new directory record. If such configuration information is not
available, an empty item object is created, and a warning message is logged. See
getRecordName()
for a description of record names.
newRecordName
- The name of the record item to be created.MCdirRecord
object representing the newly added child record.MCexception
- if the argument is null
, the record is deleted, the directory
record type specified is an invalid lower level type for the current directory record, the toolkit has
found a corrupted record ID in a directory record offset attribute while trying to traverse the DICOMDIR.
Check the value of the MCexception.exceptionNumber
field of the exception object
for the cause of the failure.public void delete()
When a record is deleted the toolkit detaches the record and any child records from
the DICOMDIR and any further method calls on the deleted records will result in an
exception or null
return value.
The root record of a DICOMDIR can not be deleted. Use deleteChildren()
method
on the root record to delete all records of a DICOMDIR.
MCexception
- if the toolkit has found a corrupted record ID in a directory
record offset attribute while trying to traverse the DICOMDIR. See the log file for more details.public void deleteChildren()
MCexception
- if the toolkit has found a corrupted record ID in a directory
record offset attribute while trying to traverse the DICOMDIR. See the log file for more details.public void list(java.io.PrintStream dest)
dest
- The output for the listing.MCexception
- if the argument is null
, the record is deleted, the toolkit has
found a corrupted record ID in a directory record offset attribute while trying to traverse the DICOMDIR.
Check the value of the MCexception.exceptionNumber
field of the exception object
for the cause of the failure.public void list()
System.out
.MCexception
- if the record is deleted, the toolkit has found a corrupted record ID in a directory
record offset attribute while trying to traverse the DICOMDIR. Check the value of the
MCexception.exceptionNumber
field of the exception object for the cause of the failure.public MCdicomDir.MCdirRecord findRecord(int tag, java.lang.String value)
The search starts with the current record and continues down the record hierarchy
until a match is found. If no matching record is found this method returns null
.
This method supports only exact, case sensitive string matching on the first value of the specified attribute.
tag
- The tag number of the attribute to match.value
- The attribute value to match against.null
if no match was found.public java.lang.String toString()
The returned string contains the type of the record and a unique numeric identifier of this record.
toString
in class java.lang.Object
String
that identifies this recordpublic void dispose()