dipy logo

Site Navigation

NIPY Community

Previous topic

dipy.tracking.propspeed

Next topic

dipy viz

dipy.tracking.vox2track

Counting incidence of tracks in voxels of volume

dipy.tracking.vox2track.track_counts()

Counts of points in tracks that pass through voxels in volume

We find whether a point passed through a track by rounding the mm point values to voxels. For a track that passes through a voxel more than once, we only record counts and elements for the first point in the line that enters the voxel.

Parameters :

tracks : sequence

sequence of tracks. Tracks are ndarrays of shape (N, 3), where N is the number of points in that track, and tracks[t][n] is the n-th point in the t-th track. Points are of form x, y, z in mm coordinates.

vol_dim : sequence length 3

volume dimensions in voxels, x, y, z.

vox_sizes : sequence length 3

voxel sizes in mm

return_elements : {True, False}, optional

If True, also return object array with one list per voxel giving track indices and point indices passing through the voxel (see below)

Returns :

tcs : ndarray shape vol_dim

An array where entry tcs[x, y, z] is the number of tracks that passed through voxel at voxel coordinate x, y, z

tes : ndarray dtype np.object, shape vol_dim

If return_elements is True, we also return an object array with one object per voxel. The objects at each voxel are a list of integers, where the integers are the indices of the track that passed through the voxel.