public class MCdicomDirEx
extends java.lang.Object
Provides functionality to manipulate DICOMDIR files.
This class provides enhanced DICOMDIR functionality in contrast to the MCdicomDir
class with basic, in memory, DICOMDIR functionality.
MCdicomDirEx
reads records from the DICOMDIR file only when they are required thus speeding
up the access to specific records. This class also allows updates to existing DICOMDIR files
without the need to rewrite the whole file when a directory record is added or deleted.
Instances of this class allow the application to incrementally add new records or delete existing
records using MCdicomDirRecord
.addRecord
, delete
and update
methods, without rewriting the whole file.
Attributes of the directory entity can be read through the root record object provided
by the RootRecord
property. The Directory Record Seqyuence (0004,1220) attribute and
its content is not accessible to the application as it is managed internally by the toolkit.
Although the toolkit allows the application to modify the content of existing directory records or the attributes in the directory object itself, the changes will not be reflected in the DICOMDIR file.
Constructor and Description |
---|
MCdicomDirEx(java.lang.String path)
Creates a new instance of this class providing access to an existing DICOMDIR file.
|
MCdicomDirEx(java.lang.String path,
java.lang.String fileSetID,
MCfile fileTemplate)
Creates a new instance of this class to handle a new DICOMDIR file with no records.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the DICOMDIR file and releases all record objects associated with it.
|
java.lang.String |
getFileSetID()
Gets a value of the File-set ID (0004,1130) attribute or
null if the attribute is missing |
java.lang.String |
getImplementationClassUID()
Gets the value of the Implementation Class UID (0002,0012) attribute.
|
java.lang.String |
getImplementationVersionName()
Gets the value of the Implementation Version Name (0002,0013) attribute.
|
java.lang.String |
getMediaStorageSOPInstanceUID()
Gets the value of the Media Storage SOP Instance UID (0002,0003) attribute.
|
MCdicomDirRecord |
getRootRecord()
Gets the record object representing the root of the directory record hierarchy.
|
void |
update()
Commits all pending changes to the DICOMDIR file.
|
public MCdicomDirEx(java.lang.String path)
path
- The file path to the DICOMDIR file.
This constructor opens an existing DICOMDIR file for reading and/or updating.
As opposed to opening DICODMIR files using MCdicomDir
class, this class does
not read the whole content of the DICOMDIR in the memory, instead it reads only the first
directory record if it exists. Subsequent directory records are read only on demand, when the
application requires access to them, providing fast and efficient access to large DICOMDIRs.
public MCdicomDirEx(java.lang.String path, java.lang.String fileSetID, MCfile fileTemplate)
The toolkit copies group 2 and 4 attribute values from the specified template file object. If the
Media Storage SOP Instance UID attribute is not present in the template file or the template file
argument is null
the toolkit will generate a UID based on the IMPLEMENTATION_CLASS_UID
configuration item.
path
- The file path to the new DICOMDIR file.fileSetID
- The value to be assigned to the File Set ID attribute
(0004,1130). If this argument is null
the toolkit will copy the value of the File
Set ID attribute from the template file, if specifiedfileTemplate
- A file object containing attribute values for the new DICODMIR.
If this argument is null
the toolkit creates an empty DICOMDIR with a minimal number of
attributes.
MCexception
- The path argument was invalid.public MCdicomDirRecord getRootRecord()
MCdicomDirRecord
record object representing the root entity of the directory.
The Root record does not represent a physical record in the DICOMDIR file, instead it provides access to attributes of the directory object and it allows consistent navigation throughout the record hierarchy.
public void update()
This method updates the DICOMDIR file to reflect all changes to the dicomdir object as the result of adding and deleting records. The toolkit writes new records to the end of the directory record sequence and bridges over deleted records so that they are no longer accessible.
The toolkit does not make changes to existing records or the attributes of the directory object, except for the values of the offset attributes required to represent the modified record hierarchy.
MCexception
- public void close()
This method ignores any changes made to the record hierarchy (new or deleted records)
since the last call to update
method.
public java.lang.String getMediaStorageSOPInstanceUID()
String
object representing the first value of the Media Storage SOP Instance UID (0002,0003)
attribute or null
if the attribute is missing.public java.lang.String getFileSetID()
null
if the attribute is missingString
value of the File-set ID (0004,1130) attribute.public java.lang.String getImplementationClassUID()
String
object representing the first value of the Implementation Class UID (0002,0012)
attribute or null
if the attribute is missing.public java.lang.String getImplementationVersionName()
String
object representing the first value of the Implementation Version Name (0002,0013)
attribute or null
if the attribute is missing.MCexception
- The DICOMDIR object has been disposes.