tedana.utils.io¶
Functions to handle file input/output
Functions
ctabsel (ctabfile) |
Loads a pre-existing component table file |
gscontrol_mmix (OCcatd, mmix, mask, acc, rej, …) |
Perform global signal regression. |
split_ts (data, mmix, mask, acc) |
Splits data time series into accepted component time series and remainder |
write_split_ts (data, mmix, mask, acc, rej, …) |
Splits data into denoised / noise / ignored time series and saves to disk |
writect (comptable, n_vols, acc, rej, midk, empty) |
Saves component table to disk |
writefeats (data, mmix, mask, ref_img[, suffix]) |
Converts data to component space with mmix and saves to disk |
writeresults (ts, mask, comptable, mmix, …) |
Denoises ts and saves all resulting files to disk |
writeresults_echoes (catd, mmix, mask, acc, …) |
Saves individually denoised echos to disk |
-
ctabsel
(ctabfile)[source]¶ Loads a pre-existing component table file
Parameters: ctabfile (str) – Filepath to existing component table Returns: ctab – Tuple containing arrays of (1) accepted, (2) rejected, (3) mid, and (4) ignored components Return type: (4,) tuple
ofnumpy.ndarray
-
gscontrol_mmix
(OCcatd, mmix, mask, acc, rej, midk, ref_img)[source]¶ Perform global signal regression.
Parameters: - OCcatd ((S x T) array_like) – Optimally-combined time series data
- mmix ((C x T) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in OCcatd
- mask ((S,) array_like) – Boolean mask array
- acc (list) – Indices of accepted (BOLD) components in mmix
- rej (list) – Indices of rejected (non-BOLD) components in mmix
- midk (list) – Indices of mid-K (questionable) components in mmix
- ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk
-
split_ts
(data, mmix, mask, acc)[source]¶ Splits data time series into accepted component time series and remainder
Parameters: - data ((S x T) array_like) – Input data, where S is samples and T is time
- mmix ((T x C) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
- mask ((S,) array_like) – Boolean mask array
- acc (list) – List of accepted components used to subset mmix
Returns: - hikts ((S x T)
numpy.ndarray
) – Time series reconstructed using only components in acc - rest ((S x T)
numpy.ndarray
) – Original data with hikts removed
-
write_split_ts
(data, mmix, mask, acc, rej, midk, ref_img, suffix='')[source]¶ Splits data into denoised / noise / ignored time series and saves to disk
Parameters: - data ((S x T) array_like) – Input time series
- mmix ((C x T) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
- mask ((S,) array_like) – Boolean mask array
- acc (list) – Indices of accepted (BOLD) components in mmix
- rej (list) – Indices of rejected (non-BOLD) components in mmix
- midk (list) – Indices of mid-K (questionable) components in mmix
- ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk
- suffix (str, optional) – Appended to name of saved files (before extension). Default: ‘’
Returns: varexpl – Percent variance of data explained by extracted + retained components
Return type:
-
writect
(comptable, n_vols, acc, rej, midk, empty, ctname='comp_table.txt', varexpl='-1')[source]¶ Saves component table to disk
Parameters: - comptable ((N x 5) array_like) – Array with columns denoting (1) index of component, (2) Kappa score of component, (3) Rho score of component, (4) variance explained by component, and (5) normalized variance explained by component
- n_vols (int) – Number of volumes in original time series
- acc (list) – Indices of accepted (BOLD) components in mmix
- rej (list) – Indices of rejected (non-BOLD) components in mmix
- midk (list) – Indices of mid-K (questionable) components in mmix
- empty (list) – Indices of ignored components in mmix
- ctname (str, optional) – Filename to save comptable to disk. Default ‘comp_table.txt’
- varexpl (str) – Variance explained by original data
-
writefeats
(data, mmix, mask, ref_img, suffix='')[source]¶ Converts data to component space with mmix and saves to disk
Parameters: - data ((S x T) array_like) – Input time series
- mmix ((C x T) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
- mask ((S,) array_like) – Boolean mask array
- ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk
- suffix (str, optional) – Appended to name of saved files (before extension). Default: ‘’
Returns: fname – Filepath to saved file
Return type:
-
writeresults
(ts, mask, comptable, mmix, n_vols, acc, rej, midk, empty, ref_img)[source]¶ Denoises ts and saves all resulting files to disk
Parameters: - ts ((S x T) array_like) – Time series to denoise and save to disk
- mask ((S,) array_like) – Boolean mask array
- comptable ((N x 5) array_like) – Array with columns denoting (1) index of component, (2) Kappa score of component, (3) Rho score of component, (4) variance explained by component, and (5) normalized variance explained by component
- mmix ((C x T) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
- acc (list) – Indices of accepted (BOLD) components in mmix
- rej (list) – Indices of rejected (non-BOLD) components in mmix
- midk (list) – Indices of mid-K (questionable) components in mmix
- empty (list) – Indices of ignored components in mmix
- ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk
-
writeresults_echoes
(catd, mmix, mask, acc, rej, midk, ref_img)[source]¶ Saves individually denoised echos to disk
Parameters: - catd ((S x E x T) array_like) – Input data time series
- mmix ((C x T) array_like) – Mixing matrix for converting input data to component space, where C is components and T is the same as in data
- mask ((S,) array_like) – Boolean mask array
- acc (list) – Indices of accepted (BOLD) components in mmix
- rej (list) – Indices of rejected (non-BOLD) components in mmix
- midk (list) – Indices of mid-K (questionable) components in mmix
- ref_img (str or img_like) – Reference image to dictate how outputs are saved to disk