Skip to content

Commit 9d45915

Browse files
committed
fix bug - func_reg_input : ['Selected Functional Volume'] & rename config - n4_correct_func_reg_input
1 parent 3a14aab commit 9d45915

File tree

3 files changed

+36
-24
lines changed

3 files changed

+36
-24
lines changed

CPAC/func_preproc/func_ingress.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,6 @@ def connect_func_ingress(workflow, strat_list, c, sub_dict, subject_id,
164164
as_module=True
165165
), name=workflow_name)
166166

167-
if "Selected Functional Volume" in c.func_reg_input:
168-
get_func_volume = pe.Node(interface=afni.Calc(),
169-
name='get_func_volume_{0}'.format(
170-
num_strat))
171-
172-
get_func_volume.inputs.set(
173-
expr='a',
174-
single_idx=c.func_reg_input_volume,
175-
outputtype='NIFTI_GZ'
176-
)
177-
workflow.connect(func_wf, 'outputspec.rest',
178-
get_func_volume, 'in_file_a')
179-
180167
# wire in the scan parameter workflow
181168
workflow.connect(func_wf, 'outputspec.scan_params',
182169
scan_params, 'data_config_scan_params')
@@ -205,9 +192,4 @@ def connect_func_ingress(workflow, strat_list, c, sub_dict, subject_id,
205192

206193
strat.set_leaf_properties(func_wf, 'outputspec.rest')
207194

208-
if "Selected Functional Volume" in c.func_reg_input:
209-
strat.update_resource_pool({
210-
'selected_func_volume': (get_func_volume, 'out_file')
211-
})
212-
213195
return (workflow, diff, blip, fmap_rp_list)

CPAC/func_preproc/func_preproc.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ def create_func_preproc(skullstrip_tool, motion_correct_tool,
796796
'mask',
797797
'skullstrip',
798798
'func_mean',
799+
'get_func_volume',
799800
'preprocessed',
800801
'preprocessed_median',
801802
'preprocessed_mask',
@@ -1296,7 +1297,35 @@ def create_func_preproc(skullstrip_tool, motion_correct_tool,
12961297
preproc.connect(skullstrip_func, 'outputspec.func_brain',
12971298
func_mean, 'in_file')
12981299

1299-
if config.n4_correct_mean_EPI :
1300+
if "Selected Functional Volume" in conig.func_reg_input:
1301+
get_func_volume = pe.Node(interface=afni.Calc(),
1302+
name='get_func_volume')
1303+
1304+
get_func_volume.inputs.set(
1305+
expr='a',
1306+
single_idx=config.func_reg_input_volume,
1307+
outputtype='NIFTI_GZ'
1308+
)
1309+
workflow.connect(skullstrip_func, 'outputspec.func_brain',
1310+
get_func_volume, 'in_file_a')
1311+
1312+
if config.n4_correct_func_reg_input :
1313+
1314+
get_func_volume_n4_corrected = pe.Node(interface = ants.N4BiasFieldCorrection(dimension=3, copy_header=True, bspline_fitting_distance=200), shrink_factor=2,
1315+
name='func_mean_n4_corrected')
1316+
get_func_volume_n4_corrected.inputs.args = '-r True'
1317+
1318+
preproc.connect(get_func_volume, 'out_file',
1319+
get_func_volume_n4_corrected, 'input_image')
1320+
preproc.connect(get_func_volume_n4_corrected, 'output_image',
1321+
output_node, 'get_func_volume')
1322+
1323+
else:
1324+
preproc.connect(get_func_volume, 'out_file',
1325+
output_node, 'get_func_volume')
1326+
1327+
if config.n4_correct_func_reg_input :
1328+
13001329
func_mean_n4_corrected = pe.Node(interface = ants.N4BiasFieldCorrection(dimension=3, copy_header=True, bspline_fitting_distance=200), shrink_factor=2,
13011330
name='func_mean_n4_corrected')
13021331
func_mean_n4_corrected.inputs.args = '-r True'
@@ -1820,6 +1849,7 @@ def connect_func_preproc(workflow, strat_list, c, unique_id=None):
18201849

18211850
strat.update_resource_pool({
18221851
'mean_functional': (func_preproc, 'outputspec.func_mean'),
1852+
'selected_func_volume': (func_preproc, 'outputspec.get_func_volume'),
18231853
'functional_preprocessed_mask': (func_preproc, 'outputspec.preprocessed_mask'),
18241854
'functional_preprocessed': (func_preproc, 'outputspec.preprocessed'),
18251855
'functional_brain_mask': (func_preproc, 'outputspec.mask'),
@@ -1910,6 +1940,7 @@ def connect_func_preproc(workflow, strat_list, c, unique_id=None):
19101940
'motion_correction_method': motion_correct_tool,
19111941
'motion_correction_ref': motion_correct_ref,
19121942
'mean_functional': (func_preproc, 'outputspec.func_mean'),
1943+
'selected_func_volume': (func_preproc, 'outputspec.get_func_volume'),
19131944
'functional_preprocessed_mask': (func_preproc, 'outputspec.preprocessed_mask'),
19141945
'movement_parameters': (func_preproc, 'outputspec.movement_parameters'),
19151946
'max_displacement': (func_preproc, 'outputspec.max_displacement'),

dev/docker_data/default_pipeline.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,15 +814,14 @@ funcRegFSLinterpolation: sinc
814814
# Options: ['Mean Functional', 'Selected Functional Volume']
815815
func_reg_input : ['Mean Functional']
816816

817-
818-
# Run ANTs’ N4 Bias Field Correction on the input BOLD average(mean EPI)
819-
n4_correct_mean_EPI : False
820-
821-
822817
# Only for when 'Use as Functional-to-Anatomical Registration Input' is set to 'Selected Functional Volume'. Input the index of which volume from the functional 4D timeseries input file you wish to use as the input for functional-to-anatomical registration.
823818
func_reg_input_volume : 0
824819

825820

821+
# Run ANTs’ N4 Bias Field Correction on the input of functional-to-anatomical registration (mean of the functional/EPI or one of the volumes from the functional 4D timeseries)
822+
n4_correct_func_reg_input : False
823+
824+
826825
# Choose which tool to be used in functional masking - AFNI (3dAutoMask), FSL (BET), FSL_AFNI (BET+3dAutoMask), or refine functional mask by registering anatomical mask to functional space.
827826
# Options: ['AFNI', 'FSL', 'FSL_AFNI', 'Anatomical_Refined']
828827
functionalMasking : ['AFNI']

0 commit comments

Comments
 (0)