HealthImaging 使用适用于 JavaScript (v3) 的 SDK 的示例 - Amazon SDK for JavaScript
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

Amazon SDK for JavaScript V3 API 参考指南详细描述了 Amazon SDK for JavaScript 版本 3 (V3) 的所有 API 操作。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

HealthImaging 使用适用于 JavaScript (v3) 的 SDK 的示例

以下代码示例向您展示了如何通过使用 Amazon SDK for JavaScript (v3) 来执行操作和实现常见场景 HealthImaging。

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。

场景 是展示如何通过在同一服务中调用多个函数来完成特定任务的代码示例。

每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。

开始使用

以下代码示例展示了如何开始使用 HealthImaging。

适用于 JavaScript (v3) 的软件开发工具包
import { ListDatastoresCommand, MedicalImagingClient, } from "@aws-sdk/client-medical-imaging"; // When no region or credentials are provided, the SDK will use the // region and credentials from the local AWS config. const client = new MedicalImagingClient({}); export const helloMedicalImaging = async () => { const command = new ListDatastoresCommand({}); const { datastoreSummaries } = await client.send(command); console.log("Datastores: "); console.log(datastoreSummaries.map((item) => item.datastoreName).join("\n")); return datastoreSummaries; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考ListDatastores中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

操作

以下代码示例显示了如何为 HealthImaging 资源添加标签。

