Skip to content

webknossos.geometry.vec3_int

value_error = 'Vector components must be three integers or a Vec3IntLike object.'
class Vec3Int(builtins.tuple):

Built-in immutable sequence.

If no argument is given, the constructor returns an empty tuple. If iterable is specified the tuple is initialized from iterable's items.

If the argument is a tuple, the return value is the same object.

Vec3Int( vec: Union[int, Union[webknossos.geometry.vec3_int.Vec3Int, Tuple[int, int, int], numpy.ndarray, Iterable[int]]], y: Union[int, NoneType] = None, z: Union[int, NoneType] = None)

Class to represent a 3D vector. Inherits from tuple and provides useful methods and operations on top.

A small usage example:

from webknossos import Vec3Int

vector_1 = Vec3Int(1, 2, 3)
vector_2 = Vec3Int.full(1)
assert vector_2.x == vector_2.y == vector_2.y

assert vector_1 + vector_2 == (2, 3, 4)
@staticmethod
def from_xyz(x: int, y: int, z: int) -> webknossos.geometry.vec3_int.Vec3Int:

Use Vec3Int.from_xyz for fast construction.

@staticmethod
def from_vec3_float(vec: Tuple[float, float, float]) -> webknossos.geometry.vec3_int.Vec3Int:
@staticmethod
def from_vec_or_int( vec_or_int: Union[Union[webknossos.geometry.vec3_int.Vec3Int, Tuple[int, int, int], numpy.ndarray, Iterable[int]], int]) -> webknossos.geometry.vec3_int.Vec3Int:
@staticmethod
def from_str(string: str) -> webknossos.geometry.vec3_int.Vec3Int:
x: int
y: int
z: int
def with_x(self, new_x: int) -> webknossos.geometry.vec3_int.Vec3Int:
def with_y(self, new_y: int) -> webknossos.geometry.vec3_int.Vec3Int:
def with_z(self, new_z: int) -> webknossos.geometry.vec3_int.Vec3Int:
def to_np(self) -> numpy.ndarray:
def to_list(self) -> List[int]:
def to_tuple(self) -> Tuple[int, int, int]:
def contains(self, needle: int) -> bool:
def is_positive(self, strictly_positive: bool = False) -> bool:
def is_uniform(self) -> bool:
def ceildiv( self, other: Union[int, Union[webknossos.geometry.vec3_int.Vec3Int, Tuple[int, int, int], numpy.ndarray, Iterable[int]]]) -> webknossos.geometry.vec3_int.Vec3Int:
def pairmax( self, other: Union[int, Union[webknossos.geometry.vec3_int.Vec3Int, Tuple[int, int, int], numpy.ndarray, Iterable[int]]]) -> webknossos.geometry.vec3_int.Vec3Int:
def pairmin( self, other: Union[int, Union[webknossos.geometry.vec3_int.Vec3Int, Tuple[int, int, int], numpy.ndarray, Iterable[int]]]) -> webknossos.geometry.vec3_int.Vec3Int:
def prod(self) -> int:
def add_or_none( self, other: Union[webknossos.geometry.vec3_int.Vec3Int, NoneType]) -> Union[webknossos.geometry.vec3_int.Vec3Int, NoneType]:
def moveaxis( self, source: Union[int, List[int]], target: Union[int, List[int]]) -> webknossos.geometry.vec3_int.Vec3Int:

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.

@classmethod
def zeros(cls) -> webknossos.geometry.vec3_int.Vec3Int:
@classmethod
def ones(cls) -> webknossos.geometry.vec3_int.Vec3Int:
@classmethod
def full(cls, an_int: int) -> webknossos.geometry.vec3_int.Vec3Int:
Inherited Members
builtins.tuple
index
count
Vec3IntLike = typing.Union[webknossos.geometry.vec3_int.Vec3Int, typing.Tuple[int, int, int], numpy.ndarray, typing.Iterable[int]]