actors#

Module: actors.odf#

sh_odf(centers, coeffs, degree, sh_basis, ...)

Visualize one or many ODFs with different features.

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.

sh_odf#

fury.actors.odf.sh_odf(centers, coeffs, degree, sh_basis, scales, opacity)[source]#

Visualize one or many ODFs with different features.

Parameters:
centersndarray(N, 3)

ODFs positions.

coeffsndarray

2D ODFs array in SH coefficients.

sh_basis: str, optional

Type of basis (descoteaux, tournier) ‘descoteaux’ for the default descoteaux07 DIPY basis. ‘tournier’ for the default tournier07 DIPY basis.

degree: int, optional

Index of the highest used band of the spherical harmonics basis. Must be even, at least 2 and at most 12.

scalesfloat or ndarray (N, )

ODFs size.

opacityfloat

Takes values from 0 (fully transparent) to 1 (opaque).

Returns:
box_actor: Actor

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:
odfsndarray

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.

scalefloat

Multiplicative factor to apply to ODF amplitudes.

normbool

Normalize SF amplitudes so that the maximum ODF amplitude per voxel along a direction is 1.

radial_scalebool

Scale sphere points by ODF values.

global_cmbool

If True the colormap will be applied in all ODFs. If False it will be applied individually at each voxel.

colormapNone or str

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

opacityfloat

Takes values from 0 (fully transparent) to 1 (opaque).

affinearray

optional 4x4 transformation array from native coordinates to world coordinates.

Bndarray (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.

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:
directionsndarray

Peak directions. The shape of the array should be (X, Y, Z, D, 3).

indicestuple

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

valuesndarray, optional

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

affinearray, optional

4x4 transformation array from native coordinates to world coordinates.

colorsNone 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_colormapvtkLookupTable, optional

Add a default lookup table to the colormap. Default is None which calls fury.actor.colormap_lookup_table().

linewidthfloat, 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.

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:
centersndarray(N, 3)

Tensor ellipsoid positions.

axesndarray (3, 3) or (N, 3, 3)

Axes of the tensor ellipsoid.

lengthsndarray (3, ) or (N, 3)

Axes lengths.

colorsndarray (N,3) or tuple (3,)

R, G and B should be in the range [0, 1].

scalesfloat or ndarray (N, )

Tensor ellipsoid size.

opacityfloat

Takes values from 0 (fully transparent) to 1 (opaque).

Returns:
box_actor: 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:
centersndarray(N, 3)

Cone positions.

axesndarray (3, 3) or (N, 3, 3)

Axes of the cone.

anglesfloat or ndarray (N, )

Angles of the cone.

colorsndarray (N, 3) or tuple (3,)

R, G and B should be in the range [0, 1].

scalesfloat or ndarray (N, )

Cone size.

opacityfloat

Takes values from 0 (fully transparent) to 1 (opaque).

Returns:
box_actor: 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:
evalsndarray (3, ) or (N, 3)

Eigenvalues.

evecsndarray (3, 3) or (N, 3, 3)

Eigenvectors.

signal3D or 4D ndarray

Predicted signal.

sigmandarray

Standard deviation of the noise.

b_matrixarray (N, 7)

Design matrix for DTI.

Returns:
anglesarray

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

[1]

Basser, P. J. (1997). Quantifying errors in fiber direction and diffusion tensor field maps resulting from MR noise. In 5th Scientific Meeting of the ISMRM (Vol. 1740).

[2]

Chang, L. C., Koay, C. G., Pierpaoli, C., & Basser, P. J. (2007). 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.