Usare SearchImageSets con un AWS SDK o CLI - Esempi di codice dell'AWS SDK

Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples GitHub .

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Usare SearchImageSets con un AWS SDK o CLI

I seguenti esempi di codice mostrano come utilizzareSearchImageSets.

Gli esempi di operazioni sono estratti di codice da programmi più grandi e devono essere eseguiti nel contesto. È possibile visualizzare questa operazione nel contesto nel seguente esempio di codice:

C++
SDKper C++

La funzione di utilità per la ricerca di set di immagini.

//! Routine which searches for image sets based on defined input attributes. /*! \param dataStoreID: The HealthImaging data store ID. \param searchCriteria: A search criteria instance. \param imageSetResults: Vector to receive the image set IDs. \param clientConfig: Aws client configuration. \return bool: Function succeeded. */ bool AwsDoc::Medical_Imaging::searchImageSets(const Aws::String &dataStoreID, const Aws::MedicalImaging::Model::SearchCriteria &searchCriteria, Aws::Vector<Aws::String> &imageSetResults, const Aws::Client::ClientConfiguration &clientConfig) { Aws::MedicalImaging::MedicalImagingClient client(clientConfig); Aws::MedicalImaging::Model::SearchImageSetsRequest request; request.SetDatastoreId(dataStoreID); request.SetSearchCriteria(searchCriteria); Aws::String nextToken; // Used for paginated results. bool result = true; do { if (!nextToken.empty()) { request.SetNextToken(nextToken); } Aws::MedicalImaging::Model::SearchImageSetsOutcome outcome = client.SearchImageSets( request); if (outcome.IsSuccess()) { for (auto &imageSetMetadataSummary: outcome.GetResult().GetImageSetsMetadataSummaries()) { imageSetResults.push_back(imageSetMetadataSummary.GetImageSetId()); } nextToken = outcome.GetResult().GetNextToken(); } else { std::cout << "Error: " << outcome.GetError().GetMessage() << std::endl; result = false; } } while (!nextToken.empty()); return result; }

Caso d'uso #1: EQUAL operatore.

Aws::Vector<Aws::String> imageIDsForPatientID; Aws::MedicalImaging::Model::SearchCriteria searchCriteriaEqualsPatientID; Aws::Vector<Aws::MedicalImaging::Model::SearchFilter> patientIDSearchFilters = { Aws::MedicalImaging::Model::SearchFilter().WithOperator(Aws::MedicalImaging::Model::Operator::EQUAL) .WithValues({Aws::MedicalImaging::Model::SearchByAttributeValue().WithDICOMPatientId(patientID)}) }; searchCriteriaEqualsPatientID.SetFilters(patientIDSearchFilters); bool result = AwsDoc::Medical_Imaging::searchImageSets(dataStoreID, searchCriteriaEqualsPatientID, imageIDsForPatientID, clientConfig); if (result) { std::cout << imageIDsForPatientID.size() << " image sets found for the patient with ID '" << patientID << "'." << std::endl; for (auto &imageSetResult : imageIDsForPatientID) { std::cout << " Image set with ID '" << imageSetResult << std::endl; } }

Caso d'uso #2: BETWEEN operatore che utilizza DICOMStudyDate andDICOMStudyTime.

Aws::MedicalImaging::Model::SearchByAttributeValue useCase2StartDate; useCase2StartDate.SetDICOMStudyDateAndTime(Aws::MedicalImaging::Model::DICOMStudyDateAndTime() .WithDICOMStudyDate("19990101") .WithDICOMStudyTime("000000.000")); Aws::MedicalImaging::Model::SearchByAttributeValue useCase2EndDate; useCase2EndDate.SetDICOMStudyDateAndTime(Aws::MedicalImaging::Model::DICOMStudyDateAndTime() .WithDICOMStudyDate(Aws::Utils::DateTime(std::chrono::system_clock::now()).ToLocalTimeString("%Y%m%d")) .WithDICOMStudyTime("000000.000")); Aws::MedicalImaging::Model::SearchFilter useCase2SearchFilter; useCase2SearchFilter.SetValues({useCase2StartDate, useCase2EndDate}); useCase2SearchFilter.SetOperator(Aws::MedicalImaging::Model::Operator::BETWEEN); Aws::MedicalImaging::Model::SearchCriteria useCase2SearchCriteria; useCase2SearchCriteria.SetFilters({useCase2SearchFilter}); Aws::Vector<Aws::String> usesCase2Results; result = AwsDoc::Medical_Imaging::searchImageSets(dataStoreID, useCase2SearchCriteria, usesCase2Results, clientConfig); if (result) { std::cout << usesCase2Results.size() << " image sets found for between 1999/01/01 and present." << std::endl; for (auto &imageSetResult : usesCase2Results) { std::cout << " Image set with ID '" << imageSetResult << std::endl; } }

