Skip to content

Commit 0a53108

Browse files
committed
🥅 Catch and release no-regressors
1 parent 836d100 commit 0a53108

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

CPAC/nuisance/nuisance.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ def erode_mask_WM(wf, cfg, strat_pool, pipe_num, opt=None):
23632363
outputs=["desc-confounds_timeseries", "censor-indices"],
23642364
)
23652365
def nuisance_regressors_generation_EPItemplate(wf, cfg, strat_pool, pipe_num, opt=None):
2366-
return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, opt, "bold")
2366+
return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, "bold")
23672367

23682368

23692369
@nodeblock(
@@ -2407,18 +2407,22 @@ def nuisance_regressors_generation_EPItemplate(wf, cfg, strat_pool, pipe_num, op
24072407
outputs=["desc-confounds_timeseries", "censor-indices"],
24082408
)
24092409
def nuisance_regressors_generation_T1w(wf, cfg, strat_pool, pipe_num, opt=None):
2410-
return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, opt, "T1w")
2410+
return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, "T1w")
24112411

24122412

24132413
def nuisance_regressors_generation(
24142414
wf: Workflow,
24152415
cfg: Configuration,
24162416
strat_pool: StratPool,
24172417
pipe_num: int,
2418-
opt: dict,
24192418
space: Literal["T1w", "bold"],
24202419
) -> tuple[Workflow, dict]:
24212420
"""Generate nuisance regressors."""
2421+
try:
2422+
opt = strat_pool.regressor_dct
2423+
except LookupError:
2424+
# no regressors to generate
2425+
return wf, {}
24222426
prefixes = [f"space-{space}_"] * 2
24232427
reg_tool = None
24242428
if space == "T1w":
@@ -2659,7 +2663,11 @@ def nuisance_regression(wf, cfg, strat_pool: StratPool, pipe_num, opt, space, re
26592663
26602664
outputs : dict
26612665
"""
2662-
opt = strat_pool.regressor_dct
2666+
try:
2667+
opt = strat_pool.regressor_dct
2668+
except LookupError:
2669+
# no regressors
2670+
return wf, {}
26632671
bandpass = "Bandpass" in opt
26642672
bandpass_before = (
26652673
bandpass

0 commit comments

Comments
 (0)