启动导入任务 - AWS HealthImaging

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

启动导入任务

使用该StartDICOMImportJob操作开始像素数据验证检查并将数据批量导入AWS HealthImaging 数据存储。导入任务导入位于inputS3Uri参数指定的 Amazon S3 输入存储桶中的 DICOM P10 文件。导入任务处理结果存储在 outputS3Uri 参数指定的 Amazon S3 输出存储桶中。

注意

HealthImaging 支持从位于其他支持区域的 Amazon S3 存储桶导入数据。要实现此功能,请在启动导入任务时提供inputOwnerAccountId参数。有关更多信息,请参阅 的跨账户导入 AWS HealthImaging

在导入过程中,长度约束会应用于特定DICOM元素。有关更多信息,请参阅 DICOM元素约束

以下菜单提供了操作步骤 AWS Management Console 和 AWS CLI 和的代码示例 AWS SDKs。有关更多信息,请参阅 “AWS HealthImaging API参考StartDICOMImportJob中的。

启动导入任务

根据您的访问偏好选择菜单AWS HealthImaging。

  1. 打开 HealthImaging 控制台数据存储页面

  2. 选择数据存储。

  3. 选择导入DICOM数据

    将打开 “导入DICOM数据” 页面。

  4. 在 “详细信息” 部分下,输入以下信息:

    • 姓名(可选)

    • 在 S3 中导入源位置

    • 源存储桶所有者的账户 ID(可选)

    • 加密密钥(可选)

    • S3 中的输出目的地

  5. 服务访问权限一节下,选择使用现有服务角色,然后从服务角色名称菜单中选择该角色或者选择创建并使用新的服务角色

  6. 选择 Import(导入)

C++
SDK对于 C++
//! Routine which starts a HealthImaging import job. /*! \param dataStoreID: The HealthImaging data store ID. \param inputBucketName: The name of the Amazon S3 bucket containing the DICOM files. \param inputDirectory: The directory in the S3 bucket containing the DICOM files. \param outputBucketName: The name of the S3 bucket for the output. \param outputDirectory: The directory in the S3 bucket to store the output. \param roleArn: The ARN of the IAM role with permissions for the import. \param importJobId: A string to receive the import job ID. \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::Medical_Imaging::startDICOMImportJob( const Aws::String &dataStoreID, const Aws::String &inputBucketName, const Aws::String &inputDirectory, const Aws::String &outputBucketName, const Aws::String &outputDirectory, const Aws::String &roleArn, Aws::String &importJobId, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::MedicalImagingClient medicalImagingClient(clientConfig); Aws::String inputURI = "s3://" + inputBucketName + "/" + inputDirectory + "/"; Aws::String outputURI = "s3://" + outputBucketName + "/" + outputDirectory + "/"; Aws::MedicalImaging::Model::StartDICOMImportJobRequest startDICOMImportJobRequest; startDICOMImportJobRequest.SetDatastoreId(dataStoreID); startDICOMImportJobRequest.SetDataAccessRoleArn(roleArn); startDICOMImportJobRequest.SetInputS3Uri(inputURI); startDICOMImportJobRequest.SetOutputS3Uri(outputURI); Aws::MedicalImaging::Model::StartDICOMImportJobOutcome startDICOMImportJobOutcome = medicalImagingClient.StartDICOMImportJob( startDICOMImportJobRequest); if (startDICOMImportJobOutcome.IsSuccess()) { importJobId = startDICOMImportJobOutcome.GetResult().GetJobId(); } else { std::cerr << "Failed to start DICOM import job because " << startDICOMImportJobOutcome.GetError().GetMessage() << std::endl; } return startDICOMImportJobOutcome.IsSuccess(); }
注意

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

CLI
AWS CLI

启动 DICOM 导入任务

以下 start-dicom-import-job 代码示例启动 DICOM 导入任务。

aws medical-imaging start-dicom-import-job \ --job-name "my-job" \ --datastore-id "12345678901234567890123456789012" \ --input-s3-uri "s3://medical-imaging-dicom-input/dicom_input/" \ --output-s3-uri "s3://medical-imaging-output/job_output/" \ --data-access-role-arn "arn:aws:iam::123456789012:role/ImportJobDataAccessRole"

输出:

{ "datastoreId": "12345678901234567890123456789012", "jobId": "09876543210987654321098765432109", "jobStatus": "SUBMITTED", "submittedAt": "2022-08-12T11:28:11.152000+00:00" }

有关更多信息,请参阅《AWS HealthImaging 开发人员指南》中的启动导入任务

Java
SDK适用于 Java 2.x
public static String startDicomImportJob(MedicalImagingClient medicalImagingClient, String jobName, String datastoreId, String dataAccessRoleArn, String inputS3Uri, String outputS3Uri) { try { StartDicomImportJobRequest startDicomImportJobRequest = StartDicomImportJobRequest.builder() .jobName(jobName) .datastoreId(datastoreId) .dataAccessRoleArn(dataAccessRoleArn) .inputS3Uri(inputS3Uri) .outputS3Uri(outputS3Uri) .build(); StartDicomImportJobResponse response = medicalImagingClient.startDICOMImportJob(startDicomImportJobRequest); return response.jobId(); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return ""; }
  • 有关API详细信息,请参阅《AWS SDK for Java 2.x API参考资料》中的 S tartDICOMImport Job

注意

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

JavaScript
SDK对于 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详细信息,请参阅《AWS SDK for JavaScript API参考资料》中的 S tartDICOMImport Job

注意

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

Python
SDK适用于 Python (Boto3)
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def start_dicom_import_job( self, job_name, datastore_id, role_arn, input_s3_uri, output_s3_uri ): """ Start a DICOM import job. :param job_name: The name of the job. :param datastore_id: The ID of the data store. :param role_arn: The Amazon Resource Name (ARN) of the role to use for the job. :param input_s3_uri: The S3 bucket input prefix path containing the DICOM files. :param output_s3_uri: The S3 bucket output prefix path for the result. :return: The job ID. """ try: job = self.health_imaging_client.start_dicom_import_job( jobName=job_name, datastoreId=datastore_id, dataAccessRoleArn=role_arn, inputS3Uri=input_s3_uri, outputS3Uri=output_s3_uri, ) except ClientError as err: logger.error( "Couldn't start DICOM import job. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return job["jobId"]

以下代码实例化对象。 MedicalImagingWrapper

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

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

示例可用性

找不到所需的内容? 使用本页底部的提供反馈链接索取代码示例。