public class CompositeInstanceContext
extends java.lang.Object
A class for representing the attributes of general modules that describe the patient, study, series, instance and related "context" of the payload of a composite DICOM instance.
The purpose is to allow the context to be extracted from an existing object, stored, and then reused in new objects, either wholly or partially, by selectively removing modules for lower level information entities as appropriate. E.g.:
CompositeInstanceContext cic = new CompositeInstanceContext(srcList,false); cic.removeInstance(); cic.removeSeries(); cic.removeEquipment(); dstList.putAll(cic.getAttributeList());
Static methods are also provided for operating directly on an AttributeList
.
Modifier and Type | Class and Description |
---|---|
static class |
CompositeInstanceContext.Selector
A class to select which entities are copied or propagated or removed or not during operations on CompositeInstanceContext.
|
Modifier and Type | Field and Description |
---|---|
protected static AttributeTag[] |
clinicalTrialSeriesModuleAttributeTags |
protected static AttributeTag[] |
clinicalTrialStudyModuleAttributeTags |
protected static AttributeTag[] |
clinicalTrialSubjectModuleAttributeTags |
protected static AttributeTag[] |
frameOfReferenceModuleAttributeTags |
protected static AttributeTag[] |
generalEquipmentModuleAttributeTags |
protected static AttributeTag[] |
generalImageModuleAttributeTags |
protected static AttributeTag[] |
generalSeriesModuleAttributeTags |
protected static AttributeTag[] |
generalStudyModuleAttributeTags |
protected AttributeList |
list |
protected static AttributeTag[] |
patientModuleAttributeTags |
protected static AttributeTag[] |
patientStudyModuleAttributeTags |
protected static AttributeTag[] |
sopCommonModuleAttributeTags |
protected static AttributeTag[] |
srDocumentGeneralModuleAttributeTags |
Constructor and Description |
---|
CompositeInstanceContext() |
CompositeInstanceContext(AttributeList srcList,
boolean forSR)
Create the composite context module
Attribute s with values from the supplied AttributeList . |
Modifier and Type | Method and Description |
---|---|
protected void |
addOrReplaceIfNotEmptyOtherwiseLeaveUnchanged(AttributeList srcList,
AttributeTag tag) |
protected void |
createPerformedProcedureCodeSequenceIfAbsent(AttributeList srcList) |
protected void |
createReferencedRequestSequenceIfAbsent(AttributeList srcList) |
boolean |
equals(java.lang.Object o) |
AttributeList |
getAttributeList()
Return the
AttributeList of all the Attribute s in the context. |
int |
hashCode() |
void |
put(Attribute a) |
void |
putAll(AttributeList srcList) |
void |
removeAllButPatient()
See
removeAllButPatient . |
static void |
removeAllButPatient(AttributeList list)
Remove the study, series, equipment, frame of reference and instance level modules
Attribute s. |
void |
removeAllButPatientAndStudy()
|
static void |
removeAllButPatientAndStudy(AttributeList list)
Remove the series, equipment, frame of reference and instance level modules
Attribute s. |
static void |
removeAllButSelected(AttributeList list,
CompositeInstanceContext.Selector selector)
Remove the unselected modules
Attribute s. |
void |
removeAllButSelected(CompositeInstanceContext.Selector selector)
Remove the unselected modules
Attribute s. |
void |
removeAllButSeries()
See
removeAllButSeries . |
static void |
removeAllButSeries(AttributeList list)
Remove the patient, study, equipment, frame of reference and instance level modules
Attribute s. |
void |
removeAllButStudy()
See
removeAllButStudy . |
static void |
removeAllButStudy(AttributeList list)
Remove the patient, series, equipment, frame of reference and instance level modules
Attribute s. |
static void |
removeAllSelected(AttributeList list,
CompositeInstanceContext.Selector selector)
Remove the selected modules
Attribute s. |
void |
removeAllSelected(CompositeInstanceContext.Selector selector)
Remove the selected modules
Attribute s. |
void |
removeEquipment()
See
removeEquipment . |
static void |
removeEquipment(AttributeList list)
Remove the General Equipment module
Attribute s. |
void |
removeFrameOfReference()
|
static void |
removeFrameOfReference(AttributeList list)
Remove the Frame of Reference module
Attribute s. |
void |
removeInstance()
See
removeInstance . |
static void |
removeInstance(AttributeList list)
Remove the SOP Common and General Image module
Attribute s. |
void |
removePatient()
|
static void |
removePatient(AttributeList list)
Remove the Patient and Clinical Trial Subject modules
Attribute s. |
void |
removeSeries()
See
removeSeries . |
static void |
removeSeries(AttributeList list)
Remove the General Series and Clinical Trial Series modules
Attribute s. |
void |
removeSRDocumentGeneral()
|
static void |
removeSRDocumentGeneral(AttributeList list)
Remove the SR Document General Image module
Attribute s. |
void |
removeStudy()
See
removeStudy . |
static void |
removeStudy(AttributeList list)
Remove the General Study, Patient Study and Clinical Trial Study modules
Attribute s. |
java.lang.String |
toString() |
void |
updateFromSource(AttributeList srcList,
boolean forSR)
Add or replace all of the composite context module
Attribute s with values from the supplied AttributeList . |
protected static AttributeTag[] clinicalTrialSeriesModuleAttributeTags
protected static AttributeTag[] clinicalTrialStudyModuleAttributeTags
protected static AttributeTag[] clinicalTrialSubjectModuleAttributeTags
protected static AttributeTag[] frameOfReferenceModuleAttributeTags
protected static AttributeTag[] generalEquipmentModuleAttributeTags
protected static AttributeTag[] generalImageModuleAttributeTags
protected static AttributeTag[] generalSeriesModuleAttributeTags
protected static AttributeTag[] generalStudyModuleAttributeTags
protected AttributeList list
protected static AttributeTag[] patientModuleAttributeTags
protected static AttributeTag[] patientStudyModuleAttributeTags
protected static AttributeTag[] sopCommonModuleAttributeTags
protected static AttributeTag[] srDocumentGeneralModuleAttributeTags
public CompositeInstanceContext()
public CompositeInstanceContext(AttributeList srcList, boolean forSR)
Create the composite context module Attribute
s with values from the supplied AttributeList
.
forSR
- true if need to populate the SR Document General Module specific Attribute
s from their image equivalentssrcList
- the list of attributes to use as the sourceprotected void addOrReplaceIfNotEmptyOtherwiseLeaveUnchanged(AttributeList srcList, AttributeTag tag)
protected void createPerformedProcedureCodeSequenceIfAbsent(AttributeList srcList)
protected void createReferencedRequestSequenceIfAbsent(AttributeList srcList)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public AttributeList getAttributeList()
Return the AttributeList
of all the Attribute
s in the context.
AttributeList
of all the Attribute
s in the contextpublic int hashCode()
hashCode
in class java.lang.Object
public void put(Attribute a)
public void putAll(AttributeList srcList)
public void removeAllButPatient()
removeAllButPatient
.public static void removeAllButPatient(AttributeList list)
Remove the study, series, equipment, frame of reference and instance level modules Attribute
s.
list
- the list of attributes to editpublic void removeAllButPatientAndStudy()
public static void removeAllButPatientAndStudy(AttributeList list)
Remove the series, equipment, frame of reference and instance level modules Attribute
s.
list
- the list of attributes to editpublic static void removeAllButSelected(AttributeList list, CompositeInstanceContext.Selector selector)
Remove the unselected modules Attribute
s.
list
- the list of attributes to editselector
- the modules to keeppublic void removeAllButSelected(CompositeInstanceContext.Selector selector)
Remove the unselected modules Attribute
s.
removeAllButSelected
.selector
- the modules to keeppublic void removeAllButSeries()
removeAllButSeries
.public static void removeAllButSeries(AttributeList list)
Remove the patient, study, equipment, frame of reference and instance level modules Attribute
s.
list
- the list of attributes to editpublic void removeAllButStudy()
removeAllButStudy
.public static void removeAllButStudy(AttributeList list)
Remove the patient, series, equipment, frame of reference and instance level modules Attribute
s.
list
- the list of attributes to editpublic static void removeAllSelected(AttributeList list, CompositeInstanceContext.Selector selector)
Remove the selected modules Attribute
s.
list
- the list of attributes to editselector
- the modules to removepublic void removeAllSelected(CompositeInstanceContext.Selector selector)
Remove the selected modules Attribute
s.
removeAllSelected
.selector
- the modules to removepublic void removeEquipment()
removeEquipment
.public static void removeEquipment(AttributeList list)
Remove the General Equipment module Attribute
s.
list
- the list of attributes to editpublic void removeFrameOfReference()
public static void removeFrameOfReference(AttributeList list)
Remove the Frame of Reference module Attribute
s.
list
- the list of attributes to editpublic void removeInstance()
removeInstance
.public static void removeInstance(AttributeList list)
Remove the SOP Common and General Image module Attribute
s.
list
- the list of attributes to editpublic void removePatient()
public static void removePatient(AttributeList list)
Remove the Patient and Clinical Trial Subject modules Attribute
s.
list
- the list of attributes to editpublic void removeSeries()
removeSeries
.public static void removeSeries(AttributeList list)
Remove the General Series and Clinical Trial Series modules Attribute
s.
list
- the list of attributes to editpublic void removeSRDocumentGeneral()
public static void removeSRDocumentGeneral(AttributeList list)
Remove the SR Document General Image module Attribute
s.
list
- the list of attributes to editpublic void removeStudy()
removeStudy
.public static void removeStudy(AttributeList list)
Remove the General Study, Patient Study and Clinical Trial Study modules Attribute
s.
list
- the list of attributes to editpublic java.lang.String toString()
toString
in class java.lang.Object
public void updateFromSource(AttributeList srcList, boolean forSR)
Add or replace all of the composite context module Attribute
s with values from the supplied AttributeList
.
If an Attribute
is empty or missing in the supplied list, the existing value in the context is left unchanged (not removed or emptied).
This is useful when building composite context from multiple input composite instances, in which optional Attribute
s are filled in some,
but not others, in order to accumulate the most information available.
srcList
- the list of attributes to use as the sourceforSR
- true if need to populate the SR Document General Module specific Attribute
s from their image equivalents