适用于 JavaScript (v3) 的软件开发工具包
import { TagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {Record<string,string>} tags - The tags to add to the resource as JSON. * - For example: {"Deployment" : "Development"} */ export const tagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tags = {} ) => { const response = await medicalImagingClient.send( new TagResourceCommand({ resourceArn: resourceArn, tags: tags }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考TagResource中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何复制 HealthImaging 图像集。

适用于 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. */ export const copyImageSet = async ( datastoreId = "xxxxxxxxxxx", imageSetId = "xxxxxxxxxxxx", sourceVersionId = "1", destinationImageSetId = "", destinationVersionId = "" ) => { const params = { datastoreId: datastoreId, sourceImageSetId: imageSetId, copyImageSetInformation: { sourceImageSet: { latestVersionId: sourceVersionId }, }, }; if (destinationImageSetId !== "" && destinationVersionId !== "") { params.copyImageSetInformation.destinationImageSet = { imageSetId: destinationImageSetId, latestVersionId: destinationVersionId, }; } 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; };

复制没有目标的映像集。

try { await copyImageSet( "12345678901234567890123456789012", "12345678901234567890123456789012", "1" ); } catch (err) { console.error(err); }

复制带有目标的映像集。

try { await copyImageSet( "12345678901234567890123456789012", "12345678901234567890123456789012", "4", "12345678901234567890123456789012", "1" ); } catch (err) { console.error(err); }
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考CopyImageSet中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何创建 HealthImaging 数据存储。

适用于 JavaScript (v3) 的软件开发工具包
import { CreateDatastoreCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreName - The name of the data store to create. */ export const createDatastore = async (datastoreName = "DATASTORE_NAME") => { const response = await medicalImagingClient.send( new CreateDatastoreCommand({ datastoreName: datastoreName }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'a71cd65f-2382-49bf-b682-f9209d8d399b', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreStatus: 'CREATING' // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考CreateDatastore中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何删除 HealthImaging 数据存储。

适用于 JavaScript (v3) 的软件开发工具包
import { DeleteDatastoreCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The ID of the data store to delete. */ export const deleteDatastore = async (datastoreId = "DATASTORE_ID") => { const response = await medicalImagingClient.send( new DeleteDatastoreCommand({ datastoreId }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'f5beb409-678d-48c9-9173-9a001ee1ebb1', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreStatus: 'DELETING' // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考DeleteDatastore中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何删除 HealthImaging 影像集。

适用于 JavaScript (v3) 的软件开发工具包
import { DeleteImageSetCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The data store ID. * @param {string} imageSetId - The image set ID. */ export const deleteImageSet = async ( datastoreId = "xxxxxxxxxxxxxxxx", imageSetId = "xxxxxxxxxxxxxxxx" ) => { const response = await medicalImagingClient.send( new DeleteImageSetCommand({ datastoreId: datastoreId, imageSetId: imageSetId, }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '6267bbd2-eaa5-4a50-8ee8-8fddf535cf73', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxx', // imageSetState: 'LOCKED', // imageSetWorkflowStatus: 'DELETING' // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考DeleteImageSet中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例展示了如何获取映像帧。

适用于 JavaScript (v3) 的软件开发工具包
import { GetImageFrameCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} imageFrameFileName - The name of the file for the HTJ2K-encoded image frame. * @param {string} datastoreID - The data store's ID. * @param {string} imageSetID - The image set's ID. * @param {string} imageFrameID - The image frame's ID. */ export const getImageFrame = async ( imageFrameFileName = "image.jph", datastoreID = "DATASTORE_ID", imageSetID = "IMAGE_SET_ID", imageFrameID = "IMAGE_FRAME_ID" ) => { const response = await medicalImagingClient.send( new GetImageFrameCommand({ datastoreId: datastoreID, imageSetId: imageSetID, imageFrameInformation: { imageFrameId: imageFrameID }, }) ); const buffer = await response.imageFrameBlob.transformToByteArray(); writeFileSync(imageFrameFileName, buffer); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'e4ab42a5-25a3-4377-873f-374ecf4380e1', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // contentType: 'application/octet-stream', // imageFrameBlob: <ref *1> IncomingMessage {} // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考GetImageFrame中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何获取 HealthImaging 数据存储属性。

适用于 JavaScript (v3) 的软件开发工具包
import { GetDatastoreCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreID - The ID of the data store. */ export const getDatastore = async (datastoreID = "DATASTORE_ID") => { const response = await medicalImagingClient.send( new GetDatastoreCommand({ datastoreId: datastoreID }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '55ea7d2e-222c-4a6a-871e-4f591f40cadb', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreProperties: { // createdAt: 2023-08-04T18:50:36.239Z, // datastoreArn: 'arn:aws:medical-imaging:us-east-1:xxxxxxxxx:datastore/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreName: 'my_datastore', // datastoreStatus: 'ACTIVE', // updatedAt: 2023-08-04T18:50:36.239Z // } // } return response["datastoreProperties"]; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考GetDatastore中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例说明如何获取 HealthImaging 影像集属性。

适用于 JavaScript (v3) 的软件开发工具包
import { GetImageSetCommand } 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 ID of the image set. * @param {string} imageSetVersion - The optional version of the image set. * */ export const getImageSet = async ( datastoreId = "xxxxxxxxxxxxxxx", imageSetId = "xxxxxxxxxxxxxxx", imageSetVersion = "" ) => { let params = { datastoreId: datastoreId, imageSetId: imageSetId }; if (imageSetVersion !== "") { params.imageSetVersion = imageSetVersion; } const response = await medicalImagingClient.send( new GetImageSetCommand(params) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '0615c161-410d-4d06-9d8c-6e1241bb0a5a', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // createdAt: 2023-09-22T14:49:26.427Z, // datastoreId: 'xxxxxxxxxxxxxxx', // imageSetArn: 'arn:aws:medical-imaging:us-east-1:xxxxxxxxxx:datastore/xxxxxxxxxxxxxxxxxxxx/imageset/xxxxxxxxxxxxxxxxxxxx', // imageSetId: 'xxxxxxxxxxxxxxx', // imageSetState: 'ACTIVE', // imageSetWorkflowStatus: 'CREATED', // updatedAt: 2023-09-22T14:49:26.427Z, // versionId: '1' // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考GetImageSet中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例展示了如何获取导入作业属性。

适用于 JavaScript (v3) 的软件开发工具包
import { GetDICOMImportJobCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The ID of the data store. * @param {string} jobId - The ID of the import job. */ export const getDICOMImportJob = async ( datastoreId = "xxxxxxxxxxxxxxxxxxxx", jobId = "xxxxxxxxxxxxxxxxxxxx" ) => { const response = await medicalImagingClient.send( new GetDICOMImportJobCommand({ datastoreId: datastoreId, jobId: jobId }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: 'a2637936-78ea-44e7-98b8-7a87d95dfaee', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // jobProperties: { // dataAccessRoleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/dicom_import', // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxx', // endedAt: 2023-09-19T17:29:21.753Z, // inputS3Uri: 's3://healthimaging-source/CTStudy/', // jobId: ''xxxxxxxxxxxxxxxxxxxxxxxxx'', // jobName: 'job_1', // jobStatus: 'COMPLETED', // outputS3Uri: 's3://health-imaging-dest/ouput_ct/'xxxxxxxxxxxxxxxxxxxxxxxxx'-DicomImport-'xxxxxxxxxxxxxxxxxxxxxxxxx'/', // submittedAt: 2023-09-19T17:27:25.143Z // } // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript AP I 参考ImportJob中的 getDicom

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例说明如何获取 HealthImaging 影像集的元数据。

适用于 JavaScript (v3) 的软件开发工具包

用于获取映像集元数据的实用程序函数。

import { GetImageSetMetadataCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; import { writeFileSync } from "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 的详细信息,请参阅 Amazon SDK for JavaScript API 参考GetImageSetMetadata中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例说明如何将批量数据导入 HealthImaging 数据存储。

适用于 JavaScript (v3) 的软件开发工具包
import { StartDICOMImportJobCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} jobName - The name of the import job. * @param {string} datastoreId - The ID of the data store. * @param {string} dataAccessRoleArn - The Amazon Resource Name (ARN) of the role that grants permission. * @param {string} inputS3Uri - The URI of the S3 bucket containing the input files. * @param {string} outputS3Uri - The URI of the S3 bucket where the output files are stored. */ export const startDicomImportJob = async ( jobName = "test-1", datastoreId = "12345678901234567890123456789012", dataAccessRoleArn = "arn:aws:iam::xxxxxxxxxxxx:role/ImportJobDataAccessRole", inputS3Uri = "s3://medical-imaging-dicom-input/dicom_input/", outputS3Uri = "s3://medical-imaging-output/job_output/" ) => { const response = await medicalImagingClient.send( new StartDICOMImportJobCommand({ jobName: jobName, datastoreId: datastoreId, dataAccessRoleArn: dataAccessRoleArn, inputS3Uri: inputS3Uri, outputS3Uri: outputS3Uri, }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '6e81d191-d46b-4e48-a08a-cdcc7e11eb79', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // jobId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // jobStatus: 'SUBMITTED', // submittedAt: 2023-09-22T14:48:45.767Z // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript AP I 参考ImportJob中的 StartDicom

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何列出 HealthImaging 数据存储。

适用于 JavaScript (v3) 的软件开发工具包
import { paginateListDatastores } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; export const listDatastores = async () => { const paginatorConfig = { client: medicalImagingClient, pageSize: 50, }; const commandParams = {}; const paginator = paginateListDatastores(paginatorConfig, commandParams); /** * @type {import("@aws-sdk/client-medical-imaging").DatastoreSummary[]} */ const datastoreSummaries = []; for await (const page of paginator) { // Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`. datastoreSummaries.push(...page["datastoreSummaries"]); console.log(page); } // { // '$metadata': { // httpStatusCode: 200, // requestId: '6aa99231-d9c2-4716-a46e-edb830116fa3', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // datastoreSummaries: [ // { // createdAt: 2023-08-04T18:49:54.429Z, // datastoreArn: 'arn:aws:medical-imaging:us-east-1:xxxxxxxxx:datastore/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // datastoreName: 'my_datastore', // datastoreStatus: 'ACTIVE', // updatedAt: 2023-08-04T18:49:54.429Z // } // ... // ] // } return datastoreSummaries; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考ListDatastores中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何列出 HealthImaging 影像集版本。

适用于 JavaScript (v3) 的软件开发工具包
import { paginateListImageSetVersions } 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 ID of the image set. */ export const listImageSetVersions = async ( datastoreId = "xxxxxxxxxxxx", imageSetId = "xxxxxxxxxxxx" ) => { const paginatorConfig = { client: medicalImagingClient, pageSize: 50, }; const commandParams = { datastoreId, imageSetId }; const paginator = paginateListImageSetVersions( paginatorConfig, commandParams ); let imageSetPropertiesList = []; for await (const page of paginator) { // Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`. imageSetPropertiesList.push(...page["imageSetPropertiesList"]); console.log(page); } // { // '$metadata': { // httpStatusCode: 200, // requestId: '74590b37-a002-4827-83f2-3c590279c742', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // imageSetPropertiesList: [ // { // ImageSetWorkflowStatus: 'CREATED', // createdAt: 2023-09-22T14:49:26.427Z, // imageSetId: 'xxxxxxxxxxxxxxxxxxxxxxx', // imageSetState: 'ACTIVE', // versionId: '1' // }] // } return imageSetPropertiesList; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考ListImageSetVersions中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何列出 HealthImaging 数据存储的导入任务。

适用于 JavaScript (v3) 的软件开发工具包
import { paginateListDICOMImportJobs } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The ID of the data store. */ export const listDICOMImportJobs = async ( datastoreId = "xxxxxxxxxxxxxxxxxx" ) => { const paginatorConfig = { client: medicalImagingClient, pageSize: 50, }; const commandParams = { datastoreId: datastoreId }; const paginator = paginateListDICOMImportJobs(paginatorConfig, commandParams); let jobSummaries = []; for await (const page of paginator) { // Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`. jobSummaries.push(...page["jobSummaries"]); console.log(page); } // { // '$metadata': { // httpStatusCode: 200, // requestId: '3c20c66e-0797-446a-a1d8-91b742fd15a0', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // jobSummaries: [ // { // dataAccessRoleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/dicom_import', // datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxx', // endedAt: 2023-09-22T14:49:51.351Z, // jobId: 'xxxxxxxxxxxxxxxxxxxxxxxxx', // jobName: 'test-1', // jobStatus: 'COMPLETED', // submittedAt: 2023-09-22T14:48:45.767Z // } // ]} return jobSummaries; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript AP I 参考ImportJobs中的 ListDicom

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何列出 HealthImaging 资源的标签。

适用于 JavaScript (v3) 的软件开发工具包
import { ListTagsForResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. */ export const listTagsForResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:abc:datastore/def/imageset/ghi" ) => { const response = await medicalImagingClient.send( new ListTagsForResourceCommand({ resourceArn: resourceArn }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '008fc6d3-abec-4870-a155-20fa3631e645', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // tags: { Deployment: 'Development' } // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考ListTagsForResource中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何从 HealthImaging 资源中移除标签。

适用于 JavaScript (v3) 的软件开发工具包
import { UntagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {string[]} tagKeys - The keys of the tags to remove. */ export const untagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tagKeys = [] ) => { const response = await medicalImagingClient.send( new UntagResourceCommand({ resourceArn: resourceArn, tagKeys: tagKeys }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考UntagResource中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何搜索 HealthImaging 影像集。

适用于 JavaScript (v3) 的软件开发工具包

用于搜索映像集的实用程序函数。

import { paginateSearchImageSets } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The data store's ID. * @param { import('@aws-sdk/client-medical-imaging').SearchFilter[] } filters - The search criteria filters. */ export const searchImageSets = async ( datastoreId = "xxxxxxxx", filters = [] ) => { const paginatorConfig = { client: medicalImagingClient, pageSize: 50, }; const commandParams = { datastoreId: datastoreId, searchCriteria: { filters, }, }; const paginator = paginateSearchImageSets(paginatorConfig, commandParams); const imageSetsMetadataSummaries = []; for await (const page of paginator) { // Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`. imageSetsMetadataSummaries.push(...page["imageSetsMetadataSummaries"]); console.log(page); } // { // '$metadata': { // httpStatusCode: 200, // requestId: 'f009ea9c-84ca-4749-b5b6-7164f00a5ada', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // imageSetsMetadataSummaries: [ // { // DICOMTags: [Object], // createdAt: "2023-09-19T16:59:40.551Z", // imageSetId: '7f75e1b5c0f40eac2b24cf712f485f50', // updatedAt: "2023-09-19T16:59:40.551Z", // version: 1 // }] // } return imageSetsMetadataSummaries; };

使用案例 #1:EQUAL 运算符。

const datastoreId = "12345678901234567890123456789012"; try { const filters = [ { values: [{ DICOMPatientId: "9227465" }], operator: "EQUAL", }, ]; await searchImageSets(datastoreId, filters); } catch (err) { console.error(err); }

用例 #2: 在使用 DICOM 和 DICOM 的运算符之间StudyDate 。StudyTime

const datastoreId = "12345678901234567890123456789012"; try { const filters = [ { values: [ { DICOMStudyDateAndTime: { DICOMStudyDate: "19900101", DICOMStudyTime: "000000", }, }, { DICOMStudyDateAndTime: { DICOMStudyDate: "20230901", DICOMStudyTime: "000000", }, }, ], operator: "BETWEEN", }, ]; await searchImageSets(datastoreId, filters); } catch (err) { console.error(err); }

使用案例 #3:使用 createdAt 的 BETWEEN 运算符。时间研究以前一直存在。

const datastoreId = "12345678901234567890123456789012"; try { const filters = [ { values: [ { createdAt: new Date("1985-04-12T23:20:50.52Z") }, { createdAt: new Date("2023-09-12T23:20:50.52Z") }, ], operator: "BETWEEN", }, ]; await searchImageSets(datastoreId, filters); } catch (err) { console.error(err); }
  • 有关 API 的详细信息,请参阅 Amazon SDK for JavaScript API 参考SearchImageSets中的。

注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示如何更新 HealthImaging 影像集元数据。

适用于 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. */ export const updateImageSetMetadata = async (datastoreId = "xxxxxxxxxx", imageSetId = "xxxxxxxxxx", latestVersionId = "1", updateMetadata = '{}') => { const response = await medicalImagingClient.send( new UpdateImageSetMetadataCommand({ datastoreId: datastoreId, imageSetId: imageSetId, latestVersionId: latestVersionId, updateImageSetMetadataUpdates: updateMetadata }) ); 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; };

对元数据进行编码。

const updatableAttributes = JSON.stringify({ "SchemaVersion": 1.1, "Patient": { "DICOM": { "PatientName": "Garcia^Gloria" } } }) const updateMetadata = { "DICOMUpdates": { "updatableAttributes": new TextEncoder().encode(updatableAttributes) } }; await updateImageSetMetadata("12345678901234567890123456789012", "12345678901234567890123456789012", "1", updateMetadata);
注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

场景

以下代码示例显示了如何为 HealthImaging 数据存储添加标签。

适用于 JavaScript (v3) 的软件开发工具包

标记数据存储。

try { const datastoreArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012"; const tags = { Deployment: "Development", }; await tagResource(datastoreArn, tags); } catch (e) { console.log(e); }

用于标记资源的实用程序函数。

import { TagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {Record<string,string>} tags - The tags to add to the resource as JSON. * - For example: {"Deployment" : "Development"} */ export const tagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tags = {} ) => { const response = await medicalImagingClient.send( new TagResourceCommand({ resourceArn: resourceArn, tags: tags }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };

列出数据存储的标签。

try { const datastoreArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012"; const { tags } = await listTagsForResource(datastoreArn); console.log(tags); } catch (e) { console.log(e); }

用于列出资源标签的实用程序函数。

import { ListTagsForResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. */ export const listTagsForResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:abc:datastore/def/imageset/ghi" ) => { const response = await medicalImagingClient.send( new ListTagsForResourceCommand({ resourceArn: resourceArn }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '008fc6d3-abec-4870-a155-20fa3631e645', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // tags: { Deployment: 'Development' } // } return response; };

取消标记数据存储。

try { const datastoreArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012"; const keys = ["Deployment"]; await untagResource(datastoreArn, keys); } catch (e) { console.log(e); }

用于取消标记资源的实用程序函数。

import { UntagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {string[]} tagKeys - The keys of the tags to remove. */ export const untagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tagKeys = [] ) => { const response = await medicalImagingClient.send( new UntagResourceCommand({ resourceArn: resourceArn, tagKeys: tagKeys }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };
注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。

以下代码示例显示了如何为 HealthImaging 图像集添加标签。

适用于 JavaScript (v3) 的软件开发工具包

标记映像集。

try { const imagesetArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/12345678901234567890123456789012"; const tags = { Deployment: "Development", }; await tagResource(imagesetArn, tags); } catch (e) { console.log(e); }

用于标记资源的实用程序函数。

import { TagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {Record<string,string>} tags - The tags to add to the resource as JSON. * - For example: {"Deployment" : "Development"} */ export const tagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tags = {} ) => { const response = await medicalImagingClient.send( new TagResourceCommand({ resourceArn: resourceArn, tags: tags }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };

列出映像集的标签。

try { const imagesetArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/12345678901234567890123456789012"; const { tags } = await listTagsForResource(imagesetArn); console.log(tags); } catch (e) { console.log(e); }

用于列出资源标签的实用程序函数。

import { ListTagsForResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. */ export const listTagsForResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:abc:datastore/def/imageset/ghi" ) => { const response = await medicalImagingClient.send( new ListTagsForResourceCommand({ resourceArn: resourceArn }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 200, // requestId: '008fc6d3-abec-4870-a155-20fa3631e645', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // tags: { Deployment: 'Development' } // } return response; };

取消标记映像集。

try { const imagesetArn = "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/12345678901234567890123456789012"; const keys = ["Deployment"]; await untagResource(imagesetArn, keys); } catch (e) { console.log(e); }

用于取消标记资源的实用程序函数。

import { UntagResourceCommand } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set. * @param {string[]} tagKeys - The keys of the tags to remove. */ export const untagResource = async ( resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx", tagKeys = [] ) => { const response = await medicalImagingClient.send( new UntagResourceCommand({ resourceArn: resourceArn, tagKeys: tagKeys }) ); console.log(response); // { // '$metadata': { // httpStatusCode: 204, // requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // } // } return response; };
注意

还有更多相关信息 GitHub。在 Amazon 代码示例存储库中查找完整示例,了解如何进行设置和运行。