Caso d'uso #3: BETWEEN operatore che utilizzacreatedAt. Gli studi sul tempo erano stati precedentemente proseguiti.

Aws::MedicalImaging::Model::SearchByAttributeValue useCase3StartDate; useCase3StartDate.SetCreatedAt(Aws::Utils::DateTime("20231130T000000000Z",Aws::Utils::DateFormat::ISO_8601_BASIC)); Aws::MedicalImaging::Model::SearchByAttributeValue useCase3EndDate; useCase3EndDate.SetCreatedAt(Aws::Utils::DateTime(std::chrono::system_clock::now())); Aws::MedicalImaging::Model::SearchFilter useCase3SearchFilter; useCase3SearchFilter.SetValues({useCase3StartDate, useCase3EndDate}); useCase3SearchFilter.SetOperator(Aws::MedicalImaging::Model::Operator::BETWEEN); Aws::MedicalImaging::Model::SearchCriteria useCase3SearchCriteria; useCase3SearchCriteria.SetFilters({useCase3SearchFilter}); Aws::Vector<Aws::String> usesCase3Results; result = AwsDoc::Medical_Imaging::searchImageSets(dataStoreID, useCase3SearchCriteria, usesCase3Results, clientConfig); if (result) { std::cout << usesCase3Results.size() << " image sets found for created between 2023/11/30 and present." << std::endl; for (auto &imageSetResult : usesCase3Results) { std::cout << " Image set with ID '" << imageSetResult << std::endl; } }

Caso d'uso #4: EQUAL operatore acceso DICOMSeriesInstanceUID updatedAt e BETWEEN ordina la risposta in ASC ordine sul updatedAt campo.

Aws::MedicalImaging::Model::SearchByAttributeValue useCase4StartDate; useCase4StartDate.SetUpdatedAt(Aws::Utils::DateTime("20231130T000000000Z",Aws::Utils::DateFormat::ISO_8601_BASIC)); Aws::MedicalImaging::Model::SearchByAttributeValue useCase4EndDate; useCase4EndDate.SetUpdatedAt(Aws::Utils::DateTime(std::chrono::system_clock::now())); Aws::MedicalImaging::Model::SearchFilter useCase4SearchFilterBetween; useCase4SearchFilterBetween.SetValues({useCase4StartDate, useCase4EndDate}); useCase4SearchFilterBetween.SetOperator(Aws::MedicalImaging::Model::Operator::BETWEEN); Aws::MedicalImaging::Model::SearchByAttributeValue seriesInstanceUID; seriesInstanceUID.SetDICOMSeriesInstanceUID(dicomSeriesInstanceUID); Aws::MedicalImaging::Model::SearchFilter useCase4SearchFilterEqual; useCase4SearchFilterEqual.SetValues({seriesInstanceUID}); useCase4SearchFilterEqual.SetOperator(Aws::MedicalImaging::Model::Operator::EQUAL); Aws::MedicalImaging::Model::SearchCriteria useCase4SearchCriteria; useCase4SearchCriteria.SetFilters({useCase4SearchFilterBetween, useCase4SearchFilterEqual}); Aws::MedicalImaging::Model::Sort useCase4Sort; useCase4Sort.SetSortField(Aws::MedicalImaging::Model::SortField::updatedAt); useCase4Sort.SetSortOrder(Aws::MedicalImaging::Model::SortOrder::ASC); useCase4SearchCriteria.SetSort(useCase4Sort); Aws::Vector<Aws::String> usesCase4Results; result = AwsDoc::Medical_Imaging::searchImageSets(dataStoreID, useCase4SearchCriteria, usesCase4Results, clientConfig); if (result) { std::cout << usesCase4Results.size() << " image sets found for EQUAL operator " << "on DICOMSeriesInstanceUID and BETWEEN on updatedAt and sort response\n" << "in ASC order on updatedAt field." << std::endl; for (auto &imageSetResult : usesCase4Results) { std::cout << " Image set with ID '" << imageSetResult << std::endl; } }
  • Per API i dettagli, vedere SearchImageSetsin AWS SDK for C++ APIRiferimento.

