Deleting an image set
Use the DeleteImageSet
action to delete an image set in HealthImaging. The following menus provide a procedure for the AWS Management Console and code
examples for the AWS CLI and AWS SDKs. For more information, see DeleteImageSet
in the AWS HealthImaging API
Reference.
To delete an image set
Choose a menu based on your access preference to AWS HealthImaging.
-
Open the HealthImaging console Data stores page
. -
Choose a data store.
The Data store details page opens and the Image sets tab is selected by default.
-
Choose an image set and choose Delete.
The Delete image set modal opens.
-
Provide the ID of the image set and choose Delete image set.
- C++
-
- SDK for C++
-
//! Routine which deletes an AWS HealthImaging image set. /*! \param dataStoreID: The HealthImaging data store ID. \param imageSetID: The image set ID. \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::Medical_Imaging::deleteImageSet( const Aws::String &dataStoreID, const Aws::String &imageSetID, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::MedicalImagingClient client(clientConfig); Aws::MedicalImaging::Model::DeleteImageSetRequest request; request.SetDatastoreId(dataStoreID); request.SetImageSetId(imageSetID); Aws::MedicalImaging::Model::DeleteImageSetOutcome outcome = client.DeleteImageSet( request); if (outcome.IsSuccess()) { std::cout << "Successfully deleted image set " << imageSetID << " from data store " << dataStoreID << std::endl; } else { std::cerr << "Error deleting image set " << imageSetID << " from data store " << dataStoreID << ": " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }
-
For API details, see DeleteImageSet in AWS SDK for C++ API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- CLI
-
- AWS CLI
-
To delete an image set
The following
delete-image-set
code example deletes an image set.aws medical-imaging delete-image-set \ --datastore-id
12345678901234567890123456789012
\ --image-set-idea92b0d8838c72a3f25d00d13616f87e
Output:
{ "imageSetWorkflowStatus": "DELETING", "imageSetId": "ea92b0d8838c72a3f25d00d13616f87e", "imageSetState": "LOCKED", "datastoreId": "12345678901234567890123456789012" }
-
For API details, see DeleteImageSet
in AWS CLI Command Reference.
-
- Java
-
- SDK for Java 2.x
-
public static void deleteMedicalImageSet(MedicalImagingClient medicalImagingClient, String datastoreId, String imagesetId) { try { DeleteImageSetRequest deleteImageSetRequest = DeleteImageSetRequest.builder() .datastoreId(datastoreId) .imageSetId(imagesetId) .build(); medicalImagingClient.deleteImageSet(deleteImageSetRequest); System.out.println("The image set was deleted."); } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }
-
For API details, see DeleteImageSet in AWS SDK for Java 2.x API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- JavaScript
-
- SDK for 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; };
-
For API details, see DeleteImageSet in AWS SDK for JavaScript API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
- Python
-
- SDK for Python (Boto3)
-
class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def delete_image_set(self, datastore_id, image_set_id): """ Delete an image set. :param datastore_id: The ID of the data store. :param image_set_id: The ID of the image set. :return: The delete results. """ try: delete_results = self.health_imaging_client.delete_image_set( imageSetId=image_set_id, datastoreId=datastore_id ) except ClientError as err: logger.error( "Couldn't delete image set. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return delete_results
The following code instantiates the MedicalImagingWrapper object.
client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
-
For API details, see DeleteImageSet in AWS SDK for Python (Boto3) API Reference.
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. -
Example availability
Can't find what you need? Request a code example using the Provide feedback link on the right sidebar of this page.