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 710cc10 commit 66f15a3
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions narps_open/pipelines/team_80GC.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,19 +321,6 @@ 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 @@ -499,7 +486,7 @@ def get_group_level_analysis(self):

# Function select_subbrick - Select the subbrick index of 3dttest++ output file
select_subbrick = MapNode(Function(
function = self.select_subbrick_str,
function = self.select_subbrick,
input_names = ['in_file', 'index'],
output_names = ['out']
),
Expand All @@ -509,11 +496,16 @@ def get_group_level_analysis(self):
select_subbrick.inputs.index = [0, 1, 2]
group_level.connect(t_test, 'out_file', select_subbrick, 'in_file')

# SELECT DATASET - Split output of 3dttest++
# MERGE - Create a list of a single tuple to be passed to TCatSubBricj
subbrick_lists = MapNode(Merge(1), iterfield = 'in1')
subbrick_lists.inputs.no_flatten = True
group_level.connect(select_subbrick, 'out', subbrick_lists, 'in1')

# TCATSUBBRICK - Split output of 3dttest++
select_output = MapNode(TCatSubBrick(), name = 'select_output', iterfield = 'in_files')
select_output.inputs.out_file = 'group_level_tstat.nii'
select_output.inputs.outputtype = 'NIFTI'
group_level.connect(select_subbrick, 'out', select_output, 'in_files')
group_level.connect(subbrick_lists, 'out', select_output, 'in_files')

# DATA SINK - save important files
data_sink = Node(DataSink(), name = 'data_sink')
Expand Down

0 comments on commit 66f15a3

Please sign in to comment.