From 710cc1049816f721ba5dffb7a72b6306991f459d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= Date: Wed, 3 Apr 2024 16:58:30 +0200 Subject: [PATCH] 80GC group analysis select files using 3dTCat --- narps_open/pipelines/team_80GC.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/narps_open/pipelines/team_80GC.py b/narps_open/pipelines/team_80GC.py index 368abc99..d643e6e9 100644 --- a/narps_open/pipelines/team_80GC.py +++ b/narps_open/pipelines/team_80GC.py @@ -321,6 +321,19 @@ def select_subbrick(in_file: str, index: int): """ return (in_file, index) + def select_subbrick_str(in_file: str, index: int): + """ + Create a string for AFNI interfaces allowing to select a sub-brick for input file. + + Parameters : + - in_file: str, files to select the sub-brick from + - index: int, index of the desired sub-brick in in_file + + Returns : + - out: str + """ + return f'{in_file}\'[{index}]\'' + def get_group_level_analysis(self): """ Return a workflow for the group level analysis. @@ -486,15 +499,15 @@ def get_group_level_analysis(self): # Function select_subbrick - Select the subbrick index of 3dttest++ output file select_subbrick = MapNode(Function( - function = lambda a, b : f'{a}\'[{b}]\'', - input_names = ['a', 'b'], + function = self.select_subbrick_str, + input_names = ['in_file', 'index'], output_names = ['out'] ), name = 'select_subbrick', - iterfield = 'b' + iterfield = 'index' ) - select_subbrick.inputs.b = [0, 1, 2] - group_level.connect(t_test, 'out_file', select_subbrick, 'a') + select_subbrick.inputs.index = [0, 1, 2] + group_level.connect(t_test, 'out_file', select_subbrick, 'in_file') # SELECT DATASET - Split output of 3dttest++ select_output = MapNode(TCatSubBrick(), name = 'select_output', iterfield = 'in_files')