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)¶
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:
- xnumber or ndarray
The x coordinates in the input space
- ynumber or ndarray
The y coordinates in the input space
- znumber or ndarray
The z coordinates in the input space
- affine2D 4x4 ndarray
affine that maps from input to output space.
- Returns:
- xnumber or ndarray
The x coordinates in the output space
- ynumber or ndarray
The y coordinates in the output space
- znumber or ndarray
The z coordinates in the output space
- nipy.labs.viz_tools.coord_tools.find_cut_coords(map, mask=None, activation_threshold=None)¶
Find the center of the largest activation connect component.
- Parameters:
- map3D ndarray
The activation map, as a 3D image.
- mask3D ndarray, boolean, optional
An optional brain mask.
- activation_thresholdfloat, 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)¶
Heuristic finds n_cuts with max separation along a given axis
- Parameters:
- map3d3D array
the data under consideration
- affinearray shape (4, 4)
Affine mapping between array coordinates of map3d and real-world coordinates.
- slicerstring, optional
sectional slicer; possible values are “x”, “y”, or “z”
- n_cutsNone or int >= 1, optional
Number of cuts in the plot; if None, then a default value of 5 is forced.
- thresholdNone or float, optional
Thresholding to be applied to the map. Values less than threshold set to 0. If None, no thresholding applied.
- Returns:
- cuts1D 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)¶
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.