UpdateImageSetMetadata で を使用する AWS SDK または CLI - AWS HealthImaging

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

UpdateImageSetMetadata で を使用する AWS SDK または CLI

以下のコード例は、UpdateImageSetMetadata の使用方法を示しています。

CLI
AWS CLI

例 1: 画像セットメタデータに属性を挿入または更新するには

次のupdate-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

metadata-updates.json の内容

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

出力:

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

例 2: 画像セットメタデータから属性を削除するには

次のupdate-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

metadata-updates.json の内容

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

出力:

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

例 3: イメージセットメタデータからインスタンスを削除するには

次のupdate-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

metadata-updates.json の内容

{ "DICOMUpdates": { "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\": {}}}}}}" } }

出力:

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

例 4: 画像セットを以前のバージョンに戻すには

次のupdate-image-set-metadata例は、画像セットを以前のバージョンに戻す方法を示しています。 CopyImageSet UpdateImageSetMetadata アクションは、画像セットの新しいバージョンを作成します。

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"}'

出力:

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

例 5: インスタンスにプライベートDICOMデータ要素を追加するには

次のupdate-image-set-metadata例は、イメージセット内の指定されたインスタンスにプライベート要素を追加する方法を示しています。このDICOM標準では、標準データ要素に含めることができない情報を通信するためのプライベートデータ要素が許可されています。UpdateImageSetMetadata アクションを使用して、プライベートデータ要素を作成、更新、削除できます。

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

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\"}}}}}}}" } }

出力:

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

例 6: プライベートDICOMデータ要素をインスタンスに更新するには

次のupdate-image-set-metadata例は、イメージセット内のインスタンスに属するプライベートデータ要素の値を更新する方法を示しています。

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

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\"}}}}}}}" } }

出力:

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

例 7: force パラメータSOPInstanceUIDを使用して を更新するには

次のupdate-image-set-metadata例は、force パラメータを使用してDICOMメタデータの制約を上書きしSOPInstanceUID、 を更新する方法を示しています。

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

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\"}}}}}}}" } }

出力:

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

詳細については、「」の「画像セットメタデータの更新」を参照してください。 AWS HealthImaging デベロッパーガイド

  • API 詳細については、UpdateImageSetMetadata「」の「」を参照してください 。AWS CLI コマンドリファレンス

Java
SDK for Java 2.x
/** * Update the metadata of an AWS HealthImaging image set. * * @param medicalImagingClient - The AWS HealthImaging client object. * @param datastoreId - The datastore ID. * @param imageSetId - The image set ID. * @param versionId - The version ID. * @param metadataUpdates - A MetadataUpdates object containing the updates. * @param force - The force flag. * @throws MedicalImagingException - Base exception for all service exceptions thrown by AWS HealthImaging. */ public static void updateMedicalImageSetMetadata(MedicalImagingClient medicalImagingClient, String datastoreId, String imageSetId, String versionId, MetadataUpdates metadataUpdates, boolean force) { try { UpdateImageSetMetadataRequest updateImageSetMetadataRequest = UpdateImageSetMetadataRequest .builder() .datastoreId(datastoreId) .imageSetId(imageSetId) .latestVersionId(versionId) .updateImageSetMetadataUpdates(metadataUpdates) .force(force) .build(); UpdateImageSetMetadataResponse response = medicalImagingClient.updateImageSetMetadata(updateImageSetMetadataRequest); System.out.println("The image set metadata was updated" + response); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); throw e; } }

ユースケース #1: 属性を挿入または更新します。

final String insertAttributes = """ { "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } } """; MetadataUpdates metadataInsertUpdates = MetadataUpdates.builder() .dicomUpdates(DICOMUpdates.builder() .updatableAttributes(SdkBytes.fromByteBuffer( ByteBuffer.wrap(insertAttributes .getBytes(StandardCharsets.UTF_8)))) .build()) .build(); updateMedicalImageSetMetadata(medicalImagingClient, datastoreId, imagesetId, versionid, metadataInsertUpdates, force);

ユースケース #2: 属性を削除します。

final String removeAttributes = """ { "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } } """; MetadataUpdates metadataRemoveUpdates = MetadataUpdates.builder() .dicomUpdates(DICOMUpdates.builder() .removableAttributes(SdkBytes.fromByteBuffer( ByteBuffer.wrap(removeAttributes .getBytes(StandardCharsets.UTF_8)))) .build()) .build(); updateMedicalImageSetMetadata(medicalImagingClient, datastoreId, imagesetId, versionid, metadataRemoveUpdates, force);

ユースケース #3: インスタンスを削除します。

final String removeInstance = """ { "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": {} } } } } } """; MetadataUpdates metadataRemoveUpdates = MetadataUpdates.builder() .dicomUpdates(DICOMUpdates.builder() .removableAttributes(SdkBytes.fromByteBuffer( ByteBuffer.wrap(removeInstance .getBytes(StandardCharsets.UTF_8)))) .build()) .build(); updateMedicalImageSetMetadata(medicalImagingClient, datastoreId, imagesetId, versionid, metadataRemoveUpdates, force);

ユースケース #4: 以前のバージョンに戻します。

// In this case, revert to previous version. String revertVersionId = Integer.toString(Integer.parseInt(versionid) - 1); MetadataUpdates metadataRemoveUpdates = MetadataUpdates.builder() .revertToVersionId(revertVersionId) .build(); updateMedicalImageSetMetadata(medicalImagingClient, datastoreId, imagesetId, versionid, metadataRemoveUpdates, force);
  • API 詳細については、UpdateImageSetMetadata「」の「」を参照してください 。AWS SDK for Java 2.x API リファレンス

