labs.viz_tools.coord_tools

Module: labs.viz_tools.coord_tools

Misc tools to find activations and cut on maps

Functions

nipy.labs.viz_tools.coord_tools.coord_transform(x, y, z, affine)[source]

Convert x, y, z coordinates from one image space to another space.

Warning: x, y and z have Talairach ordering, not 3D numpy image ordering.

Parameters

x : number or ndarray

The x coordinates in the input space

y : number or ndarray

The y coordinates in the input space

z : number or ndarray

The z coordinates in the input space

affine : 2D 4x4 ndarray

affine that maps from input to output space.

Returns

x : number or ndarray

The x coordinates in the output space

y : number or ndarray

The y coordinates in the output space

z : number or ndarray

The z coordinates in the output space

nipy.labs.viz_tools.coord_tools.find_cut_coords(map, mask=None, activation_threshold=None)[source]

Find the center of the largest activation connect component.

Parameters

map : 3D ndarray

The activation map, as a 3D image.

mask : 3D ndarray, boolean, optional

An optional brain mask.

activation_threshold : float, optional

The lower threshold to the positive activation. If None, the activation threshold is computed using find_activation.

Returns

x: float

the x coordinate in voxels.

y: float

the y coordinate in voxels.

z: float

the z coordinate in voxels.

nipy.labs.viz_tools.coord_tools.find_maxsep_cut_coords(map3d, affine, slicer='z', n_cuts=None, threshold=None)[source]

Heuristic finds n_cuts with max separation along a given axis

Parameters

map3d : 3D array

the data under consideration

affine : array shape (4, 4)

Affine mapping between array coordinates of map3d and real-world coordinates.

slicer : string, optional

sectional slicer; possible values are “x”, “y”, or “z”

n_cuts : None or int >= 1, optional

Number of cuts in the plot; if None, then a default value of 5 is forced.

threshold : None or float, optional

Thresholding to be applied to the map. Values less than threshold set to 0. If None, no thresholding applied.

Returns

cuts : 1D array of length n_cuts

the computed cuts

Raises

ValueError:

If slicer not in ‘xyz’

ValueError

If ncuts < 1

nipy.labs.viz_tools.coord_tools.get_mask_bounds(mask, affine)[source]

Return the world-space bounds occupied by a mask given an affine.

Notes

The mask should have only one connect component.

The affine should be diagonal or diagonal-permuted.