啟動匯入任務 - 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。如需詳細資訊,請參閱 參考 StartDICOMImportJob 中的 。 AWS HealthImaging API

啟動匯入任務

根據您對 的存取偏好設定選擇選單AWS HealthImaging。

  1. 開啟 HealthImaging 主控台資料存放區頁面

  2. 選擇資料存放區。

  3. 選擇匯入DICOM資料

    匯入DICOM資料頁面隨即開啟。

  4. 詳細資訊區段下,輸入下列資訊:

    • 名稱 (選用)

    • 在 S3 中匯入來源位置

    • 來源儲存貯體擁有者的帳戶 ID (選用)

    • 加密金鑰 (選用)

    • S3 中的輸出目的地

  5. 服務存取區段下,選擇使用現有的服務角色,然後從服務角色名稱功能表中選擇角色,或選擇建立並使用新的服務角色。

  6. 選擇匯入

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 ""; }
注意

還有更多 。 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; };
注意

還有更多 。 GitHub尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫中設定和執行。

Python
SDK for 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 程式碼範例儲存庫中設定和執行。

可用性範例

找不到所需的內容嗎? 使用此頁面底部的提供意見回饋連結來請求程式碼範例。