use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores.Studies.Series.Instances in project java-docs-samples by GoogleCloudPlatform.
the class DicomWebRetrieveInstance method dicomWebRetrieveInstance.
public static void dicomWebRetrieveInstance(String dicomStoreName, String dicomWebPath) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// String dicomWebPath = String.format(DICOMWEB_PATH, "your-study-id", "your-series-id",
// "your-instance-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
Instances.RetrieveInstance request = client.projects().locations().datasets().dicomStores().studies().series().instances().retrieveInstance(dicomStoreName, dicomWebPath);
// Execute the request and process the results.
HttpResponse response = request.executeUnparsed();
String outputPath = "instance.dcm";
OutputStream outputStream = new FileOutputStream(new File(outputPath));
try {
response.download(outputStream);
System.out.println("DICOM instance written to file " + outputPath);
} finally {
outputStream.close();
}
if (!response.isSuccessStatusCode()) {
System.err.print(String.format("Exception retrieving DICOM instance: %s\n", response.getStatusMessage()));
throw new RuntimeException();
}
}
use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores.Studies.Series.Instances in project java-docs-samples by GoogleCloudPlatform.
the class DicomWebRetrieveRendered method dicomWebRetrieveRendered.
public static void dicomWebRetrieveRendered(String dicomStoreName, String dicomWebPath) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// String dicomWebPath = String.format(DICOMWEB_PATH, "your-study-id", "your-series-id",
// "your-instance-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
Instances.RetrieveRendered request = client.projects().locations().datasets().dicomStores().studies().series().instances().retrieveRendered(dicomStoreName, dicomWebPath);
// Execute the request and process the results.
HttpResponse response = request.executeUnparsed();
String outputPath = "image.png";
OutputStream outputStream = new FileOutputStream(new File(outputPath));
try {
response.download(outputStream);
System.out.println("DICOM rendered PNG image written to file " + outputPath);
} finally {
outputStream.close();
}
if (!response.isSuccessStatusCode()) {
System.err.print(String.format("Exception retrieving DICOM rendered image: %s\n", response.getStatusMessage()));
throw new RuntimeException();
}
}
use of com.google.api.services.healthcare.v1.CloudHealthcare.Projects.Locations.Datasets.DicomStores.Studies.Series.Instances in project java-docs-samples by GoogleCloudPlatform.
the class DicomWebSearchForInstances method dicomWebSearchForInstances.
public static void dicomWebSearchForInstances(String dicomStoreName) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Create request and configure any parameters.
DicomStores.SearchForInstances request = client.projects().locations().datasets().dicomStores().searchForInstances(dicomStoreName, "instances");
// Execute the request and process the results.
HttpResponse response = request.executeUnparsed();
System.out.println("Dicom store instances found: \n" + response.toString());
}
Aggregations