Class SetCharacteristicsFromSummary
A class containing an application for adding or replacing top level and shared multi-frame functional group attributes from a JSON summary description.
The JSON file used to describe the changes is not encoded in the same format as the standard PS3.18 Annex F DICOM JSON Model, since (a) it allows the data elements to be changed by keyword in addition to the data element tag, and (b) it compactly specifies whether the changes are to the top level dataset ("top") or the keyword of the sequence corresponding to the functional group to be changed, and (c) lists attributes in the top level data set to be removed ("remove") or those to be removed recursively from within sequences ("removeall"), and (d) lists options that control the process of modification.
The required format of the JSON file is a single enclosing object containing a list of objects named by "remove", "options", a functional group sequence keyword or "top".
The functional group sequence keyword or "top" entries each contains either a single string value, an array of string values (possibly empty) (for multi-valued attributes), or an array of objects (possibly empty) each of which is a sequence item consisting of a list of attributes, an object that contained a list of code sequence item attributes (named as cv for CodeValue, csd for CodingSchemeDesignator and cm for CodeMeaning) or null for an empty (type 2) attribute or sequence.
The "remove" object contains a list of keywords and null values.
The "options" object contains a list of options and boolean values. Current options are ReplaceCodingSchemeIdentificationSequence (default is true) and AppendToContributingEquipmentSequence (default is true)
E.g.:
{ "options" : { "AppendToContributingEquipmentSequence" : false }, "remove" : { "ContributingEquipmentSequence" : null }, "removeall" : { "FrameType" : null }, "top" : { "00204000" : "new value of ImageComments", "InstitutionalDepartmentName" : "Radiology", "ImageType" : [ "DERIVED", "PRIMARY", "DIXON", "WATER" ], "PatientBreedCodeSequence" : null, "BreedRegistrationSequence" : [ { "BreedRegistrationNumber" : "1234", "BreedRegistryCodeSequence" : { "cv" : "109200", "csd" : "DCM", "cm" : "America Kennel Club" } }, { "BreedRegistrationNumber" : \"5678\", "BreedRegistryCodeSequence" : { "cv" : "109202", "csd" : "DCM", "cm" : "American Canine Association" } } ], "StudyID" : null, "AccessionNumber" : [], "ReferencedStudySequence" : [], "ContentCreatorName" : "Smith^John" }, "FrameAnatomySequence" : { "AnatomicRegionSequence" : { "cv" : "T-A0100", "csd" : "SRT", "cm" : "Brain" }, "FrameLaterality" : "B" }, "ParametricMapFrameTypeSequence" : { "FrameType" : [ "DERIVED", "PRIMARY", "DIXON", "WATER" ] }, "FrameVOILUTSequence" : { "WindowCenter" : "0.7", "WindowWidth" : "0.7", "VOILUTFunction" : "LINEAR_EXACT" } }
Attributes are "merged" with the existing content of a functional group sequence, if any, otherwise a new functional group sequence is created.
Currently only the shared functional group sequence can be updated, since non-programmatic use cases for replacing the content of the per-frame functional group sequence items have not yet been identified.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DicomDictionary
protected String
protected Map
<AttributeTag, AttributeList> protected String
protected Set
<AttributeTag> protected Set
<AttributeTag> protected AttributeList
-
Constructor Summary
ConstructorsConstructorDescriptionSetCharacteristicsFromSummary
(String jsonfile, AttributeList list) Update top level and shared multi-frame functional group attributes from a JSON summary description.SetCharacteristicsFromSummary
(String jsonfile, String[] srcs, String dstFolderName, MessageLogger logger) Update top level and shared multi-frame functional group attributes from a JSON summary description.SetCharacteristicsFromSummary
(String jsonfile, String src, String dstFolderName, MessageLogger logger) Update top level and shared multi-frame functional group attributes from a JSON summary description. -
Method Summary
Modifier and TypeMethodDescriptionprotected AttributeTag
static void
Update top level and shared multi-frame functional group attributes from a JSON summary description.protected Attribute
protected Attribute
protected Attribute
protected Attribute
parseAttributeFromJSON
(javax.json.JsonObject obj, String name) protected void
parseAttributesFromJSON
(javax.json.JsonObject functionalGroupEntries, AttributeList list) protected void
parseAttributeTagsFromJSON
(javax.json.JsonObject entries, Set<AttributeTag> tags) protected void
parseOptionsFromJSON
(javax.json.JsonObject entries) protected void
parseSummaryFile
(String jsonfile) protected void
protected void
-
Field Details
-
ourAETitle
-
dstFolderName
-
options
-
topLevelRemovalList
-
recursiveRemovalList
-
topLevelReplacementsList
-
functionalGroupsReplacementsList
-
dictionary
-
-
Constructor Details
-
SetCharacteristicsFromSummary
public SetCharacteristicsFromSummary(String jsonfile, String src, String dstFolderName, MessageLogger logger) throws IOException, DicomException Update top level and shared multi-frame functional group attributes from a JSON summary description.
Updates SpecificCharacterSet before writing new file.
- Parameters:
jsonfile
- JSON file describing the functional groups and attributes and values to be added or replacedsrc
- source folder or DICOMDIRdstFolderName
- destination folderlogger
- logger to send progress, warnings and errors- Throws:
IOException
DicomException
-
SetCharacteristicsFromSummary
public SetCharacteristicsFromSummary(String jsonfile, String[] srcs, String dstFolderName, MessageLogger logger) throws IOException, DicomException Update top level and shared multi-frame functional group attributes from a JSON summary description.
Updates SpecificCharacterSet before writing new file.
- Parameters:
jsonfile
- JSON file describing the functional groups and attributes and values to be added or replacedsrcs
- source folders or DICOMDIRsdstFolderName
- destination folderlogger
- logger to send progress, warnings and errors- Throws:
IOException
DicomException
-
SetCharacteristicsFromSummary
public SetCharacteristicsFromSummary(String jsonfile, AttributeList list) throws IOException, DicomException Update top level and shared multi-frame functional group attributes from a JSON summary description.
Does not update SpecificCharacterSet in AttributeList.
- Parameters:
jsonfile
- JSON file describing the functional groups and attributes and values to be added or replacedlist
- the list to update- Throws:
IOException
DicomException
-
-
Method Details
-
getAttributeTagFromKeywordOrGroupAndElement
protected AttributeTag getAttributeTagFromKeywordOrGroupAndElement(String name) throws DicomException - Throws:
DicomException
-
makeNewAttribute
- Throws:
DicomException
-
makeNewStringAttribute
- Throws:
DicomException
-
makeNewSequenceAttribute
- Throws:
DicomException
-
parseAttributeFromJSON
protected Attribute parseAttributeFromJSON(javax.json.JsonObject obj, String name) throws DicomException - Throws:
DicomException
-
parseAttributesFromJSON
protected void parseAttributesFromJSON(javax.json.JsonObject functionalGroupEntries, AttributeList list) throws DicomException - Throws:
DicomException
-
parseAttributeTagsFromJSON
protected void parseAttributeTagsFromJSON(javax.json.JsonObject entries, Set<AttributeTag> tags) throws DicomException - Throws:
DicomException
-
parseOptionsFromJSON
- Throws:
DicomException
-
parseSummaryFile
- Throws:
DicomException
FileNotFoundException
-
processAttributeListAfterReplacements
- Throws:
DicomException
-
performReplacements
- Throws:
DicomException
-
main
Update top level and shared multi-frame functional group attributes from a JSON summary description.
- Parameters:
arg
- array of three or more strings - a JSON file describing the functional groups and attributes and values to be added or replaced, followed by one or more source folders or DICOMDIR, and a destination folder
-