Utilizzare GetImageSet con un SDK AWS o una CLI - Esempi di codice per SDK AWS

Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS.

Utilizzare GetImageSet con un SDK AWS o una CLI

Gli esempi di codice seguenti mostrano come utilizzare GetImageSet.

CLI
AWS CLI

Come ottenere le proprietà del set di immagini

L’esempio di codice get-image-set seguente ottiene le proprietà di un set di immagini.

aws medical-imaging get-image-set \ --datastore-id 12345678901234567890123456789012 \ --image-set-id 18f88ac7870584f58d56256646b4d92b \ --version-id 1

Output:

{ "versionId": "1", "imageSetWorkflowStatus": "COPIED", "updatedAt": 1680027253.471, "imageSetId": "18f88ac7870584f58d56256646b4d92b", "imageSetState": "ACTIVE", "createdAt": 1679592510.753, "datastoreId": "12345678901234567890123456789012" }

Per ulteriori informazioni, consulta Recupero delle proprietà dei set di immagini nella Guida per gli sviluppatori di AWS HealthImaging.

  • Per informazioni dettagliate sull’API, consulta GetImageSet in AWS CLI Command Reference.

Java
SDK per Java 2.x
public static GetImageSetResponse getMedicalImageSet(MedicalImagingClient medicalImagingClient, String datastoreId, String imagesetId, String versionId) { try { GetImageSetRequest.Builder getImageSetRequestBuilder = GetImageSetRequest.builder() .datastoreId(datastoreId) .imageSetId(imagesetId); if (versionId != null) { getImageSetRequestBuilder = getImageSetRequestBuilder.versionId(versionId); } return medicalImagingClient.getImageSet(getImageSetRequestBuilder.build()); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return null; }
  • Per informazioni dettagliate sull’API, consulta GetImageSet nella documentazione di riferimento dell’API AWS SDK for Java 2.x.

Nota

Ulteriori informazioni su GitHub. Trova l’esempio completo e scopri di più sulla configurazione e l’esecuzione nel Repository di esempi di codice AWS.

JavaScript
SDK per 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 = "", ) => { const 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; };
  • Per informazioni dettagliate sull’API, consulta GetImageSet nella documentazione di riferimento dell’API AWS SDK per JavaScript.

Nota

Ulteriori informazioni su GitHub. Trova l’esempio completo e scopri di più sulla configurazione e l’esecuzione nel Repository di esempi di codice AWS.

Python
SDK per Python (Boto3)
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def get_image_set(self, datastore_id, image_set_id, version_id=None): """ Get the properties of an image set. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :param version_id: The optional version of the image set. :return: The image set properties. """ try: if version_id: image_set = self.health_imaging_client.get_image_set( imageSetId=image_set_id, datastoreId=datastore_id, versionId=version_id, ) else: image_set = self.health_imaging_client.get_image_set( imageSetId=image_set_id, datastoreId=datastore_id ) except ClientError as err: logger.error( "Couldn't get image set. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return image_set

Il codice seguente crea un’istanza dell’oggetto MedicalImagingWrapper.

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
  • Per informazioni dettagliate sull’API, consulta GetImageSet nella documentazione di riferimento dell’API AWS SDK per Python (Boto3).

Nota

Ulteriori informazioni su GitHub. Trova l’esempio completo e scopri di più sulla configurazione e l’esecuzione nel Repository di esempi di codice AWS.