ME-ICA / tedana

TE-dependent analysis of multi-echo fMRI
https://tedana.readthedocs.io
GNU Lesser General Public License v2.1
161 stars 95 forks source link

tedana component selection fails when only one BOLD component detected #402

Closed kristianeschenburg closed 4 years ago

kristianeschenburg commented 5 years ago

Hi

I'm running tedana on a 3 echo data set that has been distortion corrected with either fugue or topup -- the undistorted images look correct. The ICA step fails to converge, and then tedana fails at the spatial clustering of components -- how can I proceed with / fix this situation? Thanks.

Module duecredit not successfully imported due to "No module named 'duecredit'". Package functionality unaffected. /mnt/home/keschenb/anaconda3/lib/python3.6/site-packages/sklearn/externals/joblib/init.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.

  1. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serializ e those models with scikit-learn 0.21+. warnings.warn(msg, category=DeprecationWarning) INFO:tedana.workflows.tedana:Using output directory: ./ME3/fugue INFO:tedana.workflows.tedana:Loading input data: ['rest_e1_pos_undistorted.nii.gz', 'rest_e2_pos_undistorted.nii.g z', 'rest_e3_pos_undistorted.nii.gz'] INFO:tedana.workflows.tedana:Using user-defined mask INFO:tedana.workflows.tedana:Computing T2* map INFO:tedana.combine:Optimally combining data with voxel-wise T2 estimates INFO:tedana.decomposition.eigendecomp:Computing PCA of optimally combined multi-echo data INFO:tedana.decomposition.eigendecomp:Loading PCA from: pcastate.pkl INFO:tedana.decomposition.eigendecomp:Selected 149 components with MLE dimensionality detection WARNING:tedana.decomposition.eigendecomp:ICA attempt 1 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 43 WARNING:tedana.decomposition.eigendecomp:ICA attempt 2 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 44 WARNING:tedana.decomposition.eigendecomp:ICA attempt 3 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 45 WARNING:tedana.decomposition.eigendecomp:ICA attempt 4 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 46 WARNING:tedana.decomposition.eigendecomp:ICA attempt 5 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 47 WARNING:tedana.decomposition.eigendecomp:ICA attempt 6 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 48 WARNING:tedana.decomposition.eigendecomp:ICA attempt 7 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 49 WARNING:tedana.decomposition.eigendecomp:ICA attempt 8 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 50 WARNING:tedana.decomposition.eigendecomp:ICA attempt 9 failed to converge after 500 iterations WARNING:tedana.decomposition.eigendecomp:Random seed updated to 51 WARNING:tedana.decomposition.eigendecomp:ICA attempt 10 failed to converge after 500 iterations INFO:tedana.workflows.tedana:Making second component selection guess from ICA results INFO:tedana.combine:Optimally combining data with voxel-wise T2 estimates INFO:tedana.model.fit:Fitting TE- and S0-dependent models to components INFO:tedana.model.fit:Performing spatial clustering of components Traceback (most recent call last): File "/mnt/home/keschenb/anaconda3/bin/tedana", line 10, in sys.exit(_main()) File "/mnt/home/keschenb/anaconda3/lib/python3.6/site-packages/tedana/workflows/tedana.py", line 453, in _main tedana_workflow(**vars(options)) File "/mnt/home/keschenb/anaconda3/lib/python3.6/site-packages/tedana/workflows/tedana.py", line 379, in tedana_workflow n_echos) File "/mnt/home/keschenb/anaconda3/lib/python3.6/site-packages/tedana/selection/select_comps.py", line 276, in selcomps np.min(comptable.loc[acc_prov, 'variance explained']))) ZeroDivisionError: float division by zero
dowdlelt commented 5 years ago

Hey @kristianeschenburg

First things: Were the data also motion and slice time corrected, as well as distortion corrected? Additionally, what were the echo times, TR, field of view - just to get a better idea of the data?

Also, does the T2* map look appropriate - does it have the shape of your data/ a brain? In other words, does it include the data you expect it to include? Does it have reasonable values (at 3T, a range from 14 to 70 in the cortex could be called reasonable).

You can also look at the optimally combined data - this should look like you input data - except less noisy due to averaging. Anything strange in that?

Edit: To match my comment on neurostars, here https://neurostars.org/t/tedana-ica-fails-to-converge/5105

jbteves commented 5 years ago

@tsalo it looks like division by zero is an error instead of a warning, isn't that unusual? I'm wondering if this is due to high-components, because the various explained must be 0 There's just one component, so the min equals the max, causing the divide by zero error (thanks for the correction @emdupre).

Edit: fixed numerous logical mis-steps.

emdupre commented 5 years ago

The full call is:

https://github.com/ME-ICA/tedana/blob/ae90f409d63fbd46cad17c25b4573ec2c28eca68/tedana/selection/tedica.py#L241-L244

It could have found only one provisionally accepted component, in which case min and max would be the same yielding the divide by zero error. Usually we'd see no accepted components, triggering

https://github.com/ME-ICA/tedana/blob/ae90f409d63fbd46cad17c25b4573ec2c28eca68/tedana/selection/tedica.py#L226-L229

If there's only one accepted component I think we'd still want to quit, here. It just might be useful to provide a more helpful error message ?

jbteves commented 5 years ago

Wow, weird edge case. Yeah, I think we should just do a check for 1 component and put a similar error message IMO. For 2 and above it's probably still not great, but at least we won't cause the 0-divide error. I'll edit my comment to make it clear that I stated the wrong thing.