Skip to content

webknossos.geometry.vec3_int

Vec3Int

Bases: VecInt

axes instance-attribute

axes: Tuple[str, ...]

c property

c: int

Returns the c component of the vector.

x property

x: int

xyz property

xyz: Vec3Int

y property

y: int

z property

z: int

add_or_none

add_or_none(other: Optional[VecInt]) -> Optional[_T]

Adds two VecInts or returns None if the other is None.

Parameters:

  • other (Optional[VecInt]) –

    The other vector to add.

Returns:

  • Optional[_T]

    Optional[VecInt]: The sum of the two vectors or None if the other is None.

ceildiv

ceildiv(other: Union[int, VecIntLike]) -> _T

Returns a new VecInt with the ceil division of each element by the other.

contains

contains(needle: int) -> bool

Checks if the vector contains a given element.

from_str staticmethod

from_str(string: str) -> Vec3Int

from_vec3_float staticmethod

from_vec3_float(vec: Tuple[float, float, float]) -> Vec3Int

from_vec_or_int staticmethod

from_vec_or_int(vec_or_int: Union[Vec3IntLike, int]) -> Vec3Int

from_xyz staticmethod

from_xyz(x: int, y: int, z: int) -> Vec3Int

Use Vec3Int.from_xyz for fast construction.

full classmethod

full(an_int: int, _axes: Tuple[str, ...] = ('x', 'y', 'z')) -> Vec3Int

is_positive

is_positive(strictly_positive: bool = False) -> bool

Checks if all elements in the vector are positive.

Parameters:

  • strictly_positive (bool, default: False ) –

    If True, checks if all elements are strictly positive.

Returns:

  • bool ( bool ) –

    True if all elements are positive, False otherwise.

is_uniform

is_uniform() -> bool

Checks if all elements in the vector are the same.

moveaxis

moveaxis(source: Union[int, List[int]], target: Union[int, List[int]]) -> _T

Allows to move one element at index source to another index target. Similar to np.moveaxis, this is not a swap operation but instead it moves the specified source so that the other elements move when necessary.

Parameters:

  • source (Union[int, List[int]]) –

    The index of the element to move.

  • target (Union[int, List[int]]) –

    The index where the element should be moved to.

Returns:

  • VecInt ( _T ) –

    A new vector with the moved element.

ones classmethod

ones(_axes: Tuple[str, ...] = ('x', 'y', 'z')) -> Vec3Int

pairmax

pairmax(other: Union[int, VecIntLike]) -> _T

Returns a new VecInt with the maximum of each pair of elements from the two vectors.

pairmin

pairmin(other: Union[int, VecIntLike]) -> _T

Returns a new VecInt with the minimum of each pair of elements from the two vectors.

prod

prod() -> int

Returns the product of all elements in the vector.

to_list

to_list() -> List[int]

Returns the vector as a list.

to_np

to_np() -> ndarray

Returns the vector as a numpy array.

to_tuple

to_tuple() -> Tuple[int, int, int]

with_replaced

with_replaced(index: int, new_element: int) -> _T

Returns a new ND Vector with a replaced element at a given index.

with_x

with_x(new_x: int) -> Vec3Int

with_y

with_y(new_y: int) -> Vec3Int

with_z

with_z(new_z: int) -> Vec3Int

zeros classmethod

zeros(_axes: Tuple[str, ...] = ('x', 'y', 'z')) -> Vec3Int