Nota

C'è altro da sapere GitHub. Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice AWS.

CLI
AWS CLI

Esempio 1: Per cercare set di immagini con un EQUAL operatore

Il seguente esempio di search-image-sets codice utilizza l'EQUALoperatore per cercare set di immagini in base a un valore specifico.

aws medical-imaging search-image-sets \ --datastore-id 12345678901234567890123456789012 \ --search-criteria file://search-criteria.json

Contenuto di search-criteria.json

{ "filters": [{ "values": [{"DICOMPatientId" : "SUBJECT08701"}], "operator": "EQUAL" }] }

Output:

{ "imageSetsMetadataSummaries": [{ "imageSetId": "09876543210987654321098765432109", "createdAt": "2022-12-06T21:40:59.429000+00:00", "version": 1, "DICOMTags": { "DICOMStudyId": "2011201407", "DICOMStudyDate": "19991122", "DICOMPatientSex": "F", "DICOMStudyInstanceUID": "1.2.840.99999999.84710745.943275268089", "DICOMPatientBirthDate": "19201120", "DICOMStudyDescription": "UNKNOWN", "DICOMPatientId": "SUBJECT08701", "DICOMPatientName": "Melissa844 Huel628", "DICOMNumberOfStudyRelatedInstances": 1, "DICOMStudyTime": "140728", "DICOMNumberOfStudyRelatedSeries": 1 }, "updatedAt": "2022-12-06T21:40:59.429000+00:00" }] }

Esempio 2: Per cercare set di immagini con un BETWEEN operatore utilizzando DICOMStudyDate e DICOMStudyTime

Il seguente esempio di search-image-sets codice cerca set di immagini con DICOM studi generati tra il 1° gennaio 1990 (00:00) e il 1° gennaio 2023 (00:00).

Nota: DICOMStudyTime è facoltativo. Se non è presente, 12:00 AM (inizio giornata) è il valore temporale per le date fornite per il filtraggio.

aws medical-imaging search-image-sets \ --datastore-id 12345678901234567890123456789012 \ --search-criteria file://search-criteria.json

Contenuto di search-criteria.json

{ "filters": [{ "values": [{ "DICOMStudyDateAndTime": { "DICOMStudyDate": "19900101", "DICOMStudyTime": "000000" } }, { "DICOMStudyDateAndTime": { "DICOMStudyDate": "20230101", "DICOMStudyTime": "000000" } }], "operator": "BETWEEN" }] }

Output:

{ "imageSetsMetadataSummaries": [{ "imageSetId": "09876543210987654321098765432109", "createdAt": "2022-12-06T21:40:59.429000+00:00", "version": 1, "DICOMTags": { "DICOMStudyId": "2011201407", "DICOMStudyDate": "19991122", "DICOMPatientSex": "F", "DICOMStudyInstanceUID": "1.2.840.99999999.84710745.943275268089", "DICOMPatientBirthDate": "19201120", "DICOMStudyDescription": "UNKNOWN", "DICOMPatientId": "SUBJECT08701", "DICOMPatientName": "Melissa844 Huel628", "DICOMNumberOfStudyRelatedInstances": 1, "DICOMStudyTime": "140728", "DICOMNumberOfStudyRelatedSeries": 1 }, "updatedAt": "2022-12-06T21:40:59.429000+00:00" }] }

Esempio 3: per cercare set di immagini con un BETWEEN operatore utilizzando createdAt (gli studi temporali erano precedentemente persistenti)

