webknossos.geometry.vec3_int
¶
Classes:
-
Vec3Int
–
Vec3Int
¶
Bases: VecInt
Methods:
-
add_or_none
–Adds two VecInts or returns None if the other is None.
-
ceildiv
–Returns a new VecInt with the ceil division of each element by the other.
-
contains
–Checks if the vector contains a given element.
-
from_str
– -
from_vec3_float
– -
from_vec_or_int
– -
from_xyz
–Use Vec3Int.from_xyz for fast construction.
-
full
– -
is_positive
–Checks if all elements in the vector are positive.
-
is_uniform
–Checks if all elements in the vector are the same.
-
moveaxis
–Allows to move one element at index
source
to another indextarget
. Similar to -
ones
– -
pairmax
–Returns a new VecInt with the maximum of each pair of elements from the two vectors.
-
pairmin
–Returns a new VecInt with the minimum of each pair of elements from the two vectors.
-
prod
–Returns the product of all elements in the vector.
-
to_list
–Returns the vector as a list.
-
to_np
–Returns the vector as a numpy array.
-
to_tuple
– -
with_replaced
–Returns a new ND Vector with a replaced element at a given index.
-
with_x
– -
with_y
– -
with_z
– -
zeros
–
Attributes:
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.
from_xyz
staticmethod
¶
from_xyz(x: int, y: int, z: int) -> Vec3Int
Use Vec3Int.from_xyz for fast construction.
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.
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.
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.
with_replaced
¶
with_replaced(index: int, new_element: int) -> _T
Returns a new ND Vector with a replaced element at a given index.
- Get Help
- Community Forums
- Email Support