use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DatasetPatch method datasetPatch.
public static void datasetPatch(String datasetName) throws IOException {
// String datasetName =
// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Fetch the initial state of the dataset.
Datasets.Get getRequest = client.projects().locations().datasets().get(datasetName);
Dataset dataset = getRequest.execute();
// Update the Dataset fields as needed as needed. For a full list of dataset fields, see:
// https://cloud.google.com/healthcare/docs/reference/rest/v1beta1/projects.locations.datasets#Dataset
dataset.setTimeZone("America/New_York");
// Create request and configure any parameters.
Datasets.Patch request = client.projects().locations().datasets().patch(datasetName, dataset).setUpdateMask("timeZone");
// Execute the request and process the results.
dataset = request.execute();
System.out.println("Dataset patched: \n" + dataset.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DatasetSetIamPolicy method datasetSetIamPolicy.
public static void datasetSetIamPolicy(String datasetName) throws IOException {
// String datasetName =
// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure the IAMPolicy to apply to the dataset.
// For more information on understanding IAM roles, see the following:
// https://cloud.google.com/iam/docs/understanding-roles
Binding binding = new Binding().setRole("roles/healthcare.datasetViewer").setMembers(Arrays.asList("domain:google.com"));
Policy policy = new Policy().setBindings(Arrays.asList(binding));
SetIamPolicyRequest policyRequest = new SetIamPolicyRequest().setPolicy(policy);
// Create request and configure any parameters.
Datasets.SetIamPolicy request = client.projects().locations().datasets().setIamPolicy(datasetName, policyRequest);
// Execute the request and process the results.
Policy updatedPolicy = request.execute();
System.out.println("Dataset policy has been updated: " + updatedPolicy.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DicomStoreCreate method dicomStoreCreate.
public static void dicomStoreCreate(String datasetName, String dicomStoreId) throws IOException {
// String datasetName =
// String.format(DATASET_NAME, "your-project-id", "your-region-id", "your-dataset-id");
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure the dicomStore to be created.
Map<String, String> labels = new HashMap<String, String>();
labels.put("key1", "value1");
labels.put("key2", "value2");
DicomStore content = new DicomStore().setLabels(labels);
// Create request and configure any parameters.
DicomStores.Create request = client.projects().locations().datasets().dicomStores().create(datasetName, content).setDicomStoreId(dicomStoreId);
// Execute the request and process the results.
DicomStore response = request.execute();
System.out.println("DICOM store created: " + response.toPrettyString());
}
use of com.google.api.services.healthcare.v1.model.Dataset in project java-docs-samples by GoogleCloudPlatform.
the class DicomStoreExport method dicomStoreExport.
public static void dicomStoreExport(String dicomStoreName, String gcsUri) throws IOException {
// String dicomStoreName =
// String.format(
// DICOM_NAME, "your-project-id", "your-region-id", "your-dataset-id", "your-dicom-id");
// String gcsUri = "gs://your-bucket-id/path/to/destination/dir"
// Initialize the client, which will be used to interact with the service.
CloudHealthcare client = createClient();
// Configure where the store will be exported too.
GoogleCloudHealthcareV1DicomGcsDestination gcsDestination = new GoogleCloudHealthcareV1DicomGcsDestination().setUriPrefix(gcsUri);
ExportDicomDataRequest exportRequest = new ExportDicomDataRequest().setGcsDestination(gcsDestination);
// Create request and configure any parameters.
DicomStores.Export request = client.projects().locations().datasets().dicomStores().export(dicomStoreName, exportRequest);
// Execute the request, wait for the operation to complete, and process the results.
try {
Operation operation = request.execute();
while (operation.getDone() == null || !operation.getDone()) {
// Update the status of the operation with another request.
// Pause for 500ms between requests.
Thread.sleep(500);
operation = client.projects().locations().datasets().operations().get(operation.getName()).execute();
}
System.out.println("DICOM store export complete." + operation.getResponse());
} catch (Exception ex) {
System.out.printf("Error during request execution: %s", ex.toString());
ex.printStackTrace(System.out);
}
}
use of com.google.api.services.healthcare.v1.model.Dataset 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