画像セットのコピー - AWS HealthImaging

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

画像セットのコピー

CopyImageSet アクションを使用して、 で画像セットをコピーします HealthImaging。この非同期プロセスを使用して、画像セットの内容を新規または既存の画像セットにコピーします。新しい画像セットにコピーして画像セットを分割したり、別のコピーを作成したりできます。既存の画像セットにコピーして 2 つの画像セットを結合することもできます。詳細については、「 AWS HealthImaging APIリファレンスCopyImageSet」の「」を参照してください。

注記

CopyImageSet アクションを使用するときは、次の点に注意してください。

  • CopyImageSet アクションは、新しいイメージセット、または の新しいバージョンを作成しますdestinationImageSet。詳細については、「画像セットのバージョンを一覧表示する」を参照してください。

  • コピーは非同期プロセスです。したがって、状態 (imageSetState) とステータス (imageSetWorkflowStatus) のレスポンス要素は、ロックされた画像セットでどのようなオペレーションが実行されているかを知らせるために使用できます。ロックされた画像セットでは、他の書き込みオペレーションを実行できません。

  • CopyImageSet ではUIDs、SOPイメージセット内でインスタンスが一意である必要があります。

  • インスタンスのサブセットはSOP、 を使用してコピーできますcopiableAttributes。これにより、 から 1 SOP つ以上のインスタンスを選択してsourceImageSet、 にコピーできますdestinationImageSet

  • CopyImageSet アクションが成功しない場合は、 を呼び出しGetImageSetmessageプロパティを確認します。詳細については、「画像セットのプロパティの取得」を参照してください。

  • 実際のDICOMインポートでは、DICOMシリーズごとに複数の画像セットが発生する可能性があります。CopyImageSet アクションではdestinationImageSet、オプションの forceパラメータが指定されていない限り、 sourceImageSetと に一貫したメタデータが必要です。

  • force パラメータを設定して、 sourceImageSetと の間に矛盾するメタデータ要素がある場合でも、 オペレーションを強制しますdestinationImageSet。このような場合、患者、治験、シリーズメタデータは で変更されませんdestinationImageSet

画像セットをコピーするには

へのアクセス設定に基づいてタブを選択しますAWS HealthImaging。

CLI
AWS CLI

例 1:コピー先を指定せずに画像セットをコピーするには。

次のcopy-image-set例では、送信先を指定せずに画像セットの複製コピーを作成します。

aws medical-imaging copy-image-set \ --datastore-id 12345678901234567890123456789012 \ --source-image-set-id ea92b0d8838c72a3f25d00d13616f87e \ --copy-image-set-information '{"sourceImageSet": {"latestVersionId": "1" } }'

出力:

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

例 2:コピー先を指定して画像セットをコピーするには。

次のcopy-image-set例では、コピー先を指定して画像セットの複製コピーを作成します。

aws medical-imaging copy-image-set \ --datastore-id 12345678901234567890123456789012 \ --source-image-set-id ea92b0d8838c72a3f25d00d13616f87e \ --copy-image-set-information '{"sourceImageSet": {"latestVersionId": "1" }, "destinationImageSet": { "imageSetId": "b9a06fef182a5f992842f77f8e0868e5", "latestVersionId": "1"} }'

出力:

