tomosipo.vector_calc module

This module provides functionality for vector calculus.

Many objects in tomosipo contain vectors that change over time. Think of a ts.ConeVectorGeometry, for wich the source and detector positions change with each angle. The same is true for a VolumeVectorGeometry.

Therefore, it makes to sense to force these vectors into a common format and provide some basic common functionality. In tomosipo, the standard shape for these vector is (num_steps, 3). The functionality for creating and manipulating these vector can be found here.

This module provides a convenience function, to_vec, that converts any vector that it deems compatible into the common vector format. For scalars that change over time, such angles in a projection geometry or angles in a rotation, it provides to_scalar, which converts a scalar or array of scalars to a numpy array with shape (num_steps, 1).

tomosipo.vector_calc.broadcast_lengths(len_a, len_b)[source]
tomosipo.vector_calc.check_same_shapes(*args)[source]
tomosipo.vector_calc.cross_product(x, y)[source]
tomosipo.vector_calc.dot(x, y)[source]
tomosipo.vector_calc.ignore_divide_by_zero()[source]
tomosipo.vector_calc.intersect(v_origin, v_direction, plane_origin, plane_normal)[source]
tomosipo.vector_calc.invert_transformation_matrix(M)[source]
tomosipo.vector_calc.matrix_matrix_transform(M1, M2)[source]
tomosipo.vector_calc.matrix_transform(M, x)[source]

Apply a projective matrix transformation to x

Parameters:
  • M – A transformation matrix

  • xnp.array A homogeneous coordinate vector

Returns:

Return type:

tomosipo.vector_calc.norm(x)[source]
tomosipo.vector_calc.orthogonal_basis_from_axis(axis)[source]
tomosipo.vector_calc.squared_norm(x)[source]
tomosipo.vector_calc.to_homogeneous(x, s)[source]
tomosipo.vector_calc.to_homogeneous_point(x)[source]
tomosipo.vector_calc.to_homogeneous_vec(x)[source]
tomosipo.vector_calc.to_scalar(x)[source]
tomosipo.vector_calc.to_vec(x)[source]