NeuroConn.preprocessing package¶
Submodules¶
NeuroConn.preprocessing.preprocessing module¶
- class NeuroConn.preprocessing.preprocessing.FmriPreppedDataSet(BIDS_path)[source]¶
Bases:
RawDataset
- Attributes:
- data_description
- name
- participant_data
- subjects
Methods
clean_signal
(subject[, task, parcellation, ...])Cleans the time series for a given subject using a specified parcellation.
docker_fmriprep
(subject, fs_license_path[, ...])Runs the fMRIprep pipeline in a Docker container for a given subject.
get_confounds
(subject, task[, no_nans, ...])Returns a list of confounds for a given subject and task.
get_conn_matrix
(subject[, subject_ts, ...])Computes the connectivity matrix for a given subject.
get_sessions
(subject)Returns a list of session names for a given subject.
get_ts_paths
(subject, task)- param subject:
The subject ID.
parcellate
(subject[, parcellation, task, ...])- param subject:
subject id
- clean_signal(subject, task='rest', parcellation='schaefer', n_parcels=1000, gsr=False, save=False, save_to=None)[source]¶
Cleans the time series for a given subject using a specified parcellation.
- Parameters:
subject (str) – The ID of the subject to clean the time series for.
task (str, optional) – The name of the task to use. Default is ‘rest’.
parcellation (str, optional) – The name of the parcellation to use. Default is ‘schaefer’.
n_parcels (int, optional) – The number of parcels to use. Default is 1000.
gsr (bool, optional) – Whether to use global signal regression. Default is False.
save (bool, optional) – Whether to save the cleaned time series. Default is False.
save_to (str, optional) – The path to save the cleaned time series. If None, the time series will be saved to the default directory. Default is None.
- Returns:
The cleaned time series of shape (n_sessions, n_parcels, n_volumes).
- Return type:
np.ndarray
- get_confounds(subject, task, no_nans=True, pick_confounds=None)[source]¶
Returns a list of confounds for a given subject and task.
- Parameters:
subject (str) – The ID of the subject.
task (str) – The name of the task.
no_nans (bool, optional) – Whether to impute NaNs in the confounds. Default is True.
pick_confounds (list or numpy.ndarray, optional) – The confounds to be picked from the dataframe. If None, the default confounds will be used. Default is None.
- Returns:
A list of confounds.
- Return type:
list
- get_conn_matrix(subject, subject_ts=None, parcellation='schaefer', task='rest', concat_ts=False, n_parcels=1000, gsr=False, z_transformed=True, save=False, save_to=None)[source]¶
Computes the connectivity matrix for a given subject.
- Parameters:
subject (str) – The ID of the subject to compute the connectivity matrix for.
subject_ts (str, optional) – The path to the cleaned time series. If None, the time series will be cleaned using the clean_signal method. Default is None.
parcellation (str, optional) – The name of the parcellation to use. Default is ‘schaefer’.
task (str, optional) – The name of the task to use. Default is ‘rest’.
concat_ts (bool, optional) – Whether to compute the connectivity matrix on concatenated time series (e.g., if several sessions available). Default is False.
n_parcels (int, optional) – The number of parcels to use. Default is 1000.
gsr (bool, optional) – Whether to use global signal regression. Default is False.
z_transformed (bool, optional) – Whether to apply Fisher’s z transform to the connectivity matrix. Default is True.
save (bool, optional) – Whether to save the connectivity matrix. Default is False.
save_to (str, optional) – The path to save the connectivity matrix. If None, the matrix will be saved to the default directory. Default is None.
- Returns:
The connectivity matrix of shape (n_sessions, n_parcels, n_parcels).
- Return type:
np.ndarray
- get_sessions(subject)[source]¶
Returns a list of session names for a given subject. If the subject has no sessions, an empty list is returned.
- Parameters:
subject (str) – The label of the subject to retrieve session names for.
- Returns:
A list of session names for the given subject.
- Return type:
list of str
- get_ts_paths(subject, task)[source]¶
- Parameters:
subject (str) – The subject ID.
task (str) – The task name.
- Returns:
ts_paths – A list of paths to the time series files.
- Return type:
list
- parcellate(subject, parcellation='schaefer', task='rest', n_parcels=1000, gsr=False)[source]¶
- Parameters:
subject (str) – subject id
parcellation (str) – parcellation to use
task (str) – task to use
n_parcels (int) – number of parcels to use
gsr (bool) – whether to use global signal regression
- Returns:
parc_ts_list – list of parcellated time series
- Return type:
list
- class NeuroConn.preprocessing.preprocessing.RawDataset(BIDS_path)[source]¶
Bases:
object
- Attributes:
- data_description
- name
- participant_data
- subjects
Methods
docker_fmriprep
(subject, fs_license_path[, ...])Runs the fMRIprep pipeline in a Docker container for a given subject.
- property data_description¶
- docker_fmriprep(subject, fs_license_path, skip_bids_validation=True, fs_reconall=True, mem=5000, task='rest')[source]¶
Runs the fMRIprep pipeline in a Docker container for a given subject.
- Parameters:
subject (str) – The label of the participant to process.
skip_bids_validation (bool, optional) – Whether to skip BIDS validation. Default is True.
fs_license_path (str, optional) – The path to the (full) FreeSurfer license file
fs_reconall (bool, optional) – Whether to run FreeSurfer’s recon-all. Default is True.
mem (int, optional) – The amount of memory to allocate to the Docker container, in MB. Default is 5000.
task (str, optional) – The ID of the task to preprocess, or None to preprocess all tasks. Default is ‘rest’.
- Return type:
None
- property name¶
- property participant_data¶
- property subjects¶