AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
与 AWS SDK或GetDICOMImportJob
一起使用 CLI
以下代码示例演示如何使用 GetDICOMImportJob
。
操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:
- C++
-
- SDK对于 C++
-
//! Routine which gets a HealthImaging DICOM import job's properties. /*! \param dataStoreID: The HealthImaging data store ID. \param importJobID: The DICOM import job ID \param clientConfig: Aws client configuration. \return GetDICOMImportJobOutcome: The import job outcome. */ Aws::MedicalImaging::Model::GetDICOMImportJobOutcome AwsDoc::Medical_Imaging::getDICOMImportJob(const Aws::String &dataStoreID, const Aws::String &importJobID, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::MedicalImagingClient client(clientConfig); Aws::MedicalImaging::Model::GetDICOMImportJobRequest request; request.SetDatastoreId(dataStoreID); request.SetJobId(importJobID); Aws::MedicalImaging::Model::GetDICOMImportJobOutcome outcome = client.GetDICOMImportJob( request); if (!outcome.IsSuccess()) { std::cerr << "GetDICOMImportJob error: " << outcome.GetError().GetMessage() << std::endl; } return outcome; }
-
有关API详细信息,请参阅《AWS SDK for C++ API参考资料》中的 G etDICOMImport Job。
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 -
- CLI
-
- AWS CLI
-
获取 DICOM 导入任务的属性
以下
get-dicom-import-job
代码示例可获取导入任务的属性。aws medical-imaging get-dicom-import-job \ --datastore-id
"12345678901234567890123456789012"
\ --job-id"09876543210987654321098765432109"
输出:
{ "jobProperties": { "jobId": "09876543210987654321098765432109", "jobName": "my-job", "jobStatus": "COMPLETED", "datastoreId": "12345678901234567890123456789012", "dataAccessRoleArn": "arn:aws:iam::123456789012:role/ImportJobDataAccessRole", "endedAt": "2022-08-12T11:29:42.285000+00:00", "submittedAt": "2022-08-12T11:28:11.152000+00:00", "inputS3Uri": "s3://medical-imaging-dicom-input/dicom_input/", "outputS3Uri": "s3://medical-imaging-output/job_output/12345678901234567890123456789012-DicomImport-09876543210987654321098765432109/" } }
有关更多信息,请参阅《AWS HealthImaging 开发人员指南》中的获取导入任务属性。
-
有关API详细信息,请参阅《AWS CLI 命令参考》中的 G etDICOMImport J
ob。
-
- Java
-
- SDK适用于 Java 2.x
-
public static DICOMImportJobProperties getDicomImportJob(MedicalImagingClient medicalImagingClient, String datastoreId, String jobId) { try { GetDicomImportJobRequest getDicomImportJobRequest = GetDicomImportJobRequest.builder() .datastoreId(datastoreId) .jobId(jobId) .build(); GetDicomImportJobResponse response = medicalImagingClient.getDICOMImportJob(getDicomImportJobRequest); return response.jobProperties(); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return null; }
-
有关API详细信息,请参阅《AWS SDK for Java 2.x API参考资料》中的 G etDICOMImport Job。
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 -
- JavaScript
-
- SDK对于 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详细信息,请参阅《AWS SDK for JavaScript API参考资料》中的 G etDICOMImport Job。
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 -
- Python
-
- SDK适用于 Python (Boto3)
-
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def get_dicom_import_job(self, datastore_id, job_id): """ Get the properties of a DICOM import job. :param datastore_id: The ID of the data store. :param job_id: The ID of the job. :return: The job properties. """ try: job = self.health_imaging_client.get_dicom_import_job( jobId=job_id, datastoreId=datastore_id ) except ClientError as err: logger.error( "Couldn't get DICOM import job. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return job["jobProperties"]
以下代码实例化对象。 MedicalImagingWrapper
client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
-
有关API详细信息,请参阅中的 G etDICOMImport J ob AWS SDK以获取 Python (Boto3) API 参考。
注意
还有更多相关信息 GitHub。查找完整示例,学习如何在 AWS 代码示例存储库
中进行设置和运行。 -