Il seguente esempio di search-image-sets codice cerca set di immagini con DICOM gli studi persistenti HealthImaging tra gli intervalli di tempo del fuso orario. UTC

Nota: fornite un createdAt formato di esempio («1985-04-12T 23:20:50.52 Z»).

aws medical-imaging search-image-sets \ --datastore-id 12345678901234567890123456789012 \ --search-criteria file://search-criteria.json

Contenuto di search-criteria.json

{ "filters": [{ "values": [{ "createdAt": "1985-04-12T23:20:50.52Z" }, { "createdAt": "2022-04-12T23:20:50.52Z" }], "operator": "BETWEEN" }] }

Output:

{ "imageSetsMetadataSummaries": [{ "imageSetId": "09876543210987654321098765432109", "createdAt": "2022-12-06T21:40:59.429000+00:00", "version": 1, "DICOMTags": { "DICOMStudyId": "2011201407", "DICOMStudyDate": "19991122", "DICOMPatientSex": "F", "DICOMStudyInstanceUID": "1.2.840.99999999.84710745.943275268089", "DICOMPatientBirthDate": "19201120", "DICOMStudyDescription": "UNKNOWN", "DICOMPatientId": "SUBJECT08701", "DICOMPatientName": "Melissa844 Huel628", "DICOMNumberOfStudyRelatedInstances": 1, "DICOMStudyTime": "140728", "DICOMNumberOfStudyRelatedSeries": 1 }, "lastUpdatedAt": "2022-12-06T21:40:59.429000+00:00" }] }

Esempio 4: per cercare set di immagini con un EQUAL operatore attivo e attivo DICOMSeriesInstanceUID e ordinare le risposte in ordine sul campo BETWEEN updatedAt ASC updatedAt

Il seguente esempio di search-image-sets codice cerca i set di immagini con un EQUAL operatore on DICOMSeriesInstanceUID e BETWEEN on updatedAt e ordina la risposta in ASC ordine sul updatedAt campo.

Nota: fornite un updatedAt formato di esempio («1985-04-12T 23:20:50.52 Z»).

aws medical-imaging search-image-sets \ --datastore-id 12345678901234567890123456789012 \ --search-criteria file://search-criteria.json

Contenuto di search-criteria.json

{ "filters": [{ "values": [{ "updatedAt": "2024-03-11T15:00:05.074000-07:00" }, { "updatedAt": "2024-03-11T16:00:05.074000-07:00" }], "operator": "BETWEEN" }, { "values": [{ "DICOMSeriesInstanceUID": "1.2.840.99999999.84710745.943275268089" }], "operator": "EQUAL" }], "sort": { "sortField": "updatedAt", "sortOrder": "ASC" } }

Output:

{ "imageSetsMetadataSummaries": [{ "imageSetId": "09876543210987654321098765432109", "createdAt": "2022-12-06T21:40:59.429000+00:00", "version": 1, "DICOMTags": { "DICOMStudyId": "2011201407", "DICOMStudyDate": "19991122", "DICOMPatientSex": "F", "DICOMStudyInstanceUID": "1.2.840.99999999.84710745.943275268089", "DICOMPatientBirthDate": "19201120", "DICOMStudyDescription": "UNKNOWN", "DICOMPatientId": "SUBJECT08701", "DICOMPatientName": "Melissa844 Huel628", "DICOMNumberOfStudyRelatedInstances": 1, "DICOMStudyTime": "140728", "DICOMNumberOfStudyRelatedSeries": 1 }, "lastUpdatedAt": "2022-12-06T21:40:59.429000+00:00" }] }

Per ulteriori informazioni, consulta Searching image sets nella Developer Guide.AWS HealthImaging

Java
SDKper Java 2.x

La funzione di utilità per la ricerca di set di immagini.

public static List<ImageSetsMetadataSummary> searchMedicalImagingImageSets( MedicalImagingClient medicalImagingClient, String datastoreId, SearchCriteria searchCriteria) { try { SearchImageSetsRequest datastoreRequest = SearchImageSetsRequest.builder() .datastoreId(datastoreId) .searchCriteria(searchCriteria) .build(); SearchImageSetsIterable responses = medicalImagingClient .searchImageSetsPaginator(datastoreRequest); List<ImageSetsMetadataSummary> imageSetsMetadataSummaries = new ArrayList<>(); responses.stream().forEach(response -> imageSetsMetadataSummaries .addAll(response.imageSetsMetadataSummaries())); return imageSetsMetadataSummaries; } catch (MedicalImagingException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } return null; }

