Exporting Annotations
You can make use of RedBrick AI's Python SDK to export your annotations using a Python script.
Within the Python SDK, annotations are exported in two ways:
The
export_tasks
function returns a Python object containing meta-data information and any vector annotations (measurements, landmarks, etc.). Please see the format of the object here.By default, segmentation data is written to your disk in NIfTI format. Segmentation data can also be exported in PNG or RT Struct by manipulating the parameters of the
export_tasks
function. Please view the detailedexport_tasks
reference here.
If you're attempting a one-time export or don't have intensive requirements for your export, the CLI also provides a simple and optimized workflow for exporting a Project's annotations.
Export Folder Structure
RedBrick AI exports annotations in a JSON structure, accompanied by NIfTI-1 masks for segmentations. All data will be exported within a folder named after your project_id
, with the following structure:
The above structure is for a standard export (i.e. not semantic, not binary mask, etc.) and assumes no overlapping segmentations.
Segmentations Subdirectory
The segmentation directory will contain a single sub-directory for each task in your export. The sub-directories will be named after the task name
. A single task (depending on whether it was single series or multi-series) can have one or more segmentations.
The individual segmentation files will be in NIfTI-1 format and be named after the user-defined series name. If no series name is provided on upload, RedBrick will assign a unique name. Corresponding meta-data ex. category names will be provided in tasks.json.
Code Examples
As always, you should first perform the standard RedBrick AI SDK setup to create a Project object.
With a new Project object created, you can export your Project's Tasks in various ways. Please see some common examples below.
Export All Tasks
The export_tasks()
function exports segmentation files for all Ground Truth Tasks by default. To export All Tasks, set the only_ground_truth
parameter to False
.
Export Only Ground Truth
You can export only the Tasks in Ground Truth, i.e., Tasks that have successfully made it through all Label and Review Stages.
Export Specific Tasks
Export selected Tasks by specifying Task IDs.
Generate an Audit Trail
An audit trail can be useful for regulators interested in your quality control processes, as well as for managing your internal QA processes.
Please see a detailed reference forget_task_events
here.
First, perform the standard RedBrick AI SDK setup to create a Project object.
Audit Trail - All Tasks
If you'd like to generate an audit trail for all Tasks (not only those in the Ground Truth Stage), be sure to include the only_ground_truth=False
parameter.
Audit Trail - Ground Truth Tasks Only
Retrieve an audit trail for all Ground Truth Tasks. Please note that by default, get_task_events
only returns audit information for Tasks in the Ground Truth Stage.
The returned object will contain data similar to the code snippet below, where each entry will represent a single Task (uniquely identified by taskId
). The events
array contains all key events/actions performed on the Task, with events[0]
being the first event.
Additional Capabilities
The following is a non-exhaustive list of other available functionalities when using the Export
class. A full list of the capabilities of our Export
class can be found here.
Track labeler or reviewer time spent on a Task with
get_active_time()
;Fetch Task events from a specific timestamp to the present day using
get_task_events()
and thefrom_timestamp
parameter;Easily search for Tasks based on a wide variety of criteria using
list_tasks()
;Perform a semantic export (that exports a single file per category name) using
export_tasks()
;Configure Hanging Protocols;
Upload a script for Custom Label Validation;
Last updated