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)
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:
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
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.
Inherited Members
- builtins.tuple
- index
- count
Vec3IntLike =
typing.Union[webknossos.geometry.vec3_int.Vec3Int, typing.Tuple[int, int, int], numpy.ndarray, typing.Iterable[int]]