Caso d'uso #1: EQUAL operatore.

List<SearchFilter> searchFilters = Collections.singletonList(SearchFilter.builder() .operator(Operator.EQUAL) .values(SearchByAttributeValue.builder() .dicomPatientId(patientId) .build()) .build()); SearchCriteria searchCriteria = SearchCriteria.builder() .filters(searchFilters) .build(); List<ImageSetsMetadataSummary> imageSetsMetadataSummaries = searchMedicalImagingImageSets( medicalImagingClient, datastoreId, searchCriteria); if (imageSetsMetadataSummaries != null) { System.out.println("The image sets for patient " + patientId + " are:\n" + imageSetsMetadataSummaries); System.out.println(); }

Caso d'uso #2: BETWEEN operatore che utilizza DICOMStudyDate andDICOMStudyTime.

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); searchFilters = Collections.singletonList(SearchFilter.builder() .operator(Operator.BETWEEN) .values(SearchByAttributeValue.builder() .dicomStudyDateAndTime(DICOMStudyDateAndTime.builder() .dicomStudyDate("19990101") .dicomStudyTime("000000.000") .build()) .build(), SearchByAttributeValue.builder() .dicomStudyDateAndTime(DICOMStudyDateAndTime.builder() .dicomStudyDate((LocalDate.now() .format(formatter))) .dicomStudyTime("000000.000") .build()) .build()) .build()); searchCriteria = SearchCriteria.builder() .filters(searchFilters) .build(); imageSetsMetadataSummaries = searchMedicalImagingImageSets(medicalImagingClient, datastoreId, searchCriteria); if (imageSetsMetadataSummaries != null) { System.out.println( "The image sets searched with BETWEEN operator using DICOMStudyDate and DICOMStudyTime are:\n" + imageSetsMetadataSummaries); System.out.println(); }

Caso d'uso #3: BETWEEN operatore che utilizzacreatedAt. Gli studi sul tempo erano stati precedentemente proseguiti.

searchFilters = Collections.singletonList(SearchFilter.builder() .operator(Operator.BETWEEN) .values(SearchByAttributeValue.builder() .createdAt(Instant.parse("1985-04-12T23:20:50.52Z")) .build(), SearchByAttributeValue.builder() .createdAt(Instant.now()) .build()) .build()); searchCriteria = SearchCriteria.builder() .filters(searchFilters) .build(); imageSetsMetadataSummaries = searchMedicalImagingImageSets(medicalImagingClient, datastoreId, searchCriteria); if (imageSetsMetadataSummaries != null) { System.out.println("The image sets searched with BETWEEN operator using createdAt are:\n " + imageSetsMetadataSummaries); System.out.println(); }

Caso d'uso #4: EQUAL operatore acceso DICOMSeriesInstanceUID updatedAt e BETWEEN ordina la risposta in ASC ordine sul updatedAt campo.

Instant startDate = Instant.parse("1985-04-12T23:20:50.52Z"); Instant endDate = Instant.now(); searchFilters = Arrays.asList( SearchFilter.builder() .operator(Operator.EQUAL) .values(SearchByAttributeValue.builder() .dicomSeriesInstanceUID(seriesInstanceUID) .build()) .build(), SearchFilter.builder() .operator(Operator.BETWEEN) .values( SearchByAttributeValue.builder().updatedAt(startDate).build(), SearchByAttributeValue.builder().updatedAt(endDate).build() ).build()); Sort sort = Sort.builder().sortOrder(SortOrder.ASC).sortField(SortField.UPDATED_AT).build(); searchCriteria = SearchCriteria.builder() .filters(searchFilters) .sort(sort) .build(); imageSetsMetadataSummaries = searchMedicalImagingImageSets(medicalImagingClient, datastoreId, searchCriteria); if (imageSetsMetadataSummaries != null) { System.out.println("The image sets searched with EQUAL operator on DICOMSeriesInstanceUID and BETWEEN on updatedAt and sort response\n" + "in ASC order on updatedAt field are:\n " + imageSetsMetadataSummaries); System.out.println(); }
  • Per API i dettagli, vedere SearchImageSetsin AWS SDK for Java 2.x APIRiferimento.

