Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Tutorial 0 #117

Open
ozgum opened this issue May 14, 2024 · 0 comments
Open

Errors in Tutorial 0 #117

ozgum opened this issue May 14, 2024 · 0 comments

Comments

@ozgum
Copy link

ozgum commented May 14, 2024

Hello,

We are learning to use BrainSpace toolbox for gradient analysis on 1 subject. We did the minimal preprocessing (no smoothing, no temporal filtering, no confound regression) in fmriprep (with FreeSurfer’s recon-all) as suggested. We tried to run the Tutorial 0’s code, we are getting errors in “import the dataset as timeseries”, “confound regression” steps.

Our computing environment is Ubuntu 22.04.4 LTS, Python 3.12.2.

We tried the following code:

import nibabel as nib
import numpy as np

filename = 'filename.{}.mgz' # where {} will be replaced with 'lh' and 'rh'
timeseries = [None] * 2
for i, h in enumerate(['lh', 'rh']):
    timeseries[i] = nib.load(filename.format(h)).get_fdata().squeeze()
timeseries = np.vstack(timeseries)

We do not have an functional fmriprep output with .mgz extension, and any lh.mgz rh.mgz files. So, since our file is here:

~/Desktop/deneme/mdd/bids/derivatives/sub-02/func/sub-02_task-rest_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz

We ran the code by writing our output path:

import nibabel as nib
import numpy as np

filename = '~/Desktop/deneme/mdd/bids/derivatives/sub-02/func/sub-02_task-rest_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz' # where {} will be replaced with 'lh' and 'rh'
timeseries = [None] * 2
for i, h in enumerate(['lh', 'rh']):
    timeseries[i] = nib.load(filename.format(h)).get_fdata().squeeze()
timeseries = np.vstack(timeseries)

Then we ran:

from brainspace.datasets import fetch_timeseries_preprocessing
timeseries = fetch_timeseries_preprocessing()
from nilearn.interfaces.fmriprep import load_confounds_strategy
confounds_out = load_confounds_strategy("~/Desktop/deneme/mdd/bids/derivatives/sub-02/func/sub-02_task-rest_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz", denoise_strategy='simple')

We got this error:

ValueError: Could not find associated confound file. The functional derivatives should exist under the same parent directory.

We did not understand this error because our confounds file (sub-02_task-rest_desc-confounds_timeseries.tsv) is in the same directory: “~/Desktop/deneme/mdd/bids/derivatives/sub-02/func”.

Then we saw a different code in your plot_tutorial0.py file to extract the confound columns, so we ran:

import load_confounds
confounds_out=load_confounds("~/Desktop/deneme/mdd/bids/derivatives/sub-02/func/sub-02_task-rest_desc-confounds_timeseries.tsv",
                           strategy='minimal',
                           n_components=0.95,
                           motion_model='6params')

We got this error:

TypeError: 'module' object is not callable.

We are not able to move forward to other tutorials due to these errors, can you please help us figure out these issues?

Thanks in advance, any help is appreciated.

Best,
Ozgum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant