

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 데이터 스토어 생성
<a name="create-data-store"></a>

`CreateDatastore` 작업을 사용하여 DICOM P10 파일을 가져오기 위한 AWS HealthImaging [데이터 스토어](getting-started-concepts.md#concept-data-store)를 생성합니다. 다음 메뉴에서는 AWS Management Console 및 AWS SDKs의 AWS CLI 및 코드 예제에 대한 절차를 제공합니다. 자세한 내용은 *AWS HealthImaging API Reference*에서 [https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_CreateDatastore.html](https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_CreateDatastore.html) 섹션을 참조하세요. 데이터 스토어를 생성할 때 AWS HealthImaging이 무손실 이미지 프레임을 트랜스코딩하고 저장하는 데 사용한 기본 전송 구문을 선택할 수 있습니다. 데이터 스토어가 생성된 후에는이 구성을 변경할 수 없습니다.

**높은 처리량 JPEG 2000(HTJ2K)**  
HTJ2K(고처리량 JPEG 2000)는 HealthImaging 데이터 스토어의 기본 스토리지 형식입니다. 이는 크게 향상된 인코딩 및 디코딩 성능을 제공하는 JPEG 2000 표준의 확장입니다. 를 지정하지 않고 데이터 스토어를 생성하면 `—lossless-storage-format` HealthImaging은 자동으로 HTJ2K를 사용합니다. HTJ2K를 사용하여 데이터 스토어를 생성하려면 아래 *AWS CLI 및 SDKs* 섹션을 참조하세요.

**JPEG 2000 무손실**  
JPEG 2000 무손실 인코딩을 사용하면 트랜스코딩 없이 JPEG 2000 형식으로 무손실 이미지 프레임을 유지하고 검색하는 데이터 스토어를 생성할 수 있으므로 JPEG 2000 무손실(DICOM 전송 구문 UID 1.2.840.10008.1.2.4.90)이 필요한 애플리케이션의 지연 시간을 줄일 수 있습니다. [지원되는 전송 구문](supported-transfer-syntaxes.md) 자세한 내용은 섹션을 참조하세요. JPEG 2000 무손실 형식을 사용하여 데이터 스토어를 생성하려면 아래 *AWS CLI 및 SDKs* 섹션을 참조하세요.

**중요**  
개인 정보(PHI), 개인 식별 정보(PII) 혹은 기타 기밀 정보 또는 민감한 정보를 데이터 스토어 이름으로 지정하지 마세요.
AWS 콘솔은 기본 설정으로 데이터 스토어 생성을 지원합니다. AWS CLI 또는 AWS SDK를 사용하여 선택 사항이 `—lossless-storage-format` 지정된 데이터 스토어를 생성합니다.

**데이터 스토어 생성**  
AWS HealthImaging에 대한 액세스 기본 설정에 따라 메뉴를 선택합니다.

## AWS 콘솔
<a name="code-example-console-data-store-create"></a>

1. HealthImaging 콘솔 [데이터 스토어 생성 페이지](https://console.aws.amazon.com/medical-imaging/home#/dataStores/create)를 엽니다.

1. **세부 정보**의 **데이터 스토어 이름**에서 데이터 스토어의 이름을 입력합니다.

1. **데이터 암호화**에서 리소스를 암호화할 AWS KMS 키를 선택합니다. 자세한 내용은 [AWS HealthImaging의 데이터 보호](data-protection.md) 단원을 참조하십시오.

1. **태그 - *선택 사항***에서 데이터 스토어를 생성할 때 데이터 스토어에 태그를 추가할 수 있습니다. 자세한 내용은 [리소스에 태그 지정](tag-resource.md) 단원을 참조하십시오.

1. **데이터 스토어 생성**을 선택합니다.

## AWS CLI 및 SDKs
<a name="code-example-cli-sdk-data-store-create"></a>

------
#### [ Bash ]

**AWS CLI Bash 스크립트 사용**  

```
###############################################################################
# function errecho
#
# This function outputs everything sent to it to STDERR (standard error output).
###############################################################################
function errecho() {
  printf "%s\n" "$*" 1>&2
}

###############################################################################
# function imaging_create_datastore
#
# This function creates an AWS HealthImaging data store for importing DICOM P10 files.
#
# Parameters:
#       -n data_store_name - The name of the data store.
#
# Returns:
#       The datastore ID.
#    And:
#       0 - If successful.
#       1 - If it fails.
###############################################################################
function imaging_create_datastore() {
  local datastore_name response
  local option OPTARG # Required to use getopts command in a function.

  # bashsupport disable=BP5008
  function usage() {
    echo "function imaging_create_datastore"
    echo "Creates an AWS HealthImaging data store for importing DICOM P10 files."
    echo "  -n data_store_name - The name of the data store."
    echo ""
  }

  # Retrieve the calling parameters.
  while getopts "n:h" option; do
    case "${option}" in
      n) datastore_name="${OPTARG}" ;;
      h)
        usage
        return 0
        ;;
      \?)
        echo "Invalid parameter"
        usage
        return 1
        ;;
    esac
  done
  export OPTIND=1

  if [[ -z "$datastore_name" ]]; then
    errecho "ERROR: You must provide a data store name with the -n parameter."
    usage
    return 1
  fi

  response=$(aws medical-imaging create-datastore \
    --datastore-name "$datastore_name" \
    --output text \
    --query 'datastoreId')

  local error_code=${?}

  if [[ $error_code -ne 0 ]]; then
    aws_cli_error_log $error_code
    errecho "ERROR: AWS reports medical-imaging create-datastore operation failed.$response"
    return 1
  fi

  echo "$response"

  return 0
}
```
+  API 세부 정보는 *AWS CLI * 명령 참조의 [CreateDatastore](https://docs.aws.amazon.com/goto/aws-cli/medical-imaging-2023-07-19/CreateDatastore)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/aws-cli/bash-linux/medical-imaging#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------
#### [ CLI ]

**AWS CLI**  
**예시 1: 데이터 스토어 생성**  
다음 `create-datastore` 코드 예시에서는 `my-datastore`라는 데이터 스토어를 생성합니다. 를 지정하지 않고 데이터 스토어를 생성하는 경우`--lossless-storage-format` AWS HealthImaging은 기본적으로 HTJ2K(고처리량 JPEG 2000)로 설정됩니다.  

```
aws medical-imaging create-datastore \
    --datastore-name "my-datastore"
```
출력:  

```
{
    "datastoreId": "12345678901234567890123456789012",
    "datastoreStatus": "CREATING"
}
```
**예제 2: JPEG 2000 무손실 스토리지 형식으로 데이터 스토어 생성**  
JPEG 2000 무손실 스토리지 형식으로 구성된 데이터 스토어는 무손실 이미지 프레임을 JPEG 2000 형식으로 트랜스코딩하고 유지합니다. 그런 다음 트랜스코딩 없이 JPEG 2000 Lossless에서 이미지 프레임을 검색할 수 있습니다. 다음 `create-datastore` 코드 예제에서는 이름이 `my-datastore`인 JPEG 2000 무손실 스토리지 형식으로 구성된 데이터 스토어를 생성합니다.  

```
aws medical-imaging create-datastore \
    --datastore-name "my-datastore" \
    --lossless-storage-format JPEG_2000_LOSSLESS
```
출력:  

```
{
    "datastoreId": "12345678901234567890123456789012",
    "datastoreStatus": "CREATING"
}
```
자세한 내용은 *AWS HealthImaging 개발자 안내서*의 [데이터 스토어 생성](https://docs.aws.amazon.com/healthimaging/latest/devguide/create-data-store.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateDatastore](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/medical-imaging/create-datastore.html)를 참조하세요.

------
#### [ Java ]

**SDK for Java 2.x**  

```
    public static String createMedicalImageDatastore(MedicalImagingClient medicalImagingClient,
            String datastoreName) {
        try {
            CreateDatastoreRequest datastoreRequest = CreateDatastoreRequest.builder()
                    .datastoreName(datastoreName)
                    .build();
            CreateDatastoreResponse response = medicalImagingClient.createDatastore(datastoreRequest);
            return response.datastoreId();
        } catch (MedicalImagingException e) {
            System.err.println(e.awsErrorDetails().errorMessage());
            System.exit(1);
        }

        return "";
    }
```
+  API에 대한 세부 정보는 *AWS SDK for Java 2.x API 참조*의 [CreateDatastore](https://docs.aws.amazon.com/goto/SdkForJavaV2/medical-imaging-2023-07-19/CreateDatastore)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/medicalimaging#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------
#### [ JavaScript ]

**SDK for JavaScript(v3)**  

```
import { CreateDatastoreCommand } from "@aws-sdk/client-medical-imaging";
import { medicalImagingClient } from "../libs/medicalImagingClient.js";

/**
 * @param {string} datastoreName - The name of the data store to create.
 */
export const createDatastore = async (datastoreName = "DATASTORE_NAME") => {
  const response = await medicalImagingClient.send(
    new CreateDatastoreCommand({ datastoreName: datastoreName }),
  );
  console.log(response);
  // {
  //   '$metadata': {
  //       httpStatusCode: 200,
  //       requestId: 'a71cd65f-2382-49bf-b682-f9209d8d399b',
  //       extendedRequestId: undefined,
  //       cfId: undefined,
  //       attempts: 1,
  //       totalRetryDelay: 0
  //    },
  //    datastoreId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  //    datastoreStatus: 'CREATING'
  // }
  return response;
};
```
+  API에 대한 세부 정보는 *AWS SDK for JavaScript API 참조*의 [CreateDatastore](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/medical-imaging/command/CreateDatastoreCommand)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/medical-imaging#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------
#### [ Python ]

**SDK for Python(Boto3)**  

```
class MedicalImagingWrapper:
    def __init__(self, health_imaging_client):
        self.health_imaging_client = health_imaging_client


    def create_datastore(self, name):
        """
        Create a data store.

        :param name: The name of the data store to create.
        :return: The data store ID.
        """
        try:
            data_store = self.health_imaging_client.create_datastore(datastoreName=name)
        except ClientError as err:
            logger.error(
                "Couldn't create data store %s. Here's why: %s: %s",
                name,
                err.response["Error"]["Code"],
                err.response["Error"]["Message"],
            )
            raise
        else:
            return data_store["datastoreId"]
```
다음 코드는 MedicalImagingWrapper 객체를 인스턴스화합니다.  

```
    client = boto3.client("medical-imaging")
    medical_imaging_wrapper = MedicalImagingWrapper(client)
```
+  API 세부 정보는 *AWS SDK for Python (Boto3) API 참조*의 [CreateDatastore](https://docs.aws.amazon.com/goto/boto3/medical-imaging-2023-07-19/CreateDatastore)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/medical-imaging#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------
#### [ SAP ABAP ]

**SDK for SAP ABAP API**  

```
    TRY.
        " iv_datastore_name = 'my-datastore-name'
        oo_result = lo_mig->createdatastore( iv_datastorename = iv_datastore_name ).
        DATA(lv_datastore_id) = oo_result->get_datastoreid( ).
        MESSAGE 'Data store created.' TYPE 'I'.
      CATCH /aws1/cx_migaccessdeniedex.
        MESSAGE 'Access denied.' TYPE 'I'.
      CATCH /aws1/cx_migconflictexception.
        MESSAGE 'Conflict. Data store may already exist.' TYPE 'I'.
      CATCH /aws1/cx_miginternalserverex.
        MESSAGE 'Internal server error.' TYPE 'I'.
      CATCH /aws1/cx_migservicequotaexcdex.
        MESSAGE 'Service quota exceeded.' TYPE 'I'.
      CATCH /aws1/cx_migthrottlingex.
        MESSAGE 'Request throttled.' TYPE 'I'.
      CATCH /aws1/cx_migvalidationex.
        MESSAGE 'Validation error.' TYPE 'I'.
    ENDTRY.
```
+  API 세부 정보는 *AWS SDK for SAP ABAP API 참조*의 [CreateDatastore](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/mig#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------

**예제 가용성**  
필요한 예제를 찾을 수 없습니까? 이 페이지의 오른쪽 사이드바에 있는 **피드백 제공** 링크를 사용하여 코드 예제를 요청합니다.