画像セットメタデータの取得 - AWS HealthImaging

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

画像セットメタデータの取得

GetImageSetMetadata アクションを使用して、特定の画像セットメタデータを取得します HealthImaging。次のメニューは、 の手順と、 AWS Management Console および のコード例を示しています AWS CLI AWS SDKs。詳細については、AWS HealthImaging API リファレンスの「GetImageSetMetadata」を参照してください。

注記

デフォルトでは、 はイメージセットの最新バージョンのメタデータ属性 HealthImaging を返します。古いバージョンの画像セットのメタデータを表示するには、リクエストにversionIdを付けてください。

画像セットメタデータは で圧縮gzipされ、JSONオブジェクトとして返されます。したがって、正規化されたメタデータを表示する前に JSON オブジェクトを解凍する必要があります。詳細については、「メタデータの正規化」を参照してください。

DICOMweb サービスの表現GetDICOMInstanceMetadata HealthImagingである を使用して、DICOMインスタンスメタデータ (.json ファイル) を返します。詳細については、「HealthImaging からの DICOM インスタンスメタデータの取得」を参照してください。

画像セットのメタデータを取得するには

へのアクセス設定に基づいてメニューを選択しますAWS HealthImaging。

  1. HealthImaging コンソールのデータストアページを開きます。

  2. データストアを選択します。

    データストアの詳細ページが開き、デフォルトで [画像セット] タブが選択されます。

  3. 画像セットを選択します。

    画像セットの詳細ページが開き、画像セットのメタデータが「画像セットメタデータビューア」セクションの下に表示されます。

C++
SDK C++ 用

イメージセットのメタデータを取得するためのユーティリティ関数。

//! Routine which gets a HealthImaging image set's metadata. /*! \param dataStoreID: The HealthImaging data store ID. \param imageSetID: The HealthImaging image set ID. \param versionID: The HealthImaging image set version ID, ignored if empty. \param outputFilePath: The path where the metadata will be stored as gzipped json. \param clientConfig: Aws client configuration. \\return bool: Function succeeded. */ bool AwsDoc::Medical_Imaging::getImageSetMetadata(const Aws::String &dataStoreID, const Aws::String &imageSetID, const Aws::String &versionID, const Aws::String &outputFilePath, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::Model::GetImageSetMetadataRequest request; request.SetDatastoreId(dataStoreID); request.SetImageSetId(imageSetID); if (!versionID.empty()) { request.SetVersionId(versionID); } Aws::MedicalImaging::MedicalImagingClient client(clientConfig); Aws::MedicalImaging::Model::GetImageSetMetadataOutcome outcome = client.GetImageSetMetadata( request); if (outcome.IsSuccess()) { std::ofstream file(outputFilePath, std::ios::binary); auto &metadata = outcome.GetResult().GetImageSetMetadataBlob(); file << metadata.rdbuf(); } else { std::cerr << "Failed to get image set metadata: " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }

イメージセットのメタデータをバージョンなしで取得します。

if (AwsDoc::Medical_Imaging::getImageSetMetadata(dataStoreID, imageSetID, "", outputFilePath, clientConfig)) { std::cout << "Successfully retrieved image set metadata." << std::endl; std::cout << "Metadata stored in: " << outputFilePath << std::endl; }

イメージセットのメタデータをバージョン付きで取得します。

if (AwsDoc::Medical_Imaging::getImageSetMetadata(dataStoreID, imageSetID, versionID, outputFilePath, clientConfig)) { std::cout << "Successfully retrieved image set metadata." << std::endl; std::cout << "Metadata stored in: " << outputFilePath << std::endl; }
  • API 詳細については、「 AWS SDK for C++ APIリファレンスGetImageSetMetadata」の「」を参照してください。

注記

詳細については、「」を参照してください GitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

CLI
AWS CLI

例 1:画像セットのメタデータをバージョンなしで取得するには

次の get-image-set-metadata コード例では、バージョンを指定せずに画像セットのメタデータを取得しています。

注:outfile は必須のパラメータです

aws medical-imaging get-image-set-metadata \ --datastore-id 12345678901234567890123456789012 \ --image-set-id ea92b0d8838c72a3f25d00d13616f87e \ studymetadata.json.gz

返されたメタデータは gzip で圧縮され、studymetadata.json.gz ファイルに保存されます。返されたJSONオブジェクトの内容を表示するには、まず解凍する必要があります。

出力:

{ "contentType": "application/json", "contentEncoding": "gzip" }

例 2:画像セットのメタデータをバージョン付きで取得するには

次の get-image-set-metadata コード例では、指定されたバージョンの画像セットのメタデータを取得しています。

注:outfile は必須のパラメータです