Nota

C'è altro da sapere GitHub. Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice AWS.

JavaScript
SDKper JavaScript (v3)

La funzione di utilità per la ricerca di set di immagini.

import { paginateSearchImageSets } from "@aws-sdk/client-medical-imaging"; import { medicalImagingClient } from "../libs/medicalImagingClient.js"; /** * @param {string} datastoreId - The data store's ID. * @param { import('@aws-sdk/client-medical-imaging').SearchFilter[] } filters - The search criteria filters. * @param { import('@aws-sdk/client-medical-imaging').Sort } sort - The search criteria sort. */ export const searchImageSets = async ( datastoreId = "xxxxxxxx", searchCriteria = {}, ) => { const paginatorConfig = { client: medicalImagingClient, pageSize: 50, }; const commandParams = { datastoreId: datastoreId, searchCriteria: searchCriteria, }; const paginator = paginateSearchImageSets(paginatorConfig, commandParams); const imageSetsMetadataSummaries = []; for await (const page of paginator) { // Each page contains a list of `jobSummaries`. The list is truncated if is larger than `pageSize`. imageSetsMetadataSummaries.push(...page.imageSetsMetadataSummaries); console.log(page); } // { // '$metadata': { // httpStatusCode: 200, // requestId: 'f009ea9c-84ca-4749-b5b6-7164f00a5ada', // extendedRequestId: undefined, // cfId: undefined, // attempts: 1, // totalRetryDelay: 0 // }, // imageSetsMetadataSummaries: [ // { // DICOMTags: [Object], // createdAt: "2023-09-19T16:59:40.551Z", // imageSetId: '7f75e1b5c0f40eac2b24cf712f485f50', // updatedAt: "2023-09-19T16:59:40.551Z", // version: 1 // }] // } return imageSetsMetadataSummaries; };

Caso d'uso #1: EQUAL operatore.

const datastoreId = "12345678901234567890123456789012"; try { const searchCriteria = { filters: [ { values: [{ DICOMPatientId: "1234567" }], operator: "EQUAL", }, ], }; await searchImageSets(datastoreId, searchCriteria); } catch (err) { console.error(err); }

Caso d'uso #2: BETWEEN operatore che utilizza DICOMStudyDate andDICOMStudyTime.

const datastoreId = "12345678901234567890123456789012"; try { const searchCriteria = { filters: [ { values: [ { DICOMStudyDateAndTime: { DICOMStudyDate: "19900101", DICOMStudyTime: "000000", }, }, { DICOMStudyDateAndTime: { DICOMStudyDate: "20230901", DICOMStudyTime: "000000", }, }, ], operator: "BETWEEN", }, ], }; await searchImageSets(datastoreId, searchCriteria); } catch (err) { console.error(err); }

Caso d'uso #3: BETWEEN operatore che utilizzacreatedAt. Gli studi sul tempo erano stati precedentemente proseguiti.

const datastoreId = "12345678901234567890123456789012"; try { const searchCriteria = { filters: [ { values: [ { createdAt: new Date("1985-04-12T23:20:50.52Z") }, { createdAt: new Date() }, ], operator: "BETWEEN", }, ], }; await searchImageSets(datastoreId, searchCriteria); } catch (err) { console.error(err); }

Caso d'uso #4: EQUAL operatore acceso DICOMSeriesInstanceUID updatedAt e BETWEEN ordina la risposta in ASC ordine sul updatedAt campo.

const datastoreId = "12345678901234567890123456789012"; try { const searchCriteria = { filters: [ { values: [ { updatedAt: new Date("1985-04-12T23:20:50.52Z") }, { updatedAt: new Date() }, ], operator: "BETWEEN", }, { values: [ { DICOMSeriesInstanceUID: "1.1.123.123456.1.12.1.1234567890.1234.12345678.123", }, ], operator: "EQUAL", }, ], sort: { sortOrder: "ASC", sortField: "updatedAt", }, }; await searchImageSets(datastoreId, searchCriteria); } catch (err) { console.error(err); }
  • Per API i dettagli, vedere SearchImageSetsin AWS SDK for JavaScript APIRiferimento.

Nota

C'è altro da sapere GitHub. Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice AWS.

Python
SDKper Python (Boto3)

La funzione di utilità per la ricerca di set di immagini.

class MedicalImagingWrapper: def __init__(self, health_imaging_client): self.health_imaging_client = health_imaging_client def search_image_sets(self, datastore_id, search_filter): """ Search for image sets. :param datastore_id: The ID of the data store. :param search_filter: The search filter. For example: {"filters" : [{ "operator": "EQUAL", "values": [{"DICOMPatientId": "3524578"}]}]}. :return: The list of image sets. """ try: paginator = self.health_imaging_client.get_paginator("search_image_sets") page_iterator = paginator.paginate( datastoreId=datastore_id, searchCriteria=search_filter ) metadata_summaries = [] for page in page_iterator: metadata_summaries.extend(page["imageSetsMetadataSummaries"]) except ClientError as err: logger.error( "Couldn't search image sets. Here's why: %s: %s", err.response["Error"]["Code"], err.response["Error"]["Message"], ) raise else: return metadata_summaries

Caso d'uso #1: EQUAL operatore.

search_filter = { "filters": [ {"operator": "EQUAL", "values": [{"DICOMPatientId": patient_id}]} ] } image_sets = self.search_image_sets(data_store_id, search_filter) print(f"Image sets found with EQUAL operator\n{image_sets}")

Caso d'uso #2: BETWEEN operatore che utilizza DICOMStudyDate andDICOMStudyTime.

search_filter = { "filters": [ { "operator": "BETWEEN", "values": [ { "DICOMStudyDateAndTime": { "DICOMStudyDate": "19900101", "DICOMStudyTime": "000000", } }, { "DICOMStudyDateAndTime": { "DICOMStudyDate": "20230101", "DICOMStudyTime": "000000", } }, ], } ] } image_sets = self.search_image_sets(data_store_id, search_filter) print( f"Image sets found with BETWEEN operator using DICOMStudyDate and DICOMStudyTime\n{image_sets}" )

Caso d'uso #3: BETWEEN operatore che utilizzacreatedAt. Gli studi sul tempo erano stati precedentemente proseguiti.

search_filter = { "filters": [ { "values": [ { "createdAt": datetime.datetime( 2021, 8, 4, 14, 49, 54, 429000 ) }, { "createdAt": datetime.datetime.now() + datetime.timedelta(days=1) }, ], "operator": "BETWEEN", } ] } recent_image_sets = self.search_image_sets(data_store_id, search_filter) print( f"Image sets found with with BETWEEN operator using createdAt\n{recent_image_sets}" )

Caso d'uso #4: EQUAL operatore acceso DICOMSeriesInstanceUID updatedAt e BETWEEN ordina la risposta in ASC ordine sul updatedAt campo.

search_filter = { "filters": [ { "values": [ { "updatedAt": datetime.datetime( 2021, 8, 4, 14, 49, 54, 429000 ) }, { "updatedAt": datetime.datetime.now() + datetime.timedelta(days=1) }, ], "operator": "BETWEEN", }, { "values": [{"DICOMSeriesInstanceUID": series_instance_uid}], "operator": "EQUAL", }, ], "sort": { "sortOrder": "ASC", "sortField": "updatedAt", }, } image_sets = self.search_image_sets(data_store_id, search_filter) print( "Image sets found with EQUAL operator on DICOMSeriesInstanceUID and BETWEEN on updatedAt and" ) print(f"sort response in ASC order on updatedAt field\n{image_sets}")

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

client = boto3.client("medical-imaging") medical_imaging_wrapper = MedicalImagingWrapper(client)
  • Per API i dettagli, vedere SearchImageSetsPython (Boto3) Reference.AWS SDK API

Nota

C'è di più su. GitHub Trova l'esempio completo e scopri di più sulla configurazione e l'esecuzione nel Repository di esempi di codice AWS.