nlsam.angular_tools

Module Contents

Functions

angular_neighbors(vec, n)

Returns the indices of the n closest neighbors (excluding the vector itself)

_angle(vec)

Inner function that finds the angle between all vectors of the input.

greedy_set_finder(sets)

Returns a list of subsets that spans the input sets with a greedy algorithm

split_shell(bvals, bvecs, block_size, dwis, is_symmetric=False, bval_threshold=25)

Process each shell separately for finding the valid angular neighbors.

nlsam.angular_tools.angular_neighbors(vec, n)

Returns the indices of the n closest neighbors (excluding the vector itself) given an array of m points with x, y and z coordinates.

Input : A m x 3 array, with m being the number of points, one per line. Each column has x, y and z coordinates for each vector.

Output : A m x n array. Each line has the n indices of the closest n neighbors amongst the m input vectors.

Note : Symmetries are not considered here so a vector and its opposite sign counterpart will be considered far apart, even though in dMRI we consider (x, y, z) and -(x, y, z) to be practically identical.

nlsam.angular_tools._angle(vec)

Inner function that finds the angle between all vectors of the input. The diagonal is the angle between each vector and itself, thus 0 everytime. It should not be called as is, since it serves mainly as a shortcut for other functions.

arccos(0) = pi/2, so b0s are always far from everyone in this formulation.

nlsam.angular_tools.greedy_set_finder(sets)

Returns a list of subsets that spans the input sets with a greedy algorithm http://en.wikipedia.org/wiki/Set_cover_problem#Greedy_algorithm

nlsam.angular_tools.split_shell(bvals, bvecs, block_size, dwis, is_symmetric=False, bval_threshold=25)

Process each shell separately for finding the valid angular neighbors. Returns a list of indexes for each shell separately