Tedana (0.0.7) index out of bounds error

multi-echo
#1

Hi,

I’ve been running the following command for data from 45 runs. Two runs give an “index out of bounds” error after ICA fails to converge. The images used and the adaptive mask look reasonable to me. Output is below. I’d appreciate any thoughts on why these errors come up for these two runs and what can be done about it.

Thanks, Dara

tedana -d te1_mcf_ts_brain.nii te2_mcf_ts_brain.nii te3_mcf_ts_brain.nii -e 13.0 35.9 58.0 --out-dir=/u/scratch/d/darag/multiecho/11055_2/TED.mcf_ts_brain --verbose

/u/local/apps/python/3.6.1/lib/python3.6/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
/u/home/d/darag/.local/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.23. 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-serialize those models with scikit-learn 0.21+.
warnings.warn(msg, category=DeprecationWarning)
INFO:tedana.workflows.tedana:Using output directory: /u/scratch/d/darag/multiecho/11055_2/TED.mcf_ts_brain
INFO:tedana.workflows.tedana:Loading input data: [‘te1_mcf_ts_brain.nii’, ‘te2_mcf_ts_brain.nii’, ‘te3_mcf_ts_brain.nii’]
INFO:tedana.workflows.tedana:Computing EPI mask from first echo
WARNING:tedana.utils:279 voxels in user-defined mask do not have good signal. Removing voxels from 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:Making initial component selection guess from PCA 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.decomposition.eigendecomp:Saving PCA results to: /u/scratch/d/darag/multiecho/11055_2/TED.mcf_ts_brain/pcastate.pkl
INFO:tedana.decomposition.eigendecomp:Selected 283 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 “/u/home/d/darag/.local/bin/tedana”, line 11, in
sys.exit(_main())
File “/u/home/d/darag/.local/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 453, in _main
tedana_workflow(**vars(options))
File “/u/home/d/darag/.local/lib/python3.6/site-packages/tedana/workflows/tedana.py”, line 379, in tedana_workflow
n_echos)
File “/u/home/d/darag/.local/lib/python3.6/site-packages/tedana/selection/select_comps.py”, line 250, in selcomps
rho_elbow = np.mean((getelbow(comptable.loc[ncls, ‘rho’], return_val=True),
File “/u/home/d/darag/.local/lib/python3.6/site-packages/tedana/selection/_utils.py”, line 71, in getelbow
p = coords - coords[:, 0].reshape(2, 1)
IndexError: index 0 is out of bounds for axis 1 with size 0

#2

This appears to be a bug in tedana’s component selection algorithm. I think that what is happening is that no potential BOLD components are being found in the first step of the algorithm, so then a later step is attempting to find an elbow for an empty array. I’ve opened an issue (ME-ICA/tedana#297) and we will try to fix this by the next release.

My intuition, though, is that no candidate BOLD components are being detected due to the fact that ICA failed to converge. One thing that might fix this would be to increase the maximum number of iterations (--maxit) and/or the maximum number of restarts (--maxrestart) until ICA does end up converging.

2 Likes
#3

We pushed a new change to tedana’s master branch that should fix the problem. We haven’t drafted a new release yet, but you can use the current version on GitHub.

#4

Just to clarify, this won’t fix the problem of not finding BOLD components – for that, I would (as @tsalo recommends) try running with more iterations on the ICA. It will, though, provide a more helpful error message to explain what happened !

#5

Thanks to both of you! I will increase the max number of iterations and restarts; hopefully, that will help convergence.

#6

Hi Taylor & Elizabeth,

Increasing the number of iterations and restarts ( --maxit 100 --maxrestart 100) did not result in ICA convergence for any of the 3 runs.

A prior post suggested that the number of volumes has an impact on convergence. The 3 runs for which convergence fails (from 3 different participants) have no fewer volumes than the ones that converged.

Would you suggest increasing the number of iterations and restarts even further? Not quite sure what to do conclude at this point. Which images/files would you recommend examining to determine where the issue might lie?

Given the inconsistency of ICA convergence across runs, I’m considering using the non-denoised ts_OC_whitened.nii output image instead of the denoised image for further analyses. Is that something you would recommend? I’m hesitant to combine denoised and non-denoised (not converged) data. That’s why I’m considering using non-denoised images throughout even though it’s sub-optimal.

Thanks, Dara

#7

The default maxit is 500. If you’re trying to increase likelihood of convergence, I’d increase that to something like 5000-10000.

If you run with --debug, you can check the run file to see how many components are retained by the PCA stage. PCA is run before ICA in order to make ICA more likely to converge, but we’ve noticed in the past that the default settings for PCA often fail to reduce the dimensionality of the data at all (i.e., the number of components retained by PCA is equal to the number of volumes in the dataset minus one). You can try running tedana with the Kundu PCA decision tree, which is more aggressive about dimensionality reduction, if you find that the data aren’t being reduced much in the runs that are failing too converge. The argument for that is --tedpca kundu.

I agree that it’s probably a bad idea to combine OC data with denoised data in your analyses. If you’re looking to skip the denoising, you should use to optimally combined data (ts_OC.nii), not the dimensionally reduced optimally combined data (ts_OC_whitened.nii). ts_OC_whitened.nii has undergone PCA to dimensionally reduce the data prior to ICA, but the low-variance components are supposed to be retained in the denoised data.

#8

Thanks. When increasing the maxit to 10000, there is still no convergence for these 3 subjects - even when running with the Kundu PCA decision tree option (--tedpca kundu). In fact, more subjects do not converge with that option than with the default MLE.

I’d like to use the ts_OC.nii image, but in cases in which convergence does not occur, only the ts_OC_whitened.nii image is available. Is the ts_OC.nii image generated after convergence?

Thanks, Dara

#9

The file ts_OC.nii should be written out regardless of convergence. Is it possible that the workflow failed at some point? Would you mind sharing the full log or run-file (if you ran with --debug)?