Links

Importing Data & Annotations

The RedBrick AI SDK allows you to programmatically import data and/or annotations with a Python script. You can import either locally or externally stored data via the SDK using the create_datapoints method.
Please see the full reference documentation for create_datapoints here.
Perform the standard RedBrick AI SDK setup to create a Project object.
project = redbrick.get_project(org_id, project_id, api_key)

Import locally stored images

To import locally stored data, create a list of points with relative file paths to your locally stored data, and use the redbrick.StorageMethod.REDBRICK storage ID.
# create a list of file paths to your locally stored data
points = [{"items": ["path/to/data.nii"], "name": "..."}]
# perform the upload operation
project.upload.create_datapoints(
storage_id=redbrick.StorageMethod.REDBRICK,
points=points
)
The points array follows the format of the items list.

Import externally stored images

To import data stored in an external storage method such as AWS s3, be sure to use the Storage ID found on the Storage tab of your RedBrick AI account instead of redbrick.StorageMethod.REDBRICK.
Click on the field to copy the Storage ID to your clipboard!
Visit our documentation on external storage to learn how to integrate your own external storage like AWS s3, GCS, or Azure blob.

Import annotations

First, please follow our guide on preparing your items list for annotation import to prepare your points object correctly.

Importing locally stored annotations & images

project.upload.create_datapoints(
storage_id=redbrick.StorageMethod.REDBRICK,
points=points
)

Importing locally stored annotations with externally stored images

project.upload.create_datapoints(
storage_id="your_storage_id",
label_storage_id=redbrick.StorageMethod.REDBRICK
points=points
)

Importing externally stored annotations and images

project.upload.create_datapoints(
storage_id="your_storage_id",
label_storage_id="your_storage_id"
points=points
)