{ "destinationImageSetProperties": { "latestVersionId": "2", "imageSetWorkflowStatus": "COPYING", "updatedAt": 1680042505.135, "imageSetId": "b9a06fef182a5f992842f77f8e0868e5", "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" }

例 3: ソースイメージセットからターゲットイメージセットにインスタンスのサブセットをコピーするには。

次のcopy-image-set例では、ソースイメージセットから宛先イメージセットに 1 つのDICOMインスタンスをコピーします。force パラメータは、患者、治験、シリーズレベルの属性の不整合を上書きするために提供されます。

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

出力:

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

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

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

Java
SDK for Java 2.x
/** * Copy an AWS HealthImaging image set. * * @param medicalImagingClient - The AWS HealthImaging client object. * @param datastoreId - The datastore ID. * @param imageSetId - The image set ID. * @param latestVersionId - The version ID. * @param destinationImageSetId - The optional destination image set ID, ignored if null. * @param destinationVersionId - The optional destination version ID, ignored if null. * @param force - The force flag. * @param subsets - The optional subsets to copy, ignored if null. * @return - The image set ID of the copy. * @throws MedicalImagingException - Base exception for all service exceptions thrown by AWS HealthImaging. */ public static String copyMedicalImageSet(MedicalImagingClient medicalImagingClient, String datastoreId, String imageSetId, String latestVersionId, String destinationImageSetId, String destinationVersionId, boolean force, Vector<String> subsets) { try { CopySourceImageSetInformation.Builder copySourceImageSetInformation = CopySourceImageSetInformation.builder() .latestVersionId(latestVersionId); // Optionally copy a subset of image instances. if (subsets != null) { String subsetInstanceToCopy = getCopiableAttributesJSON(imageSetId, subsets); copySourceImageSetInformation.dicomCopies(MetadataCopies.builder() .copiableAttributes(subsetInstanceToCopy) .build()); } CopyImageSetInformation.Builder copyImageSetBuilder = CopyImageSetInformation.builder() .sourceImageSet(copySourceImageSetInformation.build()); // Optionally designate a destination image set. if (destinationImageSetId != null) { copyImageSetBuilder = copyImageSetBuilder.destinationImageSet(CopyDestinationImageSet.builder() .imageSetId(destinationImageSetId) .latestVersionId(destinationVersionId) .build()); } CopyImageSetRequest copyImageSetRequest = CopyImageSetRequest.builder() .datastoreId(datastoreId) .sourceImageSetId(imageSetId) .copyImageSetInformation(copyImageSetBuilder.build()) .force(force) .build(); CopyImageSetResponse response = medicalImagingClient.copyImageSet(copyImageSetRequest); return response.destinationImageSetProperties().imageSetId(); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); throw e; } }

コピー可能な属性を作成するユーティリティ関数。

/** * Create a JSON string of copiable image instances. * * @param imageSetId - The image set ID. * @param subsets - The subsets to copy. * @return A JSON string of copiable image instances. */ private static String getCopiableAttributesJSON(String imageSetId, Vector<String> subsets) { StringBuilder subsetInstanceToCopy = new StringBuilder( """ { "SchemaVersion": 1.1, "Study": { "Series": { " """ ); subsetInstanceToCopy.append(imageSetId); subsetInstanceToCopy.append( """ ": { "Instances": { """ ); for (String subset : subsets) { subsetInstanceToCopy.append('"' + subset + "\": {},"); } subsetInstanceToCopy.deleteCharAt(subsetInstanceToCopy.length() - 1); subsetInstanceToCopy.append(""" } } } } } """); return subsetInstanceToCopy.toString(); }
  • API 詳細については、CopyImageSet「」の「」を参照してください 。AWS SDK for Java 2.x API リファレンス

注記

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

JavaScript
SDK の JavaScript (v3)

イメージセットをコピーするためのユーティリティ関数。

import {CopyImageSetCommand} from "@aws-sdk/client-medical-imaging"; import {medicalImagingClient} from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The ID of the data store. * @param {string} imageSetId - The source image set ID. * @param {string} sourceVersionId - The source version ID. * @param {string} destinationImageSetId - The optional ID of the destination image set. * @param {string} destinationVersionId - The optional version ID of the destination image set. * @param {boolean} force - Force the copy action. * @param {[string]} copySubsets - A subset of instance IDs to copy. */ export const copyImageSet = async ( datastoreId = "xxxxxxxxxxx", imageSetId = "xxxxxxxxxxxx", sourceVersionId = "1", destinationImageSetId = "", destinationVersionId = "", force = false, copySubsets = [] ) => { try { const params = { datastoreId: datastoreId, sourceImageSetId: imageSetId, copyImageSetInformation: { sourceImageSet: {latestVersionId: sourceVersionId}, }, force: force }; if (destinationImageSetId !== "" && destinationVersionId !== "") { params.copyImageSetInformation.destinationImageSet = { imageSetId: destinationImageSetId, latestVersionId: destinationVersionId, }; } if (copySubsets.length > 0) { let copySubsetsJson; copySubsetsJson = { SchemaVersion: 1.1, Study: { Series: { imageSetId: { Instances: {} } } } }; for (let i = 0; i < copySubsets.length; i++) { copySubsetsJson.Study.Series.imageSetId.Instances[ copySubsets[i] ] = {}; } params.copyImageSetInformation.dicomCopies = copySubsetsJson; } const response = await medicalImagingClient.send( new CopyImageSetCommand(params) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'd9b219ce-cc48-4a44-a5b2-c5c3068f1ee8', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxx', // destinationImageSetProperties: { // createdAt: 2023-09-27T19:46:21.824Z, // imageSetArn: 'arn:aws:medical-imaging:us-east-1:xxxxxxxxxxx:datastore/xxxxxxxxxxxxx/imageset/xxxxxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxx', // imageSetState: 'LOCKED', // imageSetWorkflowStatus: 'COPYING', // latestVersionId: '1', // updatedAt: 2023-09-27T19:46:21.824Z // }, // sourceImageSetProperties: { // createdAt: 2023-09-22T14:49:26.427Z, // imageSetArn: 'arn:aws:medical-imaging:us-east-1:xxxxxxxxxxx:datastore/xxxxxxxxxxxxx/imageset/xxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxxx', // imageSetState: 'LOCKED', // imageSetWorkflowStatus: 'COPYING_WITH_READ_ONLY_ACCESS', // latestVersionId: '4', // updatedAt: 2023-09-27T19:46:21.824Z // } // } return response; } catch (err) { console.error(err); } };

コピー先を指定せずにイメージセットをコピーします。

await copyImageSet( "12345678901234567890123456789012", "12345678901234567890123456789012", "1" );

コピー先を指定してイメージセットをコピーします。

await copyImageSet( "12345678901234567890123456789012", "12345678901234567890123456789012", "1", "12345678901234567890123456789012", "1", false, );

イメージセットのサブセットを送信先にコピーし、強制的にコピーします。

await copyImageSet( "12345678901234567890123456789012", "12345678901234567890123456789012", "1", "12345678901234567890123456789012", "1", true, ["12345678901234567890123456789012", "11223344556677889900112233445566"] );
  • API 詳細については、CopyImageSet「」の「」を参照してください 。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 copy_image_set( self, datastore_id, image_set_id, version_id, destination_image_set_id=None, destination_version_id=None, force=False, subsets=[], ): """ Copy 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 destination_image_set_id: The ID of the optional destination image set. :param destination_version_id: The ID of the optional destination image set version. :param force: Force the copy. :param subsets: The optional subsets to copy. For example: ["12345678901234567890123456789012"]. :return: The copied image set ID. """ try: copy_image_set_information = { "sourceImageSet": {"latestVersionId": version_id} } if destination_image_set_id and destination_version_id: copy_image_set_information["destinationImageSet"] = { "imageSetId": destination_image_set_id, "latestVersionId": destination_version_id, } if len(subsets) > 0: copySubsetsJson = { "SchemaVersion": "1.1", "Study": {"Series": {"imageSetId": {"Instances": {}}}}, } for subset in subsets: copySubsetsJson["Study"]["Series"]["imageSetId"]["Instances"][ subset ] = {} copy_image_set_information["sourceImageSet"]["DICOMCopies"] = { "copiableAttributes": json.dumps(copySubsetsJson) } copy_results = self.health_imaging_client.copy_image_set( datastoreId=datastore_id, sourceImageSetId=image_set_id, copyImageSetInformation=copy_image_set_information, force=force, ) except ClientError as err: logger.error( "Couldn't copy image set. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return copy_results["destinationImageSetProperties"]["imageSetId"]

コピー先を指定せずにイメージセットをコピーします。

copy_image_set_information = { "sourceImageSet": {"latestVersionId": version_id} } copy_results = self.health_imaging_client.copy_image_set( datastoreId=datastore_id, sourceImageSetId=image_set_id, copyImageSetInformation=copy_image_set_information, force=force, )

コピー先を指定してイメージセットをコピーします。

copy_image_set_information = { "sourceImageSet": {"latestVersionId": version_id} } if destination_image_set_id and destination_version_id: copy_image_set_information["destinationImageSet"] = { "imageSetId": destination_image_set_id, "latestVersionId": destination_version_id, } copy_results = self.health_imaging_client.copy_image_set( datastoreId=datastore_id, sourceImageSetId=image_set_id, copyImageSetInformation=copy_image_set_information, force=force, )

画像セットのサブセットをコピーします。

copy_image_set_information = { "sourceImageSet": {"latestVersionId": version_id} } if len(subsets) > 0: copySubsetsJson = { "SchemaVersion": "1.1", "Study": {"Series": {"imageSetId": {"Instances": {}}}}, } for subset in subsets: copySubsetsJson["Study"]["Series"]["imageSetId"]["Instances"][ subset ] = {} copy_image_set_information["sourceImageSet"]["DICOMCopies"] = { "copiableAttributes": json.dumps(copySubsetsJson) } copy_results = self.health_imaging_client.copy_image_set( datastoreId=datastore_id, sourceImageSetId=image_set_id, copyImageSetInformation=copy_image_set_information, force=force, )

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

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
  • API 詳細については、CopyImageSet「」の「」を参照してください 。AWS SDK for Python (Boto3) APIリファレンス

注記

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