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.project = redbrick.get_project(org_id, project_id, api_key)
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": "..."}]
# designate the correct Storage Method (in this case, local)
storage_id = redbrick.StorageMethod.REDBRICK
# perform the upload operation
project.upload.create_datapoints(storage_id=storage_id, points=points)
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.

Click on the field to copy the Storage ID to your clipboard!
If you want to upload annotations with your data, include
segmentations
and segmentMap
annotation information in the points
object.points = [
{
"name": "...",
"series": [
{
"items": "path/to/data.nii",
# path to your annotation file
"segmentations": "path/to/segmentation.nii",
# segment mapping of the annotation file (often viewed with nibabel)
"segmentMap": {1: "category-1", 2: "category-2"},
}
],
}
]
project.upload.create_datapoints(storage_id="...", points=points)
Last modified 1mo ago