注記

については、「」を参照してください GitHub。完全な例を検索し、 でセットアップして実行する方法について説明します。 AWS コード例リポジトリ

JavaScript
SDK の JavaScript (v3)
import {UpdateImageSetMetadataCommand} from "@aws-sdk/client-medical-imaging"; import {medicalImagingClient} from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The ID of the HealthImaging data store. * @param {string} imageSetId - The ID of the HealthImaging image set. * @param {string} latestVersionId - The ID of the HealthImaging image set version. * @param {{}} updateMetadata - The metadata to update. * @param {boolean} force - Force the update. */ export const updateImageSetMetadata = async (datastoreId = "xxxxxxxxxx", imageSetId = "xxxxxxxxxx", latestVersionId = "1", updateMetadata = '{}', force = false) => { try { const response = await medicalImagingClient.send( new UpdateImageSetMetadataCommand({ datastoreId: datastoreId, imageSetId: imageSetId, latestVersionId: latestVersionId, updateImageSetMetadataUpdates: updateMetadata, force: force, }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '7966e869-e311-4bff-92ec-56a61d3003ea', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // createdAt: 2023-09-22T14:49:26.427Z, // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // imageSetState: 'LOCKED', // imageSetWorkflowStatus: 'UPDATING', // latestVersionId: '4', // updatedAt: 2023-09-27T19:41:43.494Z // } return response; } catch (err) { console.error(err); } };

ユースケース #1: 属性を挿入または更新し、強制的に更新します。

const insertAttributes = JSON.stringify({ "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } }); const updateMetadata = { "DICOMUpdates": { "updatableAttributes": new TextEncoder().encode(insertAttributes) } }; await updateImageSetMetadata(datastoreID, imageSetID, versionID, updateMetadata, true);

ユースケース #2: 属性を削除します。

// Attribute key and value must match the existing attribute. const remove_attribute = JSON.stringify({ "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } }); const updateMetadata = { "DICOMUpdates": { "removableAttributes": new TextEncoder().encode(remove_attribute) } }; await updateImageSetMetadata(datastoreID, imageSetID, versionID, updateMetadata);

ユースケース #3: インスタンスを削除します。

const remove_instance = JSON.stringify({ "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": {} } } } } }); const updateMetadata = { "DICOMUpdates": { "removableAttributes": new TextEncoder().encode(remove_instance) } }; await updateImageSetMetadata(datastoreID, imageSetID, versionID, updateMetadata);

ユースケース #4: 以前のバージョンに戻します。

const updateMetadata = { "revertToVersionId": "1" }; await updateImageSetMetadata(datastoreID, imageSetID, versionID, updateMetadata);
  • API 詳細については、UpdateImageSetMetadata「」の「」を参照してください 。AWS SDK for JavaScript API リファレンス

注記

については、「」を参照してください GitHub。完全な例を検索し、 でセットアップして実行する方法について説明します。 AWS コード例リポジトリ

Python
SDK for Python (Boto3)
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def update_image_set_metadata( self, datastore_id, image_set_id, version_id, metadata, force=False ): """ Update the metadata of an image set. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :param version_id: The ID of the image set version. :param metadata: The image set metadata as a dictionary. For example {"DICOMUpdates": {"updatableAttributes": "{\"SchemaVersion\":1.1,\"Patient\":{\"DICOM\":{\"PatientName\":\"Garcia^Gloria\"}}}"}} :param: force: Force the update. :return: The updated image set metadata. """ try: updated_metadata = self.health_imaging_client.update_image_set_metadata( imageSetId=image_set_id, datastoreId=datastore_id, latestVersionId=version_id, updateImageSetMetadataUpdates=metadata, force=force, ) except ClientError as err: logger.error( "Couldn't update image set metadata. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return updated_metadata

次のコードは MedicalImagingWrapper オブジェクトをインスタンス化します。

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)

ユースケース #1: 属性を挿入または更新します。

attributes = """{ "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } }""" metadata = {"DICOMUpdates": {"updatableAttributes": attributes}} self.update_image_set_metadata( data_store_id, image_set_id, version_id, metadata, force )

ユースケース #2: 属性を削除します。

# Attribute key and value must match the existing attribute. attributes = """{ "SchemaVersion": 1.1, "Study": { "DICOM": { "StudyDescription": "CT CHEST" } } }""" metadata = {"DICOMUpdates": {"removableAttributes": attributes}} self.update_image_set_metadata( data_store_id, image_set_id, version_id, metadata, force )

ユースケース #3: インスタンスを削除します。

attributes = """{ "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": {} } } } } }""" metadata = {"DICOMUpdates": {"removableAttributes": attributes}} self.update_image_set_metadata( data_store_id, image_set_id, version_id, metadata, force )

ユースケース #4: 以前のバージョンに戻します。

metadata = {"revertToVersionId": "1"} self.update_image_set_metadata( data_store_id, image_set_id, version_id, metadata, force )
  • API 詳細については、UpdateImageSetMetadata「」の「」を参照してください 。AWS SDK for Python (Boto3) APIリファレンス

注記

については、「」を参照してください GitHub。完全な例を検索し、 でセットアップして実行する方法について説明します。 AWS コード例リポジトリ

の完全なリストについては、 AWS SDK デベロッパーガイドとコード例については、「」を参照してくださいAWS SDK HealthImaging での の使用。このトピックには、開始方法に関する情報と以前のSDKバージョンの詳細も含まれています。