You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/healthcare-apis/dicom/dicomweb-standard-apis-curl.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
title: Use cURL and DICOMweb Standard APIs in Azure Health Data Services
3
3
description: Use cURL and DICOMweb Standard APIs to store, retrieve, search, and delete DICOM files in the DICOM service.
4
-
author: mmitrik
4
+
author: varunbms
5
5
ms.service: azure-health-data-services
6
6
ms.subservice: dicom-service
7
7
ms.topic: tutorial
8
8
ms.date: 10/18/2023
9
-
ms.author: mmitrik
9
+
ms.author: varunbms
10
10
---
11
11
12
12
# Use DICOMweb Standard APIs with cURL
@@ -49,11 +49,11 @@ For this code, we access a Public Preview Azure service. It's important that you
49
49
50
50
The DICOMweb Standard makes heavy use of `multipart/related` HTTP requests combined with DICOM specific accept headers. Developers familiar with other REST-based APIs often find working with the DICOMweb Standard awkward. However, after you get it up and running, it's easy to use. It just takes a little familiarity to get started.
51
51
52
-
The cURL commands each contain at least one, and sometimes two, variables that must be replaced. To simplify running the commands, search and replace the following variables by replacing them with your specific values:
52
+
The cURL commands each contain at least one, and sometimes two, variables that must be replaced. To simplify running the commands, search and replace the following variables your specific values.
53
53
54
54
* {Service URL} The service URL is the URL to access your DICOM service that you provisioned in the Azure portal, for example, ```https://<workspacename-dicomservicename>.dicom.azurehealthcareapis.com```. Make sure to specify the version as part of the url when making requests. More information can be found in the [API Versioning for DICOM service Documentation](api-versioning-dicom-service.md).
55
55
* {path-to-dicoms} - The path to the directory that contains the red-triangle.dcm file, such as `C:/dicom-server/docs/dcms`
56
-
* Ensure to use forward slashes as separators and end the directory _without_ a trailing forward slash.
56
+
* Ensure using forward slashes as separators and end the directory _without_ a trailing forward slash.
57
57
58
58
59
59
## Upload DICOM instances (STOW)
@@ -76,7 +76,7 @@ _Details:_
76
76
* Body:
77
77
* Content-Type: application/dicom for each file uploaded, separated by a boundary value
78
78
79
-
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those tools, you might need to use a slightly modified Content-Type header. These tools can be used successfully.
79
+
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those tools, you might need to use a slightly modified Content-Type header. The following tools can be used successfully.
* Content-Type: application/dicom for each file uploaded, separated by a boundary value
106
106
107
-
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those languages and tools, you might need to use a slightly modified Content-Type header. These tools can be used successfully.
107
+
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those languages and tools, you might need to use a slightly modified Content-Type header. The following tools can be used successfully.
* Content-Type: application/dicom for each file uploaded, separated by a boundary value
161
161
162
-
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those tools, you might need to use a slightly modified Content-Type header. These tools can be used successfully:
162
+
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those tools, you might need to use a slightly modified Content-Type header. The following tools can be used successfully.
* Content-Type: application/dicom for each file uploaded, separated by a boundary value
190
190
191
-
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those languages and tools, you might need to use a slightly modified Content-Type header. These tools can be used successfully:
191
+
Some programming languages and tools behave differently. For instance, some require you to define your own boundary. For those languages and tools, you might need to use a slightly modified Content-Type header. The following tools can be used successfully.
@@ -205,9 +205,9 @@ curl --request PUT "{Service URL}/v{version}/studies/1.2.826.0.1.3680043.8.498.1
205
205
### Upsert single instance
206
206
207
207
> [!NOTE]
208
-
> This is a non-standard API that allows the upsert of a single DICOM files.
208
+
> This is a non-standard API that allows the upsert of a single DICOM file.
209
209
210
-
Use this method to upload a single DICOM file:
210
+
Use this method to upload a single DICOM file.
211
211
212
212
_Details:_
213
213
* Path: ../studies
@@ -342,7 +342,7 @@ curl --request GET "{Service URL}/v{version}/studies/1.2.826.0.1.3680043.8.498.1
342
342
343
343
### Retrieve one or more frames from a single instance
344
344
345
-
This request retrieves one or more frames from a single instance, and returns them as a collection of multipart/related bytes. Multiple frames can be retrieved by passing a comma-separated list of frame numbers. All DICOM instances with images have at minimum one frame, which is often just the image associated with the instance itself.
345
+
This request retrieves one or more frames from a single instance, and returns them as a collection of multipart/related bytes. Multiple frames can be retrieved by passing a comma-separated list of frame numbers. All DICOM instances with images have at minimum one frame, which is often simply the image associated with the instance itself.
> Each of these files represents a single instance and is part of the same study. Also,the green-square and red-triangle are part of the same series, while the blue-circle is in a separate series.
33
+
> Each of these files represents a single instance and is part of the same study. Also,the green-square and red-triangle are part of the same series, while the blue-circle is in a separate series.
`DefaultAzureCredential` allows us to use various ways to get tokens to log into the service. In this example, use the `AzureCliCredential` to get a token to log into the service. There are other credential providers such as `ManagedIdentityCredential` and `EnvironmentCredential` that are also possible to use. To use the AzureCliCredential, you need to sign in to Azure from the CLI before running this code. For more information, see [Get access token for the DICOM service using Azure CLI](dicom-get-access-token-azure-cli.md). Alternatively, copy and paste the token retrieved while signing in from the CLI.
85
+
`DefaultAzureCredential` allows us to use various ways to get tokens to log into the service. In this example, use the `AzureCliCredential` to get a token to log into the service. There are other credential providers such as `ManagedIdentityCredential` and `EnvironmentCredential` that you may use. To use the AzureCliCredential, you need to sign in to Azure from the CLI before running this code. For more information, see [Get access token for the DICOM service using Azure CLI](dicom-get-access-token-azure-cli.md). Alternatively, copy and paste the token retrieved while signing in from the CLI.
86
86
87
87
> [!NOTE]
88
-
> `DefaultAzureCredential` returns several different Credential objects. We reference the `AzureCliCredential` as the 5th item in the returned collection. This may not be consistent. If so, uncomment the `print(credential.credential)` line. This will list all the items. Find the correct index, recalling that Python uses zero-based indexing.
88
+
> `DefaultAzureCredential` returns several different Credential objects. We reference the `AzureCliCredential` as the 5th item in the returned collection. This may not always be the case. If not, uncomment the `print(credential.credential)` line. This will list all the items. Find the correct index, recalling that Python uses zero-based indexing.
89
89
90
90
> [!NOTE]
91
91
> If you have not logged into Azure using the CLI, this will fail. You must be logged into Azure from the CLI for this to work.
The `Requests` libraries (and most Python libraries) don't work with `multipart\related` in a way that supports DICOMweb. Because of these libraries, we must add a few methods to support working with DICOM files.
105
105
106
-
`encode_multipart_related` takes a set of fields (in the DICOM case, these libraries are generally Part 10 dam files) and an optional user-defined boundary. It returns both the full body, along with the content_type, which it can be used.
106
+
`encode_multipart_related` takes a set of fields (in the DICOM case, these libraries are generally Part 10 dam files) and an optional user-defined boundary. It returns both the full body, along with the content_type, which can be used.
@@ -144,7 +144,7 @@ The following examples highlight persisting DICOM files.
144
144
145
145
### Store instances using `multipart/related`
146
146
147
-
This example demonstrates how to upload a single DICOM file, and it uses a bit of a Python to preload the DICOM file (as bytes) into memory. When an array of files is passed to the fields parameter of`encode_multipart_related`, multiple files can be uploaded in a single POST. It's sometimes used to upload several instances inside a complete series or study.
147
+
This example demonstrates how to upload a single DICOM file, and it uses Python to preload the DICOM file into memory as bytes. When an array of files is passed to the fields parameter `encode_multipart_related`, multiple files can be uploaded in a single POST. It's sometimes used to upload several instances inside a complete series or study.
This example demonstrates how to upload multiple DICOM files into the specified study. It uses a bit of a Python to preload the DICOM file (as bytes) into memory.
186
+
This example demonstrates how to upload multiple DICOM files into the specified study. It uses Python to preload the DICOM file into memory as bytes.
187
187
188
-
When an array of files is passed to the fields parameter of `encode_multipart_related`, multiple files can be uploaded in a single POST. It's sometimes used to upload a complete series or study.
188
+
When an array of files is passed to the fields parameter `encode_multipart_related`, multiple files can be uploaded in a single POST. It's sometimes used to upload a complete series or study.
All three of the dcm files that we uploaded previously are part of the same study so the response should return all three instances. Validate that the response has a status code of OK and that all three instances are returned.
267
+
All three of the dcm files that we uploaded previously are part of the same study, so the response should return all three instances. Validate that the response has a status code of OK and that all three instances are returned.
The instances are retrieved as binary bytes. You can loop through the returned items and convert the bytes into a file that `pydicom` can read.
278
+
The instances are retrieved as binary bytes. You can loop through the returned items and convert the bytes into a file that `pydicom` can read as follows.
279
279
280
280
281
281
```python
@@ -345,7 +345,7 @@ _Details:_
345
345
* Accept: application/dicom+json
346
346
* Authorization: Bearer $token"
347
347
348
-
This series has two instances (green-square and red-triangle), so the response should return for both instances. Validate that the response has a status code of OK and that both instances metadata are returned.
348
+
This series has two instances (green-square and red-triangle), so the response should return for both instances. Validate that the response has a status code of OK and that the metadata of both instances are returned.
In the following examples, we search for items using their unique identifiers. You can also search for other attributes, such as PatientName.
422
422
423
-
Refer to the [DICOM Conformance Statement](dicom-services-conformance-statement-v2.md#supported-search-parameters)document for supported DICOM attributes.
423
+
Refer to the [DICOM Conformance Statement](dicom-services-conformance-statement-v2.md#supported-search-parameters) for supported DICOM attributes.
> Delete is not part of the DICOM standard, but it has been added for convenience.
555
555
556
-
A 204 response code is returned when the deletion is successful. A 404 response code is returned if the item(s) never existed or are already deleted.
556
+
A 204 response code is returned when the deletion is successful. A 404 response code is returned if the items never existed or are already deleted.
557
557
558
558
### Delete a specific instance within a study and series
559
559
@@ -565,7 +565,7 @@ _Details:_
565
565
* Headers:
566
566
* Authorization: Bearer $token
567
567
568
-
This request deletes the red-triangle instance from the server. If it's successful, the response status code contains no content.
568
+
This request deletes the red-triangle instance from the server. If successful, the response status code contains no content.
569
569
570
570
```python
571
571
headers = {"Authorization":bearer_token}
@@ -583,7 +583,7 @@ _Details:_
583
583
* Headers:
584
584
* Authorization: Bearer $token
585
585
586
-
This code example deletes the green-square instance (it's the only element left in the series) from the server. If it's successful, the response status code doesn't delete content.
586
+
This code example deletes the green-square instance from the server (it's the only element left in the series). If successful, the response status code doesn't delete content.
Copy file name to clipboardExpand all lines: articles/healthcare-apis/dicom/dicomweb-standard-apis-with-dicom-services.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
---
2
2
title: Access DICOMweb APIs to manage DICOM data in Azure Health Data Services
3
3
description: Learn how to use DICOMweb APIs to store, review, search, and delete DICOM objects. Learn how to use custom APIs to track changes and assign unique tags to DICOM data.
4
-
author: mmitrik
4
+
author: varunbms
5
5
ms.service: azure-health-data-services
6
6
ms.subservice: dicom-service
7
7
ms.topic: tutorial
8
8
ms.date: 05/29/2024
9
-
ms.author: mmitrik
9
+
ms.author: varunbms
10
10
---
11
11
12
12
# Access DICOMweb APIs to manage DICOM data
@@ -39,7 +39,7 @@ In addition to the subset of DICOMweb APIs, the DICOM service supports these cus
39
39
40
40
The DICOM service provides a web-based interface that follows REST (representational state transfer) principles. The REST API allows different applications or systems to communicate with each other using standard methods like GET, POST, PUT, and DELETE. To interact with the DICOM service, use any programming language that supports HTTP requests and responses.
41
41
42
-
Refer to the language-specific examples. You can view Postman collection examples in several languages including:
42
+
Refer to the language-specific examples. You can view Postman collection examples in several languages including the following.
43
43
44
44
- Go
45
45
- Java
@@ -73,7 +73,7 @@ For more information about how to use Python with the DICOM service, see [Using
73
73
74
74
Postman is an excellent tool for designing, building, and testing REST APIs. [Download Postman](https://www.postman.com/downloads/) to get started. For more information, see [Postman learning site](https://learning.postman.com/).
75
75
76
-
One important caveat with Postman and the DICOMweb standard is that Postman only supports uploading DICOM files by using the single-part payload defined in the DICOM standard. This caveat is because Postman can't support custom separators in a multipart/related POST request. For more information, see [Multipart POST not working for me # 576](https://github.com/postmanlabs/postman-app-support/issues/576). All examples in the Postman collection for uploading DICOM documents by using a multipart request are prefixed with **[won't work - see description]**. The examples for uploading by using a single-part request are included in the collection and are prefixed with **Store-Single-Instance**.
76
+
One important caution with Postman and the DICOMweb standard is that Postman only supports uploading DICOM files by using the single-part payload defined in the DICOM standard. This is because Postman can't support custom separators in a multipart/related POST request. For more information, see [Multipart POST not working for me # 576](https://github.com/postmanlabs/postman-app-support/issues/576). All examples in the Postman collection for uploading DICOM documents by using a multipart request are prefixed with **[won't work - see description]**. The examples for uploading by using a single-part request are included in the collection and are prefixed with **Store-Single-Instance**.
77
77
78
78
To use the Postman collection, download it locally and then import the collection through Postman. To access the collection, see [Postman Collection Examples](https://github.com/microsoft/dicom-server/blob/main/docs/resources/Conformance-as-Postman.postman_collection.json).
0 commit comments