Vector#

Module to compute filters on vector/direction fields

Used for filtering orientation and fiber data.

alignment(vectors, structural_element, structural_element_offset=None, weights=None, sink=None)[source]#

Compute alignment of central vector with neighboring vectors.

Arguments

vectorsarray

Input vector field array.

structural_element: array or str

Structural element specification.

structural_element_offsettuple or None

Structural element offset

weightsNone or array

Weights for each vector in the vector field.

sinkarray

Output, if None, a new array is allocated.

Returns

sinkarray

Filtered output.

Algorithm#

For each central voxel
  1. compute a set of weights to neighboring vectors via the scalar product of the central vector with the structural element vectors

  2. compute the scalar product of the central vector with the neighbouring vectors

  3. from the weighed sum

orientation(vectors, structural_element, structural_element_offset=None, weights=None, sink=None)[source]#

Compute orientation alignment of central vector with neighboring vectors.

Arguments

vectorsarray

Input vector field array.

structural_element: array or str

Structural element specification.

structural_element_offsettuple or None

Structural element offset

weightsNone or array

Weights for each vector in the vector field.

sinkarray

Output, if None, a new array is allocated.

Returns

sinkarray

Filtered output.

Algorithm#

For each central voxel
  1. compute a set of matched orientation weights to neighboring vectors via the absolute value scalar product of the central vector with the structural element vectors (e.g. direction vectors from center), and further multiply by the input weights for the vectors.

  2. compute the absolute value of the scalar product of the central vector with the neighbouring vectors

  3. from the weighed sum

orientation_ellipsoid(vectors, weights=None, max_radius=5, scales=(2, 1), sink=None)[source]#

Compute orientation alignment of central vector with neighboring vectors.

Arguments

vectorsarray

Input vector field array.

weightsNone or array

Weights for each vector in the vector field.

max_radiusfloat

The maximal radius of the ellipse

scalestuple or list

A tuple (s1,s2) with s1 for the scale of the mayor axis and s2 the scale for the 2 minor axes of the ellipsoid.

sinkarray

Output, if None, a new array is allocated.

Returns

sinkarray

Filtered output.

Algorithm#

For each central voxel
  1. compute a set of matched orientation weights to neighboring vectors via the absolute value scalar product of the central vector with the structural element vectors (e.g. direction vectors from center), and further multiply by the input weights for the vectors.

  2. compute the absolute value of the scalar product of the central vector with the neighbouring vectors

  3. from the weighed sum

similarity(vectors, structural_element, structural_element_offset=None, weights=None, sink=None)[source]#

Compute sum of scalar products of the center vector with neighbouring vectors defined by the structural element.

Arguments

vectorsarray

Input vector field array.

structural_element: array or str

Structural element specification.

structural_element_offsettuple or None

Structural element offset

weightsNone or array

Weights for each vector in the vector field.

sinkarray

Output, if None, a new array is allocated.

Returns

sinkarray

Filtered output.

Algorithm#

For each center voxel compute the scalar products of the center vector with the neighbouring vectors defined by the structural element and sum.