actors#

Module: actors.odf_slicer#

OdfSlicerActor(odfs, vertices, faces, ...[, ...])

VTK actor for visualizing slices of ODF field.

Module: actors.peak#

PeakActor(directions, indices[, values, ...])

FURY actor for visualizing DWI peaks.

Module: actors.tensor#

tensor_ellipsoid(centers, axes, lengths, ...)

Visualize one or many Tensor Ellipsoids with different features.

double_cone(centers, axes, angles, colors, ...)

Visualize one or many Double Cones with different features.

main_dir_uncertainty(evals, evecs, signal, ...)

Calculate the angle of the cone of uncertainty that represents the perturbation of the main eigenvector of the diffusion tensor matrix.

OdfSlicerActor#

class fury.actors.odf_slicer.OdfSlicerActor(odfs, vertices, faces, indices, scale, norm, radial_scale, shape, global_cm, colormap, opacity, affine=None, B=None)[source]#

Bases: vtkActor

VTK actor for visualizing slices of ODF field.

Parameters:
  • odfs (ndarray) – SF or SH coefficients 2-dimensional array.

  • vertices (ndarray) – The sphere vertices used for SH to SF projection.

  • faces (ndarray) – Indices of sphere vertices forming triangles. Should be ordered clockwise (see fury.utils.fix_winding_order).

  • indices (tuple) – Indices given in tuple(x_indices, y_indices, z_indices) format for mapping 2D ODF array to 3D voxel grid.

  • scale (float) – Multiplicative factor to apply to ODF amplitudes.

  • norm (bool) – Normalize SF amplitudes so that the maximum ODF amplitude per voxel along a direction is 1.

  • radial_scale (bool) – Scale sphere points by ODF values.

  • global_cm (bool) – If True the colormap will be applied in all ODFs. If False it will be applied individually at each voxel.

  • colormap (None or str) – The name of the colormap to use. Matplotlib colormaps are supported (e.g., ‘inferno’). If None then a RGB colormap is used.

  • opacity (float) – Takes values from 0 (fully transparent) to 1 (opaque).

  • affine (array) – optional 4x4 transformation array from native coordinates to world coordinates.

  • B (ndarray (n_coeffs, n_vertices)) – Optional SH to SF matrix for projecting odfs given in SH coefficients on the sphere. If None, then the input is assumed to be expressed in SF coefficients.

__init__(odfs, vertices, faces, indices, scale, norm, radial_scale, shape, global_cm, colormap, opacity, affine=None, B=None)[source]#
display(x=None, y=None, z=None)[source]#

Display a slice along x, y, or z axis.

display_extent(x1, x2, y1, y2, z1, z2)[source]#

Set visible volume from x1 (inclusive) to x2 (inclusive), y1 (inclusive) to y2 (inclusive), z1 (inclusive) to z2 (inclusive).

set_opacity(opacity)[source]#

Set opacity value of ODFs to display.

slice_along_axis(slice_index, axis='zaxis')[source]#

Slice ODF field at given slice_index along axis in [‘xaxis’, ‘yaxis’, zaxis’].

update_sphere(vertices, faces, B)[source]#

Dynamically change the sphere used for SH to SF projection.

PeakActor#

class fury.actors.peak.PeakActor(directions, indices, values=None, affine=None, colors=None, lookup_colormap=None, linewidth=1, symmetric=True)[source]#

Bases: vtkActor

FURY actor for visualizing DWI peaks.

Parameters:
  • directions (ndarray) – Peak directions. The shape of the array should be (X, Y, Z, D, 3).

  • indices (tuple) – Indices given in tuple(x_indices, y_indices, z_indices) format for mapping 2D ODF array to 3D voxel grid.

  • values (ndarray, optional) – Peak values. The shape of the array should be (X, Y, Z, D).

  • affine (array, optional) – 4x4 transformation array from native coordinates to world coordinates.

  • colors (None or string ('rgb_standard') or tuple (3D or 4D) or) –

    array/ndarray (N, 3 or 4) or array/ndarray (K, 3 or 4) or

    array/ndarray(N, ) or array/ndarray (K, )

    If None a standard orientation colormap is used for every line. If one tuple of color is used. Then all streamlines will have the same color. If an array (N, 3 or 4) is given, where N is equal to the number of points. Then every point is colored with a different RGB(A) color. If an array (K, 3 or 4) is given, where K is equal to the number of lines. Then every line is colored with a different RGB(A) color. If an array (N, ) is given, where N is the number of points then these are considered as the values to be used by the colormap. If an array (K,) is given, where K is the number of lines then these are considered as the values to be used by the colormap.

  • lookup_colormap (vtkLookupTable, optional) – Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

  • linewidth (float, optional) – Line thickness. Default is 1.

  • symmetric (bool, optional) – If True, peaks are drawn for both peaks_dirs and -peaks_dirs. Else, peaks are only drawn for directions given by peaks_dirs. Default is True.

