Skip to content

Commit

Permalink
80GC group analysis select files using 3dTCat
Browse files Browse the repository at this point in the history
  • Loading branch information
bclenet committed Apr 3, 2024
1 parent 2e0a16d commit 710cc10
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions narps_open/pipelines/team_80GC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 710cc10

Please sign in to comment.