b_selection module

Filter a set of gradients by direction and b-val.

b_selection.get_acquisitions_by_bval(bvals, lower, upper)

Get b-vals within a certain range.

Parameters:
  • bvals (array_like) – A 1D array of b-values to be filtered.
  • lower (float) – The minimum b-value to include.
  • upper (float) – The maximum b-value to include.
Returns:

Logical index array for b-values to include.

Return type:

array_like

b_selection.get_acquisitions_by_dir(bvecs, phi, theta, tolerance)

Get b-vectors close to a given direction.

Parameters:
  • bvecs (array_like) – 2D array of b-vectors to be filtered.
  • phi (float) – Azimuthal angle of the direction, between 0 and 180.
  • theta (float) – Polar angle of the point, between -180 and 180.
  • tolerance (float) – b-vecs with spherical distance less than this tolerance will be included.
Returns:

Index array of the b-vectors to be included.

Return type:

array_like

b_selection.spherical_distance(theta1, phi1, theta2, phi2)

Get the spherical distance between two points on the unit sphere.

Parameters:
  • theta2 (theta1,) – Polar angles of the two points, between 0 and pi.
  • phi1 (phi1,) – Azimuthal angles of the two points, between -pi and pi.
Returns:

Spherical distance between the given points.

Return type:

float