From 0a5310884894d0bed5666ef0149e156986d90d55 Mon Sep 17 00:00:00 2001 From: Jon Clucas Date: Fri, 19 Jul 2024 01:16:36 -0400 Subject: [PATCH] :goal_net: Catch and release no-regressors --- CPAC/nuisance/nuisance.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CPAC/nuisance/nuisance.py b/CPAC/nuisance/nuisance.py index 871d18d232..04807755b7 100644 --- a/CPAC/nuisance/nuisance.py +++ b/CPAC/nuisance/nuisance.py @@ -2363,7 +2363,7 @@ def erode_mask_WM(wf, cfg, strat_pool, pipe_num, opt=None): outputs=["desc-confounds_timeseries", "censor-indices"], ) def nuisance_regressors_generation_EPItemplate(wf, cfg, strat_pool, pipe_num, opt=None): - return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, opt, "bold") + return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, "bold") @nodeblock( @@ -2407,7 +2407,7 @@ def nuisance_regressors_generation_EPItemplate(wf, cfg, strat_pool, pipe_num, op outputs=["desc-confounds_timeseries", "censor-indices"], ) def nuisance_regressors_generation_T1w(wf, cfg, strat_pool, pipe_num, opt=None): - return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, opt, "T1w") + return nuisance_regressors_generation(wf, cfg, strat_pool, pipe_num, "T1w") def nuisance_regressors_generation( @@ -2415,10 +2415,14 @@ def nuisance_regressors_generation( cfg: Configuration, strat_pool: StratPool, pipe_num: int, - opt: dict, space: Literal["T1w", "bold"], ) -> tuple[Workflow, dict]: """Generate nuisance regressors.""" + try: + opt = strat_pool.regressor_dct + except LookupError: + # no regressors to generate + return wf, {} prefixes = [f"space-{space}_"] * 2 reg_tool = None if space == "T1w": @@ -2659,7 +2663,11 @@ def nuisance_regression(wf, cfg, strat_pool: StratPool, pipe_num, opt, space, re outputs : dict """ - opt = strat_pool.regressor_dct + try: + opt = strat_pool.regressor_dct + except LookupError: + # no regressors + return wf, {} bandpass = "Bandpass" in opt bandpass_before = ( bandpass