htfa.io.Subject¶
- class htfa.io.Subject(data, coords, affine=None, mask=None, image_shape=None, source=None, group_path=())[source]¶
One subject’s data in voxel/pixel-by-sample form.
- Parameters:
- datanumpy.ndarray
Values, shape
(V, T), float64.- coordsnumpy.ndarray
Coordinates of the
Vlocations, shape(V, D), float64.- affinenumpy.ndarray or None
(4, 4)voxel-to-world affine, for NIfTI-derived subjects.- masknumpy.ndarray or None
Boolean mask in image space (
image_shape) selecting theVlocations.- image_shapetuple or None
Shape of the image grid the data came from.
- sourcestr or None
Path the data were read from, if any.
- group_pathtuple of str
Folder-derived hierarchy, from outermost to innermost group. Empty for individual files, arrays, flat folders, and stacked inputs.
Examples
>>> import numpy as np >>> from htfa.io import load >>> (subject,) = load(np.random.rand(4, 5) + 1) >>> subject.data.shape, subject.coords.shape ((20, 1), (20, 2))
- __init__(data, coords, affine=None, mask=None, image_shape=None, source=None, group_path=())¶
Methods
__init__(data, coords[, affine, mask, ...])to_image(values)Place
valuesback into image space, with NaN outside the mask.Attributes
affinegroup_pathimage_shapemasksourcedatacoords