Functions

Individual Bold File Functions

atlascorr.atlas_correlations.get_files(img)[source]

Find the brainmask and confound files given the bold file.

Parameters:
img : str

full path and name of the bold file

Returns:
confound : str

full path and name of the confounds file

brainmask : str

full path and name of the brainmask file

atlascorr.atlas_correlations.proc_confounds(confounds, confound_file)[source]

Filter confounds file to selected confounds & replaces “n/a”s in confounds file with the mean.

Parameters:
confounds : list

list of confounds to include in the model

confounds_file : str

full path and name of the confounds file

Returns:
confounds_df : pandas.core.frame.DataFrame

dataframe containing the selected confounds

atlascorr.atlas_correlations.make_corr_matrix(ts_matrix)[source]

Make a symmetric pearson’s r->z transforme correlation matrix.

Parameters:
ts_matrix : numpy.ndarray

2D numpy array with each column representing an atlas region and each row representing a volume (time point)

Returns:
zcorr_matrix : numpy.ndarray

2D symmetric matrix measuring region-region correlations main diagnal is all zeros

atlascorr.atlas_correlations.write_out_corr_matrix(corr_matrix, atlas_lut, img, output_dir)[source]

Write out a symmetric correlation matrix using BIDS naming conventions

Parameters:
corr_matrix : numpy.ndarray

2D symmetric matrix measuring region-region correlations main diagnal is all zeros

atlas_lut : str

full path and name to atlas lookup tsv with two columns (regions and index)

img : str

full path and name of the bold file

output_dir : str

full path to the base directory where all correlation matrices will be written out to.

Returns:
dst : str

full path and name of the correlation matrix

Group Level Functions

atlascorr.atlas_correlations.proc_matrix(matrix_tsv)[source]

Vectorize symmetric correlation matrix so that each unique region-region correlation gets a column.

Parameters:
matrix_tsv : str

full path and name of the correlation matrix

Returns:
flat_df : pandas.core.frame.DataFrame

a flat dataframe that is one entry and has as many columns as there are unique region-region pairs

atlascorr.atlas_correlations.merge_dfs(dfs)[source]

Merge a list of dataframes where each contains one row showing all unique region-region pairs.

Parameters:
dfs : list

list of dataframes where each contains one row showing all unique region-region pairs

Returns:
out_df : pandas.core.frame.DataFrame

merged dataframe where each row represents a unique scan

atlascorr.atlas_correlations.write_out_group_tsv(outdir, df)[source]
outdir : str
full path to the output directory for the group tsv
df : pandas.core.frame.DataFrame
dataframe where each row represents a unique scan and each column is a unique region-region pair