

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# データストアの作成
<a name="create-data-store"></a>

`CreateDatastore` アクションを使用して、DICOM P10 ファイルをインポートするための AWS HealthImaging [データストア](getting-started-concepts.md#concept-data-store)を作成します。次のメニューでは、 の手順 AWS マネジメントコンソール と、 AWS CLI および AWS SDKs。詳細については、「AWS HealthImaging API リファレンス」の「[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 を使用します。HTJ2*SDKs* セクションを参照してください。 HTJ2K

**JPEG 2000 ロスレス**  
JPEG 2000 ロスレスエンコーディングを使用すると、トランスコードなしで JPEG 2000 形式でロスレスイメージフレームを保持および取得するデータストアを作成できるため、JPEG 2000 ロスレス (DICOM Transfer Syntax UID 1.2.840.10008.1.2.4.90) を必要とするアプリケーションのレイテンシーを短縮できます。詳細については、[サポートされる転送構文](supported-transfer-syntaxes.md)「」を参照してください。JPEG 2000 ロスレス形式を使用したデータストアの作成については、以下の *AWS CLI および SDKs* セクションを参照してください。

**[重要]**  
保護対象の医療情報 (PHI)、個人を特定できる情報 (PII)、またはその他の機密情報や秘匿性の高い情報はデータストア名に使用しないでください。
AWS コンソールは、デフォルト設定でのデータストアの作成をサポートしています。CLI または AWS SDK AWS を使用して、オプションの を指定してデータストアを作成します`—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 ロスレス、トランスコーディングなしで取得できます。次の `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 Developer Guide*」の「[Creating a data store](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**  

```
    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)での設定と実行の方法を確認してください。

------

**可用性の例**  
必要なものが見つからなかった場合。このページの右側サイドバーにある**フィードバックを提供する**リンクを使用して、コード例をリクエストします。