__init__(directions, indices, values=None, affine=None, colors=None, lookup_colormap=None, linewidth=1, symmetric=True)[source]#
property cross_section#
display_cross_section(x, y, z)[source]#
display_extent(x1, x2, y1, y2, z1, z2)[source]#
property global_opacity#
property high_ranges#
property is_range#
property linewidth#
property low_ranges#
property max_centers#
property min_centers#

tensor_ellipsoid#

fury.actors.tensor.tensor_ellipsoid(centers, axes, lengths, colors, scales, opacity)[source]#

Visualize one or many Tensor Ellipsoids with different features.

Parameters:
  • centers (ndarray(N, 3)) – Tensor ellipsoid positions.

  • axes (ndarray (3, 3) or (N, 3, 3)) – Axes of the tensor ellipsoid.

  • lengths (ndarray (3, ) or (N, 3)) – Axes lengths.

  • colors (ndarray (N,3) or tuple (3,)) – R, G and B should be in the range [0, 1].

  • scales (float or ndarray (N, )) – Tensor ellipsoid size.

  • opacity (float) – Takes values from 0 (fully transparent) to 1 (opaque).

Returns:

box_actor

Return type:

Actor

double_cone#

fury.actors.tensor.double_cone(centers, axes, angles, colors, scales, opacity)[source]#

Visualize one or many Double Cones with different features.

Parameters:
  • centers (ndarray(N, 3)) – Cone positions.

  • axes (ndarray (3, 3) or (N, 3, 3)) – Axes of the cone.

  • angles (float or ndarray (N, )) – Angles of the cone.

  • colors (ndarray (N, 3) or tuple (3,)) – R, G and B should be in the range [0, 1].

  • scales (float or ndarray (N, )) – Cone size.

  • opacity (float) – Takes values from 0 (fully transparent) to 1 (opaque).

Returns:

box_actor

Return type:

Actor

main_dir_uncertainty#

fury.actors.tensor.main_dir_uncertainty(evals, evecs, signal, sigma, b_matrix)[source]#

Calculate the angle of the cone of uncertainty that represents the perturbation of the main eigenvector of the diffusion tensor matrix.

Parameters:
  • evals (ndarray (3, ) or (N, 3)) – Eigenvalues.

  • evecs (ndarray (3, 3) or (N, 3, 3)) – Eigenvectors.

  • signal (3D or 4D ndarray) – Predicted signal.

  • sigma (ndarray) – Standard deviation of the noise.

  • b_matrix (array (N, 7)) – Design matrix for DTI.

Returns:

angles

Return type:

array

Notes

The uncertainty calculation is based on first-order matrix perturbation analysis described in [1]. The idea is to estimate the variance of the main eigenvector which corresponds to the main direction of diffusion, directly from estimated D and its estimated covariance matrix \(\Delta D\) (see [2], equation 4). The angle \(\Theta\) between the perturbed principal eigenvector of D, \(\epsilon_1+\Delta\epsilon_1\), and the estimated eigenvector \(\epsilon_1\), measures the angular deviation of the main fiber direction and can be approximated by:

\[\Theta=tan^{-1}(\|\Delta\epsilon_1\|)\]

Giving way to a graphical construct for displaying both the main eigenvector of D and its associated uncertainty, with the so-called “uncertainty cone”.

References

diffusion tensor field maps resulting from MR noise. In 5th Scientific Meeting of the ISMRM (Vol. 1740).

Variance of estimated DTI-derived parameters via first-order perturbation methods. Magnetic Resonance in Medicine: An Official Journal of the International Society for Magnetic Resonance in Medicine, 57(1), 141-149.