Package com.pixelmed.dicom

## Class JSONRepresentationOfStructuredReportObjectFactory

- java.lang.Object
- - com.pixelmed.dicom.JSONRepresentationOfStructuredReportObjectFactory

-     public class JSONRepresentationOfStructuredReportObjectFactory
      extends java.lang.Object

  A class to encode a representation of a DICOM Structured Report object in a JSON form, suitable for analysis as human-readable text.

  Note that JSON representations can either contain only the content tree, or also the additional top level DICOM attributes other than those that encode the content tree, as individual DICOM attributes, in the manner of `JSONRepresentationOfDicomObjectFactory`.

  A typical example of usage to extract just the content tree would be:

      try {
          AttributeList list = new AttributeList();
          list.read("dicomsrfile",null,true,true);
              StructuredReport sr = new StructuredReport(list);
          JsonArray document = new JSONRepresentationOfStructuredReportObjectFactory().getDocument(sr);
          JSONRepresentationOfStructuredReportObjectFactory.write(System.out,document);
      } catch (Exception e) {
          slf4jlogger.error("",e);
       }

  or to include the top level attributes as well as the content tree, supply the attribute list as well as the parsed SR content to the write() method:

      try {
          AttributeList list = new AttributeList();
          list.read("dicomsrfile",null,true,true);
              StructuredReport sr = new StructuredReport(list);
          JsonArray document = new JSONRepresentationOfStructuredReportObjectFactory().getDocument(sr,list);
          JSONRepresentationOfStructuredReportObjectFactory.write(System.out,document);
      } catch (Exception e) {
          slf4jlogger.error("",e);
       }

  or even simpler, if there is no further use for the JSON document or the SR tree model:

      try {
          AttributeList list = new AttributeList();
          list.read("dicomsrfile",null,true,true);
          JSONRepresentationOfStructuredReportObjectFactory.createDocumentAndWriteIt(list,System.out);
      } catch (Exception e) {
          slf4jlogger.error("",e);
       }

  See Also:
    `StructuredReport`, `JSONRepresentationOfDicomObjectFactory`, `XPathQuery`, `Document`

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.Map<java.lang.String,​CodedSequenceItem>` | `businessNames` |
    `protected static java.lang.String` | `businessNameToUseForAnonymousContentItems` |
    `protected static boolean` | `collapseAttributeValueArrays` |
    `protected static boolean` | `collapseContentTreeArrays` |
    `protected static boolean` | `collapseEmptyToNull` |
    `protected ContentItemFactory` | `contentItemFactory` |
    `protected java.util.Map<ContentItem,​java.lang.String>` | `contentItemIdentifiersByContentItem` |
    `protected static boolean` | `elideSeparateContinuityOfContent` |
    `protected java.util.Map<java.lang.String,​java.lang.String>` | `referencedContentItemIdentifiersBySimplifiedLabel` |
    `protected java.util.Map<java.lang.String,​java.util.SortedSet<java.lang.String>>` | `relationshipTypesByBusinessName` |
    `protected static java.lang.String` | `reservedKeywordFor2DCoordinatesAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordFor3DCoordinatesAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordForAlphabeticPropertyInPersonNameContentItem` |
    `protected static java.lang.String` | `reservedKeywordForCodeMeaningInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForCodeValueInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForCodingSchemeDesignatorInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForCodingSchemeVersionInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextGroupExtensionCreatorUIDInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextGroupExtensionFlagInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextGroupLocalVersionInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextGroupVersionInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextIdentifierInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContextUIDInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForContinuityOfContentAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForFiducialUIDAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordForFloatingPointValueAttributeInNumericContentItem` |
    `protected static java.lang.String` | `reservedKeywordForGraphicTypeAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordForIdeographicPropertyInPersonNameContentItem` |
    `protected static java.lang.String` | `reservedKeywordForLongCodeValueInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForMappingResourceInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForMappingResourceNameInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForMappingResourceUIDInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForMeasurementUnitsAttributeInNumericContentItem` |
    `protected static java.lang.String` | `reservedKeywordForNumericValueQualifierAttributeInNumericContentItem` |
    `protected static java.lang.String` | `reservedKeywordForObservationDateTimeAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForObservationUIDAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForPhoneticPropertyInPersonNameContentItem` |
    `protected static java.lang.String` | `reservedKeywordForPixelOriginInterpretationAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordForPresentationStateSOPClassUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForPresentationStateSOPInstanceUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForRationalDenominatorAttributeInNumericContentItem` |
    `protected static java.lang.String` | `reservedKeywordForRationalNumeratorAttributeInNumericContentItem` |
    `protected static java.lang.String` | `reservedKeywordForRealWorldValueMappingSOPClassUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForRealWorldValueMappingSOPInstanceUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForReferencedFrameNumberAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForReferencedFrameOfReferenceUIDAttributeInCoordinatesContentItem` |
    `protected static java.lang.String` | `reservedKeywordForReferencedSegmentNumberAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForReferencedSOPClassUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForReferencedSOPInstanceUIDAttributeInCompositeContentItem` |
    `protected static java.lang.String` | `reservedKeywordForRelationshipTypeInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForSimplifiedLabelAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForSimplifiedReferenceToLabelAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForTemplateIdentifierAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForTemplateMappingResourceAttributeInSRFile` |
    `protected static java.lang.String` | `reservedKeywordForURNCodeValueInBusinessNamesFile` |
    `protected static java.lang.String` | `reservedKeywordForValueTypeInBusinessNamesFile` |
    `protected java.util.Map<java.lang.String,​java.lang.String>` | `simplifiedLabelByReferencedContentItemIdentifiers` |
    `protected int` | `simplifiedLabelCounter` |
    `protected static java.lang.String` | `simplifiedLabelPrefix` |
    `protected static boolean` | `substituteUIDKeywords` |
    `protected static java.lang.String` | `symbolSignifyingReservedKeyword` |
    `protected static boolean` | `useNumberForNumericContentItemValue` |
    `protected java.util.Map<java.lang.String,​java.util.SortedSet<java.lang.String>>` | `valueTypesByBusinessName` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JSONRepresentationOfStructuredReportObjectFactory()` | Construct a factory object, which can be used to get JSON documents from DICOM objects.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `addCodedSequenceItemPropertyFromBusinessName​(javax.json.JsonObject businessNamePayload, AttributeList csilist, AttributeTag tag, java.lang.String reservedKeywordInBusinessNamesFile)` |
    `static void` | `createDocumentAndWriteIt​(AttributeList list, java.io.OutputStream out)` | Serialize a JSON document created from a DICOM Structured Report.
    `static void` | `createDocumentAndWriteIt​(StructuredReport sr, AttributeList list, java.io.File outputFile)` | Serialize a JSON document created from a DICOM attribute list.
    `static void` | `createDocumentAndWriteIt​(StructuredReport sr, AttributeList list, java.io.OutputStream out)` | Serialize a JSON document created from a DICOM attribute list.
    `static void` | `createDocumentAndWriteIt​(StructuredReport sr, AttributeList list, java.lang.String outputPath)` | Serialize a JSON document created from a DICOM attribute list.
    `static void` | `createDocumentAndWriteIt​(StructuredReport sr, java.io.OutputStream out)` | Serialize a JSON document created from a DICOM Structured Report.
    `protected java.lang.String` | `determineUnknownRelationshipType​(java.lang.String parentValueType, java.lang.String childValueType, javax.json.JsonValue childObjectValue)` |
    `protected java.lang.String` | `determineUnknownValueType​(java.lang.String parentValueType, javax.json.JsonValue childObjectValue)` |
    `AttributeList` | `getAttributeList​(java.io.File file)` | Given a DICOM SR object encoded as a JSON document in a file convert it to a list of attributes.
    `AttributeList` | `getAttributeList​(java.io.InputStream stream)` | Given a DICOM SR object encoded as a JSON document in a stream convert it to a list of attributes.
    `AttributeList` | `getAttributeList​(java.lang.String name)` | Given a DICOM SR object encoded as a JSON document in a named file convert it to a list of attributes.
    `AttributeList` | `getAttributeList​(javax.json.JsonArray document)` | Given a DICOM SR object encoded as a JSON document convert it to a list of attributes.
    `AttributeList` | `getAttributeList​(javax.json.JsonObject topLevelObject)` | Given a DICOM SR object encoded in a JSON document convert it to a list of attributes.
    `javax.json.JsonArray` | `getBusinessNamesDocument()` |
    `CodedSequenceItem` | `getCodedSequenceItemForBusinessName​(java.lang.String businessName, java.lang.String location, boolean roleIsAsConceptName)` |
    `CodedSequenceItem` | `getCodedSequenceItemForBusinessNameUsedAsConceptName​(java.lang.String businessName, java.lang.String location)` |
    `CodedSequenceItem` | `getCodedSequenceItemForBusinessNameUsedAsUnits​(java.lang.String businessName, java.lang.String location)` |
    `CodedSequenceItem` | `getCodedSequenceItemForBusinessNameUsedAsValue​(java.lang.String businessName, java.lang.String location)` |
    `protected ContentItem` | `getContentItemAndChildrenFromJSONObjectValue​(java.lang.String businessName, CodedSequenceItem concept, java.lang.String valueType, java.lang.String relationshipType, javax.json.JsonValue contentItemValue, java.lang.String location)` |
    `protected javax.json.JsonObject` | `getContentItemAttributesObject​(javax.json.JsonArray contentItemAttributesAndChildrenArray)` |
    `javax.json.JsonArray` | `getDocument​(AttributeList list)` | Given a DICOM attribute list encoding a Structured Report, get a JSON document.
    `javax.json.JsonArray` | `getDocument​(StructuredReport sr)` | Given a DICOM Structured Report, get a JSON document of the content tree only.
    `javax.json.JsonArray` | `getDocument​(StructuredReport sr, AttributeList list)` | Given a DICOM Structured Report, get a JSON document of the content tree and the top level DICOM elements.
    `javax.json.JsonArray` | `getDocument​(java.io.File file)` | Given a DICOM object encoded as a list of attributes, get a JSON document.
    `javax.json.JsonArray` | `getDocument​(java.lang.String filename)` | Given a DICOM object encoded as a list of attributes, get a JSON document.
    `protected java.lang.String` | `getSingleStringValueOrNullFromJsonContentItemValue​(javax.json.JsonValue entry, java.lang.String valueType, CodedSequenceItem concept)` |
    `protected java.lang.String` | `getSingleStringValueOrNullFromJsonStringOrNumberContentItemValue​(javax.json.JsonValue entry, java.lang.String valueType, CodedSequenceItem concept)` |
    `protected java.lang.String` | `getStringFromSelectedContentItemValue​(javax.json.JsonArray contentItemValues, int which, java.lang.String what, java.lang.String valueType, CodedSequenceItem concept)` |
    `StructuredReport` | `getStructuredReport​(javax.json.JsonArray document)` | Given a DICOM SR object encoded as a JSON document convert it to a StructuredReport using the content tree and ignoring any header attributes.
    `StructuredReport` | `getStructuredReport​(javax.json.JsonObject topLevelObject)` | Given a DICOM SR object encoded in a JSON document convert it to a StructuredReport using the content tree and ignoring any header attributes.
    `protected boolean` | `haveChildrenForSingleStringOrCodeJsonContentItemValue​(javax.json.JsonValue contentItemValue, javax.json.JsonObject contentItemAttributesObject)` |
    `protected boolean` | `isCommonAnnotationAttribute​(java.lang.String attributeName)` |
    `void` | `loadBusinessNamesDocument​(java.io.File file)` | Load the business names encoded in a JSON document.
    `void` | `loadBusinessNamesDocument​(java.io.InputStream stream)` | Load the business names encoded in a JSON document.
    `void` | `loadBusinessNamesDocument​(java.lang.String name)` | Load the business names encoded in a JSON document.
    `void` | `loadBusinessNamesDocument​(javax.json.JsonArray document)` | Load the business names encoded in a JSON document.
    `static void` | `main​(java.lang.String[] arg)` | Read a DICOM dataset (that contains a structured report) and write a JSON representation of it to the standard output or specified path, or vice versa.
    `static java.lang.String` | `makeBusinessNameFromCodeMeaning​(CodedSequenceItem conceptName)` |
    `static java.lang.String` | `makeBusinessNameFromCodeMeaning​(java.lang.String codeMeaning, boolean upperCamelCase)` |
    `protected java.lang.String` | `selectFromAlternativeRelationshipTypesForBusinessName​(java.lang.String childLocation, java.lang.String childBusinessName, java.lang.String parentValueType, java.lang.String childValueType, java.util.Set<java.lang.String> childRelationshipTypes)` |
    `protected java.lang.String` | `selectFromAlternativeValueTypesForBusinessName​(java.lang.String childLocation, java.lang.String childBusinessName, java.lang.String parentValueType, java.util.Set<java.lang.String> childValueTypes, javax.json.JsonValue childObjectValue)` |
    `protected static java.lang.String` | `selectTheOtherOfTwoStringsInSet​(java.lang.String method, java.lang.String location, java.util.Set<java.lang.String> theSet, java.lang.String doNotWant)` |
    `protected void` | `walkTreeBuildingSimplifiedLabelsForReferencedContentItemIdentifiers​(ContentItem node, java.lang.String location)` | Walk the tree starting at the specified node.
    `static void` | `write​(java.io.File outputFile, javax.json.JsonArray document)` | Serialize a JSON document.
    `static void` | `write​(java.io.OutputStream out, javax.json.JsonArray document)` | Serialize a JSON document.
    `static void` | `write​(java.lang.String outputPath, javax.json.JsonArray document)` | Serialize a JSON document.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### elideSeparateContinuityOfContent

          protected static boolean elideSeparateContinuityOfContent

    - #### collapseAttributeValueArrays

          protected static boolean collapseAttributeValueArrays

    - #### collapseEmptyToNull

          protected static boolean collapseEmptyToNull

    - #### collapseContentTreeArrays

          protected static boolean collapseContentTreeArrays

    - #### substituteUIDKeywords

          protected static boolean substituteUIDKeywords

    - #### useNumberForNumericContentItemValue

          protected static boolean useNumberForNumericContentItemValue

    - #### symbolSignifyingReservedKeyword

          protected static java.lang.String symbolSignifyingReservedKeyword

    - #### businessNameToUseForAnonymousContentItems

          protected static java.lang.String businessNameToUseForAnonymousContentItems

    - #### reservedKeywordForCodeValueInBusinessNamesFile

          protected static java.lang.String reservedKeywordForCodeValueInBusinessNamesFile

    - #### reservedKeywordForCodingSchemeDesignatorInBusinessNamesFile

          protected static java.lang.String reservedKeywordForCodingSchemeDesignatorInBusinessNamesFile

    - #### reservedKeywordForCodeMeaningInBusinessNamesFile

          protected static java.lang.String reservedKeywordForCodeMeaningInBusinessNamesFile

    - #### reservedKeywordForValueTypeInBusinessNamesFile

          protected static java.lang.String reservedKeywordForValueTypeInBusinessNamesFile

    - #### reservedKeywordForRelationshipTypeInBusinessNamesFile

          protected static java.lang.String reservedKeywordForRelationshipTypeInBusinessNamesFile

    - #### reservedKeywordForCodingSchemeVersionInBusinessNamesFile

          protected static java.lang.String reservedKeywordForCodingSchemeVersionInBusinessNamesFile

    - #### reservedKeywordForLongCodeValueInBusinessNamesFile

          protected static java.lang.String reservedKeywordForLongCodeValueInBusinessNamesFile

    - #### reservedKeywordForURNCodeValueInBusinessNamesFile

          protected static java.lang.String reservedKeywordForURNCodeValueInBusinessNamesFile

    - #### reservedKeywordForContextIdentifierInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextIdentifierInBusinessNamesFile

    - #### reservedKeywordForContextUIDInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextUIDInBusinessNamesFile

    - #### reservedKeywordForMappingResourceInBusinessNamesFile

          protected static java.lang.String reservedKeywordForMappingResourceInBusinessNamesFile

    - #### reservedKeywordForMappingResourceUIDInBusinessNamesFile

          protected static java.lang.String reservedKeywordForMappingResourceUIDInBusinessNamesFile

    - #### reservedKeywordForMappingResourceNameInBusinessNamesFile

          protected static java.lang.String reservedKeywordForMappingResourceNameInBusinessNamesFile

    - #### reservedKeywordForContextGroupVersionInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextGroupVersionInBusinessNamesFile

    - #### reservedKeywordForContextGroupExtensionFlagInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextGroupExtensionFlagInBusinessNamesFile

    - #### reservedKeywordForContextGroupLocalVersionInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextGroupLocalVersionInBusinessNamesFile

    - #### reservedKeywordForContextGroupExtensionCreatorUIDInBusinessNamesFile

          protected static java.lang.String reservedKeywordForContextGroupExtensionCreatorUIDInBusinessNamesFile

    - #### reservedKeywordForObservationDateTimeAttributeInSRFile

          protected static java.lang.String reservedKeywordForObservationDateTimeAttributeInSRFile

    - #### reservedKeywordForObservationUIDAttributeInSRFile

          protected static java.lang.String reservedKeywordForObservationUIDAttributeInSRFile

    - #### reservedKeywordForContinuityOfContentAttributeInSRFile

          protected static java.lang.String reservedKeywordForContinuityOfContentAttributeInSRFile

    - #### reservedKeywordForTemplateMappingResourceAttributeInSRFile

          protected static java.lang.String reservedKeywordForTemplateMappingResourceAttributeInSRFile

    - #### reservedKeywordForTemplateIdentifierAttributeInSRFile

          protected static java.lang.String reservedKeywordForTemplateIdentifierAttributeInSRFile

    - #### reservedKeywordForSimplifiedLabelAttributeInSRFile

          protected static java.lang.String reservedKeywordForSimplifiedLabelAttributeInSRFile

    - #### reservedKeywordForSimplifiedReferenceToLabelAttributeInSRFile

          protected static java.lang.String reservedKeywordForSimplifiedReferenceToLabelAttributeInSRFile

    - #### reservedKeywordForReferencedSOPClassUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForReferencedSOPClassUIDAttributeInCompositeContentItem

    - #### reservedKeywordForReferencedSOPInstanceUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForReferencedSOPInstanceUIDAttributeInCompositeContentItem

    - #### reservedKeywordForReferencedFrameNumberAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForReferencedFrameNumberAttributeInCompositeContentItem

    - #### reservedKeywordForReferencedSegmentNumberAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForReferencedSegmentNumberAttributeInCompositeContentItem

    - #### reservedKeywordForPresentationStateSOPClassUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForPresentationStateSOPClassUIDAttributeInCompositeContentItem

    - #### reservedKeywordForPresentationStateSOPInstanceUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForPresentationStateSOPInstanceUIDAttributeInCompositeContentItem

    - #### reservedKeywordForRealWorldValueMappingSOPClassUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForRealWorldValueMappingSOPClassUIDAttributeInCompositeContentItem

    - #### reservedKeywordForRealWorldValueMappingSOPInstanceUIDAttributeInCompositeContentItem

          protected static java.lang.String reservedKeywordForRealWorldValueMappingSOPInstanceUIDAttributeInCompositeContentItem

    - #### reservedKeywordForGraphicTypeAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordForGraphicTypeAttributeInCoordinatesContentItem

    - #### reservedKeywordFor2DCoordinatesAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordFor2DCoordinatesAttributeInCoordinatesContentItem

    - #### reservedKeywordFor3DCoordinatesAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordFor3DCoordinatesAttributeInCoordinatesContentItem

    - #### reservedKeywordForPixelOriginInterpretationAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordForPixelOriginInterpretationAttributeInCoordinatesContentItem

    - #### reservedKeywordForFiducialUIDAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordForFiducialUIDAttributeInCoordinatesContentItem

    - #### reservedKeywordForReferencedFrameOfReferenceUIDAttributeInCoordinatesContentItem

          protected static java.lang.String reservedKeywordForReferencedFrameOfReferenceUIDAttributeInCoordinatesContentItem

    - #### reservedKeywordForMeasurementUnitsAttributeInNumericContentItem

          protected static java.lang.String reservedKeywordForMeasurementUnitsAttributeInNumericContentItem

    - #### reservedKeywordForFloatingPointValueAttributeInNumericContentItem

          protected static java.lang.String reservedKeywordForFloatingPointValueAttributeInNumericContentItem

    - #### reservedKeywordForRationalNumeratorAttributeInNumericContentItem

          protected static java.lang.String reservedKeywordForRationalNumeratorAttributeInNumericContentItem

    - #### reservedKeywordForRationalDenominatorAttributeInNumericContentItem

          protected static java.lang.String reservedKeywordForRationalDenominatorAttributeInNumericContentItem

    - #### reservedKeywordForNumericValueQualifierAttributeInNumericContentItem

          protected static java.lang.String reservedKeywordForNumericValueQualifierAttributeInNumericContentItem

    - #### reservedKeywordForAlphabeticPropertyInPersonNameContentItem

          protected static java.lang.String reservedKeywordForAlphabeticPropertyInPersonNameContentItem

    - #### reservedKeywordForIdeographicPropertyInPersonNameContentItem

          protected static java.lang.String reservedKeywordForIdeographicPropertyInPersonNameContentItem

    - #### reservedKeywordForPhoneticPropertyInPersonNameContentItem

          protected static java.lang.String reservedKeywordForPhoneticPropertyInPersonNameContentItem

    - #### simplifiedLabelPrefix

          protected static java.lang.String simplifiedLabelPrefix

    - #### businessNames

          protected java.util.Map<java.lang.String,​CodedSequenceItem> businessNames

    - #### valueTypesByBusinessName

          protected java.util.Map<java.lang.String,​java.util.SortedSet<java.lang.String>> valueTypesByBusinessName

    - #### relationshipTypesByBusinessName

          protected java.util.Map<java.lang.String,​java.util.SortedSet<java.lang.String>> relationshipTypesByBusinessName

    - #### contentItemIdentifiersByContentItem

          protected java.util.Map<ContentItem,​java.lang.String> contentItemIdentifiersByContentItem

    - #### simplifiedLabelByReferencedContentItemIdentifiers

          protected java.util.Map<java.lang.String,​java.lang.String> simplifiedLabelByReferencedContentItemIdentifiers

    - #### simplifiedLabelCounter

          protected int simplifiedLabelCounter

    - #### contentItemFactory

          protected ContentItemFactory contentItemFactory

    - #### referencedContentItemIdentifiersBySimplifiedLabel

          protected java.util.Map<java.lang.String,​java.lang.String> referencedContentItemIdentifiersBySimplifiedLabel

  - ### Constructor Detail

    - #### JSONRepresentationOfStructuredReportObjectFactory

          public JSONRepresentationOfStructuredReportObjectFactory()

      Construct a factory object, which can be used to get JSON documents from DICOM objects.

  - ### Method Detail

    - #### isCommonAnnotationAttribute

          protected boolean isCommonAnnotationAttribute​(java.lang.String attributeName)

    - #### makeBusinessNameFromCodeMeaning

          public static java.lang.String makeBusinessNameFromCodeMeaning​(java.lang.String codeMeaning,
                                                                         boolean upperCamelCase)

    - #### makeBusinessNameFromCodeMeaning

          public static java.lang.String makeBusinessNameFromCodeMeaning​(CodedSequenceItem conceptName)

    - #### getCodedSequenceItemForBusinessName

          public CodedSequenceItem getCodedSequenceItemForBusinessName​(java.lang.String businessName,
                                                                       java.lang.String location,
                                                                       boolean roleIsAsConceptName)

    - #### getCodedSequenceItemForBusinessNameUsedAsConceptName

          public CodedSequenceItem getCodedSequenceItemForBusinessNameUsedAsConceptName​(java.lang.String businessName,
                                                                                        java.lang.String location)

    - #### getCodedSequenceItemForBusinessNameUsedAsValue

          public CodedSequenceItem getCodedSequenceItemForBusinessNameUsedAsValue​(java.lang.String businessName,
                                                                                  java.lang.String location)

    - #### getCodedSequenceItemForBusinessNameUsedAsUnits

          public CodedSequenceItem getCodedSequenceItemForBusinessNameUsedAsUnits​(java.lang.String businessName,
                                                                                  java.lang.String location)

    - #### getBusinessNamesDocument

          public javax.json.JsonArray getBusinessNamesDocument()

    - #### addCodedSequenceItemPropertyFromBusinessName

          protected void addCodedSequenceItemPropertyFromBusinessName​(javax.json.JsonObject businessNamePayload,
                                                                      AttributeList csilist,
                                                                      AttributeTag tag,
                                                                      java.lang.String reservedKeywordInBusinessNamesFile)

    - #### loadBusinessNamesDocument

          public void loadBusinessNamesDocument​(javax.json.JsonArray document)
                                         throws DicomException

      Load the business names encoded in a JSON document.

      Parameters:
        `document` - the JSON document
      Throws:
        `DicomException`

    - #### loadBusinessNamesDocument

          public void loadBusinessNamesDocument​(java.io.InputStream stream)
                                         throws java.io.IOException,
                                                DicomException

      Load the business names encoded in a JSON document.

      Parameters:
        `stream` - the input stream containing the JSON document
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### loadBusinessNamesDocument

          public void loadBusinessNamesDocument​(java.io.File file)
                                         throws java.io.IOException,
                                                DicomException

      Load the business names encoded in a JSON document.

      Parameters:
        `file` - the input file containing the JSON document
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### loadBusinessNamesDocument

          public void loadBusinessNamesDocument​(java.lang.String name)
                                         throws java.io.IOException,
                                                DicomException

      Load the business names encoded in a JSON document.

      Parameters:
        `name` - the input file containing the JSON document
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### walkTreeBuildingSimplifiedLabelsForReferencedContentItemIdentifiers

          protected void walkTreeBuildingSimplifiedLabelsForReferencedContentItemIdentifiers​(ContentItem node,
                                                                                             java.lang.String location)

      Walk the tree starting at the specified node.

      Parameters:
        `node` -
        `location` - the dotted numeric string describing the location of the starting node

    - #### getDocument

          public javax.json.JsonArray getDocument​(AttributeList list)
                                           throws DicomException

      Given a DICOM attribute list encoding a Structured Report, get a JSON document.

      Parameters:
        `list` - the attribute list
      Returns:
        the JSON encoded DICOM SR document
      Throws:
        `DicomException`

    - #### getDocument

          public javax.json.JsonArray getDocument​(StructuredReport sr)
                                           throws DicomException

      Given a DICOM Structured Report, get a JSON document of the content tree only.

      Parameters:
        `sr` - the Structured Report
      Returns:
        the JSON encoded DICOM SR document
      Throws:
        `DicomException`

    - #### getDocument

          public javax.json.JsonArray getDocument​(StructuredReport sr,
                                                  AttributeList list)
                                           throws DicomException

      Given a DICOM Structured Report, get a JSON document of the content tree and the top level DICOM elements.

      Parameters:
        `sr` - the Structured Report may be null if list is not - will build an sr tree model
        `list` - the attribute list may be null if only the sr content tree is to be added
      Returns:
        the JSON encoded DICOM SR document
      Throws:
        `DicomException`

    - #### getDocument

          public javax.json.JsonArray getDocument​(java.io.File file)
                                           throws java.io.IOException,
                                                  DicomException

      Given a DICOM object encoded as a list of attributes, get a JSON document.

      Parameters:
        `file` - the DICOM file
      Returns:
        the JSON document
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### getDocument

          public javax.json.JsonArray getDocument​(java.lang.String filename)
                                           throws java.io.IOException,
                                                  DicomException

      Given a DICOM object encoded as a list of attributes, get a JSON document.

      Parameters:
        `filename` - the DICOM file name
      Returns:
        the JSON document
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### getStringFromSelectedContentItemValue

          protected java.lang.String getStringFromSelectedContentItemValue​(javax.json.JsonArray contentItemValues,
                                                                           int which,
                                                                           java.lang.String what,
                                                                           java.lang.String valueType,
                                                                           CodedSequenceItem concept)

    - #### getSingleStringValueOrNullFromJsonStringOrNumberContentItemValue

          protected java.lang.String getSingleStringValueOrNullFromJsonStringOrNumberContentItemValue​(javax.json.JsonValue entry,
                                                                                                      java.lang.String valueType,
                                                                                                      CodedSequenceItem concept)

    - #### getSingleStringValueOrNullFromJsonContentItemValue

          protected java.lang.String getSingleStringValueOrNullFromJsonContentItemValue​(javax.json.JsonValue entry,
                                                                                        java.lang.String valueType,
                                                                                        CodedSequenceItem concept)

    - #### haveChildrenForSingleStringOrCodeJsonContentItemValue

          protected boolean haveChildrenForSingleStringOrCodeJsonContentItemValue​(javax.json.JsonValue contentItemValue,
                                                                                  javax.json.JsonObject contentItemAttributesObject)

    - #### determineUnknownValueType

          protected java.lang.String determineUnknownValueType​(java.lang.String parentValueType,
                                                               javax.json.JsonValue childObjectValue)

    - #### selectTheOtherOfTwoStringsInSet

          protected static java.lang.String selectTheOtherOfTwoStringsInSet​(java.lang.String method,
                                                                            java.lang.String location,
                                                                            java.util.Set<java.lang.String> theSet,
                                                                            java.lang.String doNotWant)

    - #### selectFromAlternativeValueTypesForBusinessName

          protected java.lang.String selectFromAlternativeValueTypesForBusinessName​(java.lang.String childLocation,
                                                                                    java.lang.String childBusinessName,
                                                                                    java.lang.String parentValueType,
                                                                                    java.util.Set<java.lang.String> childValueTypes,
                                                                                    javax.json.JsonValue childObjectValue)

    - #### selectFromAlternativeRelationshipTypesForBusinessName

          protected java.lang.String selectFromAlternativeRelationshipTypesForBusinessName​(java.lang.String childLocation,
                                                                                           java.lang.String childBusinessName,
                                                                                           java.lang.String parentValueType,
                                                                                           java.lang.String childValueType,
                                                                                           java.util.Set<java.lang.String> childRelationshipTypes)

    - #### determineUnknownRelationshipType

          protected java.lang.String determineUnknownRelationshipType​(java.lang.String parentValueType,
                                                                      java.lang.String childValueType,
                                                                      javax.json.JsonValue childObjectValue)

    - #### getContentItemAttributesObject

          protected javax.json.JsonObject getContentItemAttributesObject​(javax.json.JsonArray contentItemAttributesAndChildrenArray)

    - #### getContentItemAndChildrenFromJSONObjectValue

          protected ContentItem getContentItemAndChildrenFromJSONObjectValue​(java.lang.String businessName,
                                                                             CodedSequenceItem concept,
                                                                             java.lang.String valueType,
                                                                             java.lang.String relationshipType,
                                                                             javax.json.JsonValue contentItemValue,
                                                                             java.lang.String location)
                                                                      throws DicomException

      Throws:
        `DicomException`

    - #### getStructuredReport

          public StructuredReport getStructuredReport​(javax.json.JsonObject topLevelObject)
                                               throws DicomException

      Given a DICOM SR object encoded in a JSON document convert it to a StructuredReport using the content tree and ignoring any header attributes.

      Parameters:
        `topLevelObject` - the first object of the array that is the JSON document
      Returns:
        the StructuredReport
      Throws:
        `DicomException`

    - #### getStructuredReport

          public StructuredReport getStructuredReport​(javax.json.JsonArray document)
                                               throws DicomException

      Given a DICOM SR object encoded as a JSON document convert it to a StructuredReport using the content tree and ignoring any header attributes.

      Parameters:
        `document` - the JSON document
      Returns:
        the StructuredReport
      Throws:
        `DicomException`

    - #### getAttributeList

          public AttributeList getAttributeList​(javax.json.JsonObject topLevelObject)
                                         throws DicomException

      Given a DICOM SR object encoded in a JSON document convert it to a list of attributes.

      Parameters:
        `topLevelObject` - the first object of the array that is the JSON document
      Returns:
        the list of DICOM attributes
      Throws:
        `DicomException`

    - #### getAttributeList

          public AttributeList getAttributeList​(javax.json.JsonArray document)
                                         throws DicomException

      Given a DICOM SR object encoded as a JSON document convert it to a list of attributes.

      Parameters:
        `document` - the JSON document
      Returns:
        the list of DICOM attributes
      Throws:
        `DicomException`

    - #### getAttributeList

          public AttributeList getAttributeList​(java.io.InputStream stream)
                                         throws java.io.IOException,
                                                DicomException

      Given a DICOM SR object encoded as a JSON document in a stream convert it to a list of attributes.

      Parameters:
        `stream` - the input stream containing the JSON document
      Returns:
        the list of DICOM attributes
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### getAttributeList

          public AttributeList getAttributeList​(java.io.File file)
                                         throws java.io.IOException,
                                                DicomException

      Given a DICOM SR object encoded as a JSON document in a file convert it to a list of attributes.

      Parameters:
        `file` - the input file containing the JSON document
      Returns:
        the list of DICOM attributes
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### getAttributeList

          public AttributeList getAttributeList​(java.lang.String name)
                                         throws java.io.IOException,
                                                DicomException

      Given a DICOM SR object encoded as a JSON document in a named file convert it to a list of attributes.

      Parameters:
        `name` - the input file containing the JSON document
      Returns:
        the list of DICOM attributes
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### write

          public static void write​(java.io.OutputStream out,
                                   javax.json.JsonArray document)
                            throws java.io.IOException

      Serialize a JSON document.

      Parameters:
        `out` - the output stream to write to
        `document` - the JSON document
      Throws:
        `java.io.IOException`

    - #### write

          public static void write​(java.io.File outputFile,
                                   javax.json.JsonArray document)
                            throws java.io.IOException

      Serialize a JSON document.

      Parameters:
        `outputFile` - the output file to write to
        `document` - the JSON document
      Throws:
        `java.io.IOException`

    - #### write

          public static void write​(java.lang.String outputPath,
                                   javax.json.JsonArray document)
                            throws java.io.IOException

      Serialize a JSON document.

      Parameters:
        `outputPath` - the output path to write to
        `document` - the JSON document
      Throws:
        `java.io.IOException`

    - #### createDocumentAndWriteIt

          public static void createDocumentAndWriteIt​(AttributeList list,
                                                      java.io.OutputStream out)
                                               throws java.io.IOException,
                                                      DicomException

      Serialize a JSON document created from a DICOM Structured Report.

      Parameters:
        `list` - the attribute list
        `out` - the output stream to write to
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### createDocumentAndWriteIt

          public static void createDocumentAndWriteIt​(StructuredReport sr,
                                                      java.io.OutputStream out)
                                               throws java.io.IOException,
                                                      DicomException

      Serialize a JSON document created from a DICOM Structured Report.

      Parameters:
        `sr` - the Structured Report
        `out` - the output stream to write to
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### createDocumentAndWriteIt

          public static void createDocumentAndWriteIt​(StructuredReport sr,
                                                      AttributeList list,
                                                      java.io.OutputStream out)
                                               throws DicomException

      Serialize a JSON document created from a DICOM attribute list.

      Parameters:
        `sr` - the Structured Report - may be null if list is not - will build an sr tree model
        `list` - the list of DICOM attributes
        `out` - the output stream to write to
      Throws:
        `DicomException`

    - #### createDocumentAndWriteIt

          public static void createDocumentAndWriteIt​(StructuredReport sr,
                                                      AttributeList list,
                                                      java.io.File outputFile)
                                               throws java.io.IOException,
                                                      DicomException

      Serialize a JSON document created from a DICOM attribute list.

      Parameters:
        `sr` - the Structured Report - may be null if list is not - will build an sr tree model
        `list` - the list of DICOM attributes
        `outputFile` - the output file to write to
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### createDocumentAndWriteIt

          public static void createDocumentAndWriteIt​(StructuredReport sr,
                                                      AttributeList list,
                                                      java.lang.String outputPath)
                                               throws java.io.IOException,
                                                      DicomException

      Serialize a JSON document created from a DICOM attribute list.

      Parameters:
        `sr` - the Structured Report - may be null if list is not - will build an sr tree model
        `list` - the list of DICOM attributes
        `outputPath` - the output path to write to
      Throws:
        `java.io.IOException`
        `DicomException`

    - #### main

          public static void main​(java.lang.String[] arg)

      Read a DICOM dataset (that contains a structured report) and write a JSON representation of it to the standard output or specified path, or vice versa.

      Parameters:
        `arg` - either one input path of the file containing the DICOM/JSON dataset and a business name file path to read or write, or a direction argument (toDICOM or toJSON, case insensitive) and an input path and an input or output business name path, and optionally an output path