cellmap_data.utils.coordinate#

Classes

Coordinate(*array_like)

A tuple of integers.

class cellmap_data.utils.coordinate.Coordinate(*array_like)[source]#

A tuple of integers.

Allows the following element-wise operators: addition, subtraction, multiplication, division, absolute value, and negation. All operations are applied element wise and support both Coordinates and Numbers. This allows to perform simple arithmetics with coordinates, e.g.:

shape = Coordinate(2, 3, 4)
voxel_size = Coordinate(10, 5, 1)
size = shape*voxel_size # == Coordinate(20, 15, 4)
size * 2 + 1 # == Coordinate(41, 31, 9)

Coordinates can be initialized with any iterable of ints or floats, e.g.:

Coordinate((1,2,3))
Coordinate([1.,2.5,3.])
Coordinate(np.array([1.,2.5,3]))

Coordinates can also pack multiple args into an iterable, e.g.:

Coordinate(1,2,3)
property dims: int#
squeeze(dim: int = 0) Coordinate[source]#
Parameters:

dim (int)

Return type:

Coordinate

is_multiple_of(coordinate: Coordinate) bool[source]#

Test if this coordinate is a multiple of the given coordinate.

Parameters:

coordinate (Coordinate)

Return type:

bool

round_division(other: Coordinate) Coordinate[source]#

Will always round down if self % other == other / 2.

Parameters:

other (Coordinate)

Return type:

Coordinate

floor_division(other: Coordinate) Coordinate[source]#
Parameters:

other (Coordinate)

Return type:

Coordinate

ceil_division(other: Coordinate) Coordinate[source]#
Parameters:

other (Coordinate)

Return type:

Coordinate