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

[ENH] Add ability to re-run ICA when no BOLD components are found #663

Merged
merged 9 commits into from
Jan 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tedana/workflows/tedana.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,10 @@ def tedana_workflow(data, tes, out_dir='.', mask=None,

# Perform ICA, calculate metrics, and apply decision tree
# Restart when ICA fails to converge or too few BOLD components found
bad_decomp = True
keep_restarting = True
n_restarts = 0
seed = fixed_seed
while bad_decomp:
while keep_restarting:
mmix_orig, seed = decomposition.tedica(
dd, n_components, seed,
maxit, maxrestart=(maxrestart - n_restarts)
Expand All @@ -548,8 +548,9 @@ def tedana_workflow(data, tes, out_dir='.', mask=None,
LGR.warning("No BOLD components found. Re-attempting ICA.")
elif (n_bold_comps == 0):
LGR.warning("No BOLD components found, but maximum number of restarts reached.")
keep_restarting = False
tsalo marked this conversation as resolved.
Show resolved Hide resolved
elif (n_restarts >= maxrestart) or (n_bold_comps != 0):
bad_decomp = False
keep_restarting = False

# Write out ICA files.
comp_names = [io.add_decomp_prefix(comp, prefix='ica', max_value=comptable.index.max())
Expand Down