CuboidFace

class CuboidFace(a, b, c, d)[source]

Bases: object

A single face of a Cuboid.

The face is defined by four integer indices (a, b, c, d) referencing cuboid nodes. This lightweight helper is used to store faces and serialize/deserialize them in Supervisely annotation format (see to_json() / from_json()).

CuboidFace for a single Cuboid.

Parameters:
a : int

Node of the CuboidFace.

b : int

Node of the CuboidFace.

c : int

Node of the CuboidFace.

d : int

Node of the CuboidFace.

Usage Example:
edge = CuboidFace(0, 1, 2, 3)

Methods

from_json

Convert list of integers to CuboidFace.

to_json

Convert the CuboidFace to list.

tolist

Convert CuboidFace to list.

Attributes

a

b

c

d

classmethod from_json(data)[source]

Convert list of integers to CuboidFace. Read more about Supervisely format.

Parameters:
data : List[int, int, int, int]

List of integers.

Raises:

ValueError – if data have not 4 indices

Returns:

CuboidFace from json.

Return type:

CuboidFace

Usage Example:
new_edge = CuboidFace.from_json([0, 1, 2, 3])
to_json()[source]

Convert the CuboidFace to list. Read more about Supervisely format.

Returns:

List of integers

Return type:

List[int, int, int, int]

Usage Example:
edge = CuboidFace(0, 1, 2, 3)
edge_json = edge.to_json()
print(edge_json)
# Output: [0, 1, 2, 3]
tolist()[source]

Convert CuboidFace to list.

Returns:

List of integers.

Return type:

List[int, int, int, int]

Usage Example:
edge = CuboidFace(0, 1, 2, 3)
print(edge.tolist())
# Output: [0, 1, 2, 3]