Fmriprep to tedana

fmriprep
multi-echo

#1

Hi NeuroStars,

New to both fmriprep and tedana (& multiecho in general). We’ve been able to successfully run fmriprep on some multiecho data on our cluster (yay!) but are getting the error below when we try to use tedana. It’s not immediately clear to us what this error means (e.g. is it an issue with the data? the preproc? the inputs?). See call below the error. We’ve also tried running without masks and with multiple masks, but don’t feel familiar enough with the other flags to go with anything other than the defaults. Any thoughts/advice greatly appreciated!

[failed] tedana output
attempting to run tedana for sub-06ME

/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:161: RuntimeWarning: invalid value encountered in true_divide
F_S0 = (alpha - SSE_S0) * (n_echos - 1) / (SSE_S0)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:168: RuntimeWarning: invalid value encountered in true_divide
F_R2 = (alpha - SSE_R2) * (n_echos - 1) / (SSE_R2)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:177: RuntimeWarning: invalid value encountered in greater
F_S0[F_S0 > F_MAX] = F_MAX
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:178: RuntimeWarning: invalid value encountered in greater
F_R2[F_R2 > F_MAX] = F_MAX
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:161: RuntimeWarning: divide by zero encountered in true_divide
F_S0 = (alpha - SSE_S0) * (n_echos - 1) / (SSE_S0)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
“This module will be removed in 0.20.”, DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
from numpy.core.umath_tests import inner1d
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/learning_curve.py:22: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the functions are moved. This module will be removed in 0.20
DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:2253: RuntimeWarning: invalid value encountered in true_divide
return (a - mns) / sstd
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/selection/select_comps.py:555: RuntimeWarning: invalid value encountered in greater
np.union1d(np.union1d(all_comps[spz > 1],
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/selection/select_comps.py:628: RuntimeWarning: invalid value encountered in greater
np.union1d(np.union1d(all_comps[spz > 1],
Extremely limited reliable BOLD signal space! Not filtering components beyond BOLD/non-BOLD guesses.
No BOLD components detected! Please check data and results!

tedana call
Echo1=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mid_acq-normal_rec-magnitude_run-01_echo-1_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo2=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mid_acq-normal_rec-magnitude_run-01_echo-2_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo3=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mid_acq-normal_rec-magnitude_run-01_echo-3_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo4=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mid_acq-normal_rec-magnitude_run-01_echo-4_bold_space-MNI152NLin2009cAsym_preproc.nii.gz

    Mask1=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-1_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz

    tedana -d ${Echo1} ${Echo2} ${Echo3} ${Echo4} -e 12.2 29.48 46.76 64.04 --mask ${Mask1} --label ${SUBJ_ID}_tedana

#2

Hi @alioco !

It looks like this is something to do with the input data, but it’s hard to say what without looking at the data itself. Is the fmriprep output something you could share ?

tedana is undergoing a bit of an internal overhaul right now, so hopefully this is something we can address internally. If you’re anxious to process in the mean time, I’d recommend either using the afni_proc.py implementation of tedana or using some of the older meica.py code.


#3

Thanks so much, @emdupre !

Let me double check RE sharing the data-- assuming we can, what would be the preferred way for us to do this? In the mean time, will definitely try the implementations you suggested!


#4

Thanks @alioco ! If you have an institutional Box account or something similar and can send a link (Google drive even works great), I’d be able to take a look.


#5

Hi @emdupre , we tried to run tedana on another subject’s multi-echo fmriprep outputs and this time got different errors and are missing most of the derivatives. See log and list of derivatives below. If it would also be helpful to see the fmriprep outputs for this subject, pls let me know!

Thanks!

Log
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[ tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:161: RuntimeWarning: invalid value encountered in true_divide
F_S0 = (alpha - SSE_S0) * (n_echos - 1) / (SSE_S0)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:168: RuntimeWarning: invalid value encountered in true_divide
F_R2 = (alpha - SSE_R2) * (n_echos - 1) / (SSE_R2)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:177: RuntimeWarning: invalid value encountered in greater
F_S0[F_S0 > F_MAX] = F_MAX
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:178: RuntimeWarning: invalid value encountered in greater
F_R2[F_R2 > F_MAX] = F_MAX
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/fit.py:161: RuntimeWarning: divide by zero encountered in true_divide
F_S0 = (alpha - SSE_S0) * (n_echos - 1) / (SSE_S0)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_select ion module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This modu le will be removed in 0.20.
“This module will be removed in 0.20.”, DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should n ot be imported. It will be removed in a future NumPy release.
from numpy.core.umath_tests import inner1d
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/grid_search.py:42: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection m odule into which all the refactored classes and functions are moved. This module will be removed in 0.20.
DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/sklearn/learning_curve.py:22: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selectio n module into which all the functions are moved. This module will be removed in 0.20
DeprecationWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/optimize/minpack.py:436: RuntimeWarning: Number of calls to function has reached maxfev = 1200.
warnings.warn(errors[info][0], RuntimeWarning)
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[ tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[ tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval

output files
accepted.txt comp_table_pca.txt dn_ts_OC.nii hik_ts_OC.nii meica_mix.1D midk_ts_OC.nii s0v.nii t2ss.nii tsoc_nogs.nii
betas_hik_OC.nii comp_table.txt dn_ts_OC_T1c.nii hik_ts_OC_T1c.nii meica_mix_T1c.1D pcastate.pkl s0vs.nii t2svG.nii tsoc_orig.nii
betas_hik_OC_T1c.nii csdata.txt feats_OC2.nii lowk_ts_OC.nii mepca_mix.1D rejected.txt sphis_hik.nii t2sv.nii veins_l0.nii
betas_OC.nii csstepdata.json glsig.1D __meica_mix.1D midk_rejected.txt s0vG.nii T1gs.nii ts_OC.nii veins_l1.nii


#6

Hi @alioco ! It looks like those are actually all of the right derivatives – were there others you were expecting ?

I haven’t yet had a chance to look at the files you sent but that is high on my to-do list ! Will update ASAP, but please feel free to post any other errors you come across as well !


#7

Oh, great news! I was under the impression that medn files should be used for task analysis (based on https://tedana.readthedocs.io/en/latest/approach.html#derivatives)- which files should we actually use @emdupre ? tsoc_orig or tsoc_nogs? Sorry if I’m missing the documentation somewhere… Thank you! :slightly_smiling_face:


#8

Those should definitely be updated ! Would you like to open an issue on GitHub for that ?

I’d recommend the dn_ts_OC – this is the optionally combined time series, removing components identified as noise.


#9

hey @emdupre just wanted to give you a quick update-- looks like for a different subject than the one I sent you, we only get the BOLD error for one (of four) runs of data, although it doesn’t say no BOLD components detected just “Extremely limited reliable BOLD signal space! Not filtering components beyond BOLD/non-BOLD guesses.” I can send you this run if you’d like. Turns out for the subject I did send you, we’d specified the mask incorrectly :see_no_evil: so the two mid runs seem fine, but the two mem runs crash with the following error:
attempting to run tedana for sub-06ME

/share/apps/tedana/0.0.4/lib/python3.6/site-packages/scipy/stats/stats.py:1713: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/combine.py:35: RuntimeWarning: divide by zero encountered in true_divide
alpha = tes * np.exp(-tes / ft2s)
Traceback (most recent call last):
File “/share/apps/tedana/0.0.4/bin/tedana”, line 11, in
sys.exit(_main())
File “/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 447, in _main
tedana_workflow(**vars(options))
File “/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 387, in tedana_workflow
OCcatd = model.make_optcom(catd, tes, mask, t2s=t2sG, combmode=combmode)
File “/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/combine.py”, line 156, in make_optcom
combined = _combine_t2s(data, tes, t2s)
File “/share/apps/tedana/0.0.4/lib/python3.6/site-packages/tedana/model/combine.py”, line 48, in _combine_t2s
combined = np.average(data, axis=1, weights=alpha)
File “/share/apps/tedana/0.0.4/lib/python3.6/site-packages/numpy/lib/function_base.py”, line 386, in average
“Weights sum to zero, can’t be normalized”)
ZeroDivisionError: Weights sum to zero, can’t be normalized

Sorry if I’m sending you on a wild goose chase! I’m almost sure we didn’t specify anything incorrectly this time, but here’s the tedana call, just in case:
Echo1=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-1_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo2=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-2_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo3=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-3_bold_space-MNI152NLin2009cAsym_preproc.nii.gz
Echo4=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-4_bold_space-MNI152NLin2009cAsym_preproc.nii.gz

    Mask1=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-1_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz

Mask2=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-2_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz

Mask3=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-3_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz

Mask4=${WorkDir}/${fmriprepdir}/fmriprep/${SUBJ_ID}/func/sub-06ME_task-mem_acq-normal_rec-magnitude_run-01_echo-4_bold_space-MNI152NLin2009cAsym_brainmask.nii.gz

    tedana -d ${Echo1} ${Echo2} ${Echo3} ${Echo4} -e 12.2 29.48 46.76 64.04 --mask ${Mask1} --label ${SUBJ_ID}_tedana