本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 STOW-RS 存放執行個體
AWS HealthImaging 提供用於匯入資料的 DICOMweb STOW-RS
APIs表示法。使用這些 APIs 將 DICOM 資料同步儲存到您的 HealthImaging 資料存放區。
下表說明可用於匯入資料的 DICOMweb STOW-RS APIs 的 HealthImaging 表示法。
HealthImaging 表示 DICOMweb STOW-RS APIs
名稱 |
描述 |
StoreDICOM |
將一或多個執行個體儲存到 HealthImaging 資料存放區。 |
StoreDICOMStudy |
將一個或多個對應至指定試驗執行個體 UID 的執行個體儲存至 HealthImaging 資料存放區。 |
使用 StoreDICOM
和 StoreDICOMStudy
動作匯入的資料將組織為新的主要影像集,或新增至現有的主要影像集,使用與非同步匯入任務相同的邏輯。如果新匯入的 DICOM P10 資料的中繼資料元素與現有的主要影像集衝突,則新資料將新增至非主要影像集。
啟動 StoreDICOM 請求
-
收集您的 AWS 區域、HealthImaging datastoreId
和 DICOM P10 檔案名稱。
-
建構表單請求的 URL: https://dicom-medical-imaging.region
.amazonaws.com/datastore/datastore-id
/studies
-
使用您偏好的命令判斷 DICOM P10 檔案的內容長度,例如 $(stat -f %z $FILENAME)
。
-
準備並傳送您的請求。 StoreDICOM
使用 HTTP POST 請求搭配 AWS Signature 第 4 版簽署通訊協定。
範例 1:使用 StoreDICOM
動作存放 DICOM P10 檔案
- Shell
-
curl -X POST -v \
'https://dicom-medical-imaging.us-east-1.amazonaws.com/datastore/d9a2a515ab294163a2d2f4069eed584c/studies' \
--aws-sigv4 "aws:amz:$AWS_REGION:medical-imaging" \
--user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
--header "x-amz-security-token:$AWS_SESSION_TOKEN" \
--header "x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD" \
--header "x-amz-decoded-content-length: $CONTENT_LENGTH" \
--header 'Accept: application/dicom+json' \
--header "Content-Type: application/dicom" \
--upload-file $FILENAME
範例 2:使用 StoreDICOMStudy
動作存放 DICOM P10 檔案
StoreDICOM 和 StoreDICOMStudy 之間的唯一區別是,將研究執行個體 UID 作為參數傳遞給 StoreDICOMStudy,且上傳的執行個體必須是指定研究的成員。
- Shell
-
curl -X POST -v \
'https://dicom-medical-imaging.us-east-1.amazonaws.com/datastore/d9a2a515ab294163a2d2f4069eed584c/studies/1.3.6.1.4.1.5962.1.2.4.20040826285059.5457' \
--aws-sigv4 "aws:amz:$AWS_REGION:medical-imaging" \
--user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
--header "x-amz-security-token:$AWS_SESSION_TOKEN" \
--header "x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD" \
--header "x-amz-decoded-content-length: $CONTENT_LENGTH" \
--header 'Accept: application/dicom+json' \
--header "Content-Type: application/dicom" \
--upload-file $FILENAME
範例 3:使用分段 HTTP 承載存放 DICOM P10 檔案
您可以使用單一分段上傳動作來上傳多個 P10 檔案。下列 shell 命令示範如何組合包含兩個 P10 檔案的分段承載,並使用 StoreDICOM
動作將其上傳。
- Shell
-
#!/bin/sh
FILENAME=multipart.payload
BOUNDARY=2a8a02b9-0ed3-c8a7-7ebd-232427531940
boundary_str="--$BOUNDARY\r\n"
mp_header="${boundary_str}Content-Type: application/dicom\r\n\r\n"
##Encapsulate the binary DICOM file 1.
printf '%b' "$mp_header" > $FILENAME
cat file1.dcm >> $FILENAME
##Encapsulate the binary DICOM file 2 (note the additional CRLF before the part header).
printf '%b' "\r\n$mp_header" >> $FILENAME
cat file2.dcm >> $FILENAME
## Add the closing boundary.
printf '%b' "\r\n--$BOUNDARY--" >> $FILENAME
## Obain the payload size in bytes.
multipart_payload_size=$(stat -f%z "$FILENAME")
# Execute CURL POST request with AWS SIGv4
curl -X POST -v \
'https://iad-dicom.external-healthlake-imaging.ai.aws.dev/datastore/b5f34e91ca734b39a54ac11ea42416cf/studies' \
--aws-sigv4 "aws:amz:us-east-1:medical-imaging" \
--user "AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
--header "x-amz-content-sha256: STREAMING-AWS4-HMAC-SHA256-PAYLOAD" \
--header "x-amz-decoded-content-length: ${multipart_payload_size}" \
--header 'Accept: application/dicom+json' \
--header "Content-Type: multipart/related; type=\"application/dicom\"; boundary=\"${BOUNDARY}\"" \
--data-binary "@$FILENAME"
# Delete the payload file
rm $FILENAME