aws medical-imaging get-image-set-metadata \ --datastore-id 12345678901234567890123456789012 \ --image-set-id ea92b0d8838c72a3f25d00d13616f87e \ --version-id 1 \ studymetadata.json.gz

返されたメタデータは gzip で圧縮され、studymetadata.json.gz ファイルに保存されます。返されたJSONオブジェクトの内容を表示するには、まず解凍する必要があります。

出力:

{ "contentType": "application/json", "contentEncoding": "gzip" }

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

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

Java
SDK for Java 2.x
public static void getMedicalImageSetMetadata(MedicalImagingClient medicalImagingClient, String destinationPath, String datastoreId, String imagesetId, String versionId) { try { GetImageSetMetadataRequest.Builder getImageSetMetadataRequestBuilder = GetImageSetMetadataRequest.builder() .datastoreId(datastoreId) .imageSetId(imagesetId); if (versionId != null) { getImageSetMetadataRequestBuilder = getImageSetMetadataRequestBuilder.versionId(versionId); } medicalImagingClient.getImageSetMetadata(getImageSetMetadataRequestBuilder.build(), FileSystems.getDefault().getPath(destinationPath)); System.out.println("Metadata downloaded to " + destinationPath); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
  • API 詳細については、「 AWS SDK for Java 2.x APIリファレンスGetImageSetMetadata」の「」を参照してください。

注記

詳細については、「」を参照してください GitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

JavaScript
SDK for JavaScript (v3)

イメージセットのメタデータを取得するためのユーティリティ関数。

import { GetImageSetMetadataCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; import { writeFileSync } from "node:fs"; /** * @param {string} metadataFileName - The name of the file for the gzipped metadata. * @param {string} datastoreId - The ID of the data store. * @param {string} imagesetId - The ID of the image set. * @param {string} versionID - The optional version ID of the image set. */ export const getImageSetMetadata = async ( metadataFileName = "metadata.json.gzip", datastoreId = "xxxxxxxxxxxxxx", imagesetId = "xxxxxxxxxxxxxx", versionID = "", ) => { const params = { datastoreId: datastoreId, imageSetId: imagesetId }; if (versionID) { params.versionID = versionID; } const response = await medicalImagingClient.send( new GetImageSetMetadataCommand(params), ); const buffer = await response.imageSetMetadataBlob.transformToByteArray(); writeFileSync(metadataFileName, buffer); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '5219b274-30ff-4986-8cab-48753de3a599', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // contentType: 'application/json', // contentEncoding: 'gzip', // imageSetMetadataBlob: <ref *1> IncomingMessage {} // } return response; };

イメージセットのメタデータをバージョンなしで取得します。

try { await getImageSetMetadata( "metadata.json.gzip", "12345678901234567890123456789012", "12345678901234567890123456789012", ); } catch (err) { console.log("Error", err); }

イメージセットのメタデータをバージョン付きで取得します。

try { await getImageSetMetadata( "metadata2.json.gzip", "12345678901234567890123456789012", "12345678901234567890123456789012", "1", ); } catch (err) { console.log("Error", err); }
  • API 詳細については、「 AWS SDK for JavaScript APIリファレンスGetImageSetMetadata」の「」を参照してください。

注記

詳細については、「」を参照してください GitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

Python
SDK for Python (Boto3)

イメージセットのメタデータを取得するためのユーティリティ関数。

class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def get_image_set_metadata( self, metadata_file, datastore_id, image_set_id, version_id=None ): """ Get the metadata of an image set. :param metadata_file: The file to store the JSON gzipped metadata. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :param version_id: The version of the image set. """ try: if version_id: image_set_metadata = self.health_imaging_client.get_image_set_metadata( imageSetId=image_set_id, datastoreId=datastore_id, versionId=version_id, ) else: image_set_metadata = self.health_imaging_client.get_image_set_metadata( imageSetId=image_set_id, datastoreId=datastore_id ) print(image_set_metadata) with open(metadata_file, "wb") as f: for chunk in image_set_metadata["imageSetMetadataBlob"].iter_chunks(): if chunk: f.write(chunk) except ClientError as err: logger.error( "Couldn't get image metadata. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise

イメージセットのメタデータをバージョンなしで取得します。

image_set_metadata = self.health_imaging_client.get_image_set_metadata( imageSetId=image_set_id, datastoreId=datastore_id )

イメージセットのメタデータをバージョン付きで取得します。

image_set_metadata = self.health_imaging_client.get_image_set_metadata( imageSetId=image_set_id, datastoreId=datastore_id, versionId=version_id, )

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

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

注記

詳細については、「」を参照してください GitHub。用例一覧を検索し、AWS コード例リポジトリでの設定と実行の方法を確認してください。

可用性の例

必要なものが見つからなかった場合。このページの右側サイドバーにあるフィードバックを提供するリンクを使用して、コード例をリクエストします。