Annotation type definitions#

This section covers definitions of all the annotation object types. The objects are the same for importing annotations, and exporting annotations.

Label Type

Label Definition

2D Image

3D Volume

Video

CLASSIFICATION (non objectType)

Classification

SEGMENTATION

CommonLabelProps

LENGTH

MeasureLength

ANGLE

MeasureAngle

POINT

Landmark

Landmark3D

POLYLINE

Polyline

POLYGON

Polygon

ELLIPSE

Ellipse

BBOX

BoundingBox

CUBOID

Cuboid

class redbrick.types.task.Point2D#

2D pixel point.

The Point2D coordinates are normalized in relation to the dimensions of the image, meaning they are scaled down to a range between 0 and 1. To convert these normalized points back to their original scale on the image, you “un-normalize” them by multiplying by the image’s dimensions. This operation typically results in a floating-point number.

RedBrick AI enhances the precision of annotations on its canvas by supporting a resolution higher than that of the underlying image. This capability facilitates sub-pixel annotation accuracy. However, if sub-pixel precision is not necessary for your application, you can simplify the process by rounding the un-normalized coordinates to the nearest whole number. This adjustment converts the precise floating-point values back to standard pixel coordinates, making them easier to work with for general purposes.

Important

The origin point (0,0) from which these coordinates are measured is at the top left of the image. However, for mammography and DBT the origin is the top right of the image.

xNorm: float#

X co-ordinate normalized by the width of the image.

yNorm: float#

Y co-ordinate normalized by the height of the image.

class redbrick.types.task.VoxelPoint#

Represents a three-dimensional point in image-space, where i, j, and k are columns, rows, and k is the slice number.

i: int#
j: int#
k: int#
class redbrick.types.task.WorldPoint#

Represents a three-dimensional point in physical space/world co-ordinates. The world co-ordinates are calculated using redbrick.types.task.VoxelPoint and the DICOM Image Plane Module.

x: float#
y: float#
z: float#
class redbrick.types.task.MeasurementStats#

Measurement statistics for annotations.

average: float#

Average pixel/voxel intensity within the annotation. In CT, this is the average HU value.

area: float#

Area contained within the annotation in mm^2.

volume: float#

Volume contained within the annotation in mm^3

minimum: float#

Minimum intensity value within the annotation.

maximum: float#

Maximum intensity value within the annotation.

class redbrick.types.task.VideoMetaData#

Contains annotation information along the third axis. Frames for video, and slices for 3D volumes.

Warning

redbrick.types.task.VideoMetaData has a misleading name. It contains information for both videos, and 3D volumes.

Hint

Watch this video for a detailed explaination of all the attributes of this object.

seriesItemIndex: int#

The index of the file in series “items” list that this annotation is present on.

seriesFrameIndex: int#

Frame index of the annotation for nifti and dicom multipart files.

frameIndex: int#

The frame number (for video) or slice index (for 3D volumes) the annotation is present on.

trackId: str#

Each distinct object has a unique trackId. Two annotations on different frameIndex’s with the same trackId’s represent the same distinct object.

keyFrame: bool#

If True, this annotation is user-defined. If False, this annotation is interpolated.

endTrack: bool#

If True, this annotation is the last annotation of a specific track defined by trackId.

redbrick.types.task.Attributes#

Attributes for Taxonomy objects. Attributes can be boolean, textfields, select’s or multi-select’s.

alias of Dict[str, Union[str, bool, List[str]]]

class redbrick.types.task.CommonLabelProps#

Full version of redbrick.types.task.Series.segmentMap.

id: str#

Label ID.

category: Union[int, str, List[str]]#

Taxonomy object category.

attributes: Dict[str, Union[str, bool, List[str]]]#

Associated taxonomy object attributes.

mask: Union[str, List[str]]#

Filepath to segmentation file for this annotation.

overlappingGroups: List[int]#

Overlapping instances that this label is part of (when without_masks is set).

group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.InstanceClassification#

Instance level classifications for frame-by-frame (video) or slice-by-slice (volume) classifications..

id: str#

Label ID.

fileIndex: int#

For video this is the frameIndex, for DICOM volumes this is the sliceIndex.

fileName: str#

The file name represented by frameIndex.

group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Classification#

Study or series classification.

id: str#

Label ID.

attributes: Dict[str, Union[str, bool, List[str]]]#

Classification attributes.

group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Polyline#

Open polylines, not supported in 3D images.

id: str#

Label ID.

points: List[Point2D]#
category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
video: VideoMetaData#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Polygon#

Closed polygons, not supported in 3D images.

id: str#

Label ID.

points: List[Point2D]#
category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
stats: MeasurementStats#
video: VideoMetaData#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Cuboid#

3D bounding boxes for 3D images.

id: str#

Label ID.

point1: VoxelPoint#

Top left diagonal corner.

point2: VoxelPoint#

Bottom right diagonal corner.

absolutePoint1: WorldPoint#
absolutePoint2: WorldPoint#
category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
stats: MeasurementStats#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.BoundingBox#

2D bounding box for 2D images, or slice by slice annotation in 3D images.

Hint

See the following diagram to understand the coordinate system.

id: str#

Label ID.

pointTopLeft: Point2D#

Coordinates of the top left of the bounding box.

wNorm: float#

Width of the bounding box, normalized by image width.

hNorm: float#

Height of the bounding box, normalized by the image height.

category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
stats: MeasurementStats#
video: VideoMetaData#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Ellipse#

Ellipse annotation.

Hint

See this ellipse diagram to understand the coordinate system. Please read the redbrick.types.task.Point2D documentation to understand how normalization works & the origin of the coordinate system.

Warning

For DICOM images of a certain type, ellipse annotations might be flipped i.e., rotating the ellipse clockwise would result in counter-clockwise rotation. If you encounter these cases, reach out to our support for instructions on how to handle this support@redbrickai.com.

id: str#

Label ID.

pointCenter: Point2D#

The normalized center of the ellipse.

xRadiusNorm: float#

The x axis of the ellipse, normalized with by the image width. Adjusting for rotationRad, the x-axis of the ellipse aligns with the x-axis of the image.

yRadiusNorm: float#

The y axis of the ellipse, normalized with by the image width. Adjusting for rotationRad, the y-axis of the ellipse aligns with the y-axis of the image.

rotationRad: float#

The rotation of the ellipse measured clockwise as the angle between the y-axis of the ellipse and y-axis of the image.

category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
stats: MeasurementStats#
video: VideoMetaData#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.MeasureAngle#

Angle measurement label.

An angle measurement is defined by three points, where vertex is the middle point between point1 and point2. The angle between the two vectors (point1, vertex) and (point2, vertex) defines the angle measurement.

Hint

See this angle diagram to understand the coordinate system.

id: str#

Label ID.

type: Literal['angle']#
point1: VoxelPoint#
vertex: VoxelPoint#
point2: VoxelPoint#
absolutePoint1: WorldPoint#
absoluteVertex: WorldPoint#
absolutePoint2: WorldPoint#
normal: List[float]#

Measurements can be made on oblique planes. normal defines the normal unit vector to the slice on which the annotation was made. For annotations made on non-oblique planes, the normal will be [0,0,1]. The measurement is fully defined even without normal, however, for completeness see this angle diagram for it’s definition.

angle: float#

Measurement angle in degrees.

category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.MeasureLength#

Length measurement label.

A length measurement is defined by two points, and the length measurement is the distance between the two points.

id: str#

Label ID.

type: Literal['length']#
point1: VoxelPoint#
point2: VoxelPoint#
absolutePoint1: WorldPoint#
absolutePoint2: WorldPoint#
normal: List[float]#

Measurements can be made on oblique planes. normal defines the normal unit vector to the slice on which the annotation was made. For annotations made on non-oblique planes, the normal will be [0,0,1]. The measurement is fully defined even without normal, however, for completeness see this length diagram for it’s definition.

length: float#

The value of the measurement in millimeters.

category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Landmark3D#

3D landmark for 3D data.

id: str#

Label ID.

point: VoxelPoint#
category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity

class redbrick.types.task.Landmark#

2D landmark for 2D data.

id: str#

Label ID.

point: Point2D#
category: Union[int, str, List[str]]#
attributes: Dict[str, Union[str, bool, List[str]]]#
video: VideoMetaData#
group: str#

Linked label group id.

readOnly: bool#

Read only status

comment: Union[str, CommentType]#

Comment to add for the label entity