Skip to content

Commit

Permalink
examples added and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
meyertst-aws committed Aug 22, 2024
1 parent 13084d2 commit ae6c1a1
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 14 deletions.
36 changes: 35 additions & 1 deletion awscli/examples/medical-imaging/copy-image-set.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ The following ``copy-image-set`` code example makes a duplicate copy of an image




Output::

{
Expand All @@ -65,4 +64,39 @@ Output::
"datastoreId": "12345678901234567890123456789012"
}

**Example 3: To copy a subset of instances from a source image set to a destination image set.**

The following ``copy-image-set code`` example copies one DICOM instance from the source image set to the destination image set.
The force parameter is provided to override inconsistencies in the Patient, Study, and Series level attributes. ::

aws medical-imaging copy-image-set \
--datastore-id 12345678901234567890123456789012 \
--source-image-set-id ea92b0d8838c72a3f25d00d13616f87e \
--copy-image-set-information '{"sourceImageSet": {"latestVersionId": "1","DICOMCopies": {"copiableAttributes": "{\"SchemaVersion\":\"1.1\",\"Study\":{\"Series\":{\"1.3.6.1.4.1.5962.99.1.3673257865.2104868982.1369432891697.3666.0\":{\"Instances\":{\"1.3.6.1.4.1.5962.99.1.3673257865.2104868982.1369432891697.3669.0\":{}}}}}}"}},"destinationImageSet": {"imageSetId": "b9eb50d8ee682eb9fcf4acbf92f62bb7","latestVersionId": "1"}}' \
--force



Output::

{
"destinationImageSetProperties": {
"latestVersionId": "2",
"imageSetWorkflowStatus": "COPYING",
"updatedAt": 1680042505.135,
"imageSetId": "b9eb50d8ee682eb9fcf4acbf92f62bb7",
"imageSetState": "LOCKED",
"createdAt": 1680042357.432
},
"sourceImageSetProperties": {
"latestVersionId": "1",
"imageSetWorkflowStatus": "COPYING_WITH_READ_ONLY_ACCESS",
"updatedAt": 1680042505.135,
"imageSetId": "ea92b0d8838c72a3f25d00d13616f87e",
"imageSetState": "LOCKED",
"createdAt": 1680027126.436
},
"datastoreId": "12345678901234567890123456789012"
}

For more information, see `Copying an image set <https://docs.aws.amazon.com/healthimaging/latest/devguide/copy-image-set.html>`__ in the *AWS HealthImaging Developer Guide*.
151 changes: 138 additions & 13 deletions awscli/examples/medical-imaging/update-image-set-metadata.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
**To insert or update an attribute in image set metadata**
**Example 1: To insert or update an attribute in image set metadata**

The following ``update-image-set-metadata`` code example inserts or updates an attribute in image set metadata. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id ea92b0d8838c72a3f25d00d13616f87e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"updatableAttributes": "eyJTY2hlbWFWZXJzaW9uIjoxLjEsIlBhdGllbnQiOnsiRElDT00iOnsiUGF0aWVudE5hbWUiOiJNWF5NWCJ9fX0="
"updatableAttributes": "{\"SchemaVersion\":1.1,\"Patient\":{\"DICOM\":{\"PatientName\":\"MX^MX\"}}}"
}
}

Note: ``updatableAttributes`` is a Base64 encoded JSON string. Here is the unencoded JSON string.

{"SchemaVersion":1.1,"Patient":{"DICOM":{"PatientName":"MX^MX"}}}

Output::

Expand All @@ -32,27 +31,25 @@ Output::
"datastoreId": "12345678901234567890123456789012"
}

**To remove an attribute from image set metadata**
**Example 2: To remove an attribute from image set metadata**

The following ``update-image-set-metadata`` code example removes an attribute from image set metadata. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id ea92b0d8838c72a3f25d00d13616f87e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"removableAttributes": "e1NjaGVtYVZlcnNpb246MS4xLFN0dWR5OntESUNPTTp7U3R1ZHlEZXNjcmlwdGlvbjpDSEVTVH19fQo="
"removableAttributes": "{\"SchemaVersion\":1.1,\"Study\":{\"DICOM\":{\"StudyDescription\":\"CHEST\"}}}"
}
}

Note: ``removableAttributes`` is a Base64 encoded JSON string. Here is the unencoded JSON string. The key and value must match the attribute to be removed.

{"SchemaVersion":1.1,"Study":{"DICOM":{"StudyDescription":"CHEST"}}}

Output::

Expand All @@ -66,27 +63,26 @@ Output::
"datastoreId": "12345678901234567890123456789012"
}

**To remove an instance from image set metadata**
**Example 3: To remove an instance from image set metadata**

The following ``update-image-set-metadata`` code example removes an instance from image set metadata. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id ea92b0d8838c72a3f25d00d13616f87e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"removableAttributes": "eezEuMS4xLjEuMS4xLjEyMzQ1LjEyMzQ1Njc4OTAxMi4xMjMuMTIzNDU2Nzg5MDEyMzQuMTp7SW5zdGFuY2VzOnsxLjEuMS4xLjEuMS4xMjM0NS4xMjM0NTY3ODkwMTIuMTIzLjEyMzQ1Njc4OTAxMjM0LjE6e319fX19fQo="
"removableAttributes": "{\"SchemaVersion\": 1.1,\"Study\": {\"Series\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {\"Instances\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {}}}}}}"
}
}

Note: ``removableAttributes`` is a Base64 encoded JSON string. Here is the unencoded JSON string.

{"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1":{"Instances":{"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1":{}}}}}}

Output::

Expand All @@ -100,4 +96,133 @@ Output::
"datastoreId": "12345678901234567890123456789012"
}


**Example 4: To revert an image set to a previous version**

CopyImageSet and UpdateImageSetMetadata actions create new versions of image sets. The following example shows how to revert an image set to a prior version. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id 53d5fdb05ca4d46ac7ca64b06545c66e \
--latest-version-id 3 \
--cli-binary-format raw-in-base64-out \
--update-image-set-metadata-updates '{"revertToVersionId": "1"}'


Output::

{
"datastoreId": "12345678901234567890123456789012",
"imageSetId": "53d5fdb05ca4d46ac7ca64b06545c66e",
"latestVersionId": "4",
"imageSetState": "LOCKED",
"imageSetWorkflowStatus": "UPDATING",
"createdAt": 1680027126.436,
"updatedAt": 1680042257.908
}

**Example 5: To add a private DICOM data element to an instance**

The DICOM standard permits private data elements for communication of information that cannot be contained in standard data elements. You can create, update, and delete private data elements with the
UpdateImageSetMetadata action. The following example shows how to add a private element to a specified instance within an image set. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id 53d5fdb05ca4d46ac7ca64b06545c66e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--force \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"updatableAttributes": "{\"SchemaVersion\": 1.1,\"Study\": {\"Series\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {\"Instances\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {\"DICOM\": {\"001910F9\": \"97\"},\"DICOMVRs\": {\"001910F9\": \"DS\"}}}}}}}"
}
}



Output::

{
"latestVersionId": "2",
"imageSetWorkflowStatus": "UPDATING",
"updatedAt": 1680042257.908,
"imageSetId": "53d5fdb05ca4d46ac7ca64b06545c66e",
"imageSetState": "LOCKED",
"createdAt": 1680027126.436,
"datastoreId": "12345678901234567890123456789012"
}

**Example 6: To update a private DICOM data element to an instance**

The following example shows how to update the value of a private data element belonging to an instance within an image set. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id 53d5fdb05ca4d46ac7ca64b06545c66e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--force \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"updatableAttributes": "{\"SchemaVersion\": 1.1,\"Study\": {\"Series\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {\"Instances\": {\"1.1.1.1.1.1.12345.123456789012.123.12345678901234.1\": {\"DICOM\": {\"00091001\": \"GE_GENESIS_DD\"}}}}}}}"
}
}



Output::

{
"latestVersionId": "2",
"imageSetWorkflowStatus": "UPDATING",
"updatedAt": 1680042257.908,
"imageSetId": "53d5fdb05ca4d46ac7ca64b06545c66e",
"imageSetState": "LOCKED",
"createdAt": 1680027126.436,
"datastoreId": "12345678901234567890123456789012"
}

**Example 7: To update a SOPInstanceUID with the force parameter**

The following example shows how to update a SOPInstanceUID, using the force parameter to override the DICOM metadata constraints. ::

aws medical-imaging update-image-set-metadata \
--datastore-id 12345678901234567890123456789012 \
--image-set-id 53d5fdb05ca4d46ac7ca64b06545c66e \
--latest-version-id 1 \
--cli-binary-format raw-in-base64-out \
--force \
--update-image-set-metadata-updates file://metadata-updates.json

Contents of ``metadata-updates.json`` ::

{
"DICOMUpdates": {
"updatableAttributes": "{\"SchemaVersion\":1.1,\"Study\":{\"Series\":{\"1.3.6.1.4.1.5962.99.1.3633258862.2104868982.1369432891697.3656.0\":{\"Instances\":{\"1.3.6.1.4.1.5962.99.1.3633258862.2104868982.1369432891697.3659.0\":{\"DICOM\":{\"SOPInstanceUID\":\"1.3.6.1.4.1.5962.99.1.3633258862.2104868982.1369432891697.3659.9\"}}}}}}}"
}
}



Output::

{
"latestVersionId": "2",
"imageSetWorkflowStatus": "UPDATING",
"updatedAt": 1680042257.908,
"imageSetId": "53d5fdb05ca4d46ac7ca64b06545c66e",
"imageSetState": "LOCKED",
"createdAt": 1680027126.436,
"datastoreId": "12345678901234567890123456789012"
}


For more information, see `Updating image set metadata <https://docs.aws.amazon.com/healthimaging/latest/devguide/update-image-set-metadata.html>`__ in the *AWS HealthImaging Developer Guide*.

0 comments on commit ae6c1a1

Please sign in to comment.