Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 76a1c9d

Browse files
committed
fix: run_1 goes faster
1 parent 2d8fabf commit 76a1c9d

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

preafq/run_1.py

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ def run_preAFQ(dwi_file, dwi_file_AP, dwi_file_PA, bvec_file, bval_file,
6969
# prep.inputs.inputnode.alt_file = dwi_file_PA
7070
prep.inputs.inputnode.in_bvec = bvec_file
7171
prep.inputs.inputnode.in_bval = bval_file
72+
eddy = prep.get_node('fsl_eddy')
73+
eddy.inputs.repol = True
74+
eddy.inputs.niter = 1
75+
76+
77+
7278
# print(prep.inputs)
7379

7480
merge = pe.Node(fsl.Merge(dimension='t'), name="mergeAPPA")
@@ -78,7 +84,7 @@ def run_preAFQ(dwi_file, dwi_file_AP, dwi_file_PA, bvec_file, bval_file,
7884
fslroi = pe.Node(fsl.ExtractROI(t_min=0, t_size=1), name="fslroi")
7985
wf.connect(prep, "outputnode.out_file", fslroi, "in_file")
8086

81-
bbreg = pe.Node(fs.BBRegister(contrast_type="t2", init="fsl",
87+
bbreg = pe.Node(fs.BBRegister(contrast_type="t2", init="coreg",
8288
out_fsl_file=True,
8389
subjects_dir=subjects_dir,
8490
epi_mask=True),
@@ -151,27 +157,6 @@ def get_orig(subjects_dir, sub):
151157
name='threshold2')
152158
wf.connect(voltransform, "transformed_file", threshold2, "in_file")
153159

154-
# art detect stuff
155-
156-
motion = pe.Node(niu.Function(input_names=['eddy_params'],
157-
output_names=['motion_file'],
158-
function=get_flirt_motion_parameters),
159-
name="reformat_motion")
160-
161-
wf.connect(prep, "fsl_eddy.out_parameter", motion, "eddy_params")
162-
163-
art = pe.Node(interface=ArtifactDetect(), name="art")
164-
art.inputs.use_differences = [True, True]
165-
art.inputs.save_plot = False
166-
art.inputs.use_norm = True
167-
art.inputs.norm_threshold = 3
168-
art.inputs.zintensity_threshold = 9
169-
art.inputs.mask_type = 'spm_global'
170-
art.inputs.parameter_source = 'FSL'
171-
172-
wf.connect(motion, "motion_file", art, "realignment_parameters")
173-
wf.connect(prep, "outputnode.out_file", art, "realigned_files")
174-
175160
datasink = pe.Node(nio.DataSink(), name="sinker")
176161
datasink.inputs.base_directory = out_dir
177162
datasink.inputs.substitutions = [
@@ -193,17 +178,24 @@ def get_orig(subjects_dir, sub):
193178
# ("eddy_corrected_", dwi_fname.replace("dwi", "")),
194179
("stats.eddy_corrected", dwi_fname.replace("dwi", "artStats")),
195180
("eddy_corrected.eddy_parameters", dwi_fname+".eddy_parameters"),
181+
("qc/eddy_corrected", "qc/"+dwi_fname),
196182
("derivatives/preafq", "derivatives/{}/preafq".format(bids_sub_name))
197183
]
198184

199-
wf.connect(art, "statistic_files", datasink, "preafq.qc.@artstat")
200-
wf.connect(art, "outlier_files", datasink, "preafq.qc.@artoutlier")
201-
202185
wf.connect(prep, "outputnode.out_file", datasink, "preafq.dwi.@corrected")
203186
wf.connect(prep, "outputnode.out_bvec", datasink, "preafq.dwi.@rotated")
204187
wf.connect(prep, "fsl_eddy.out_parameter",
205188
datasink, "preafq.qc.@eddyparams")
206189

190+
wf.connect(prep, "fsl_eddy.out_movement_rms",
191+
datasink, "preafq.qc.@eddyparamsrms")
192+
wf.connect(prep, "fsl_eddy.out_outlier_report",
193+
datasink, "preafq.qc.@eddyparamsreport")
194+
wf.connect(prep, "fsl_eddy.out_restricted_movement_rms",
195+
datasink, "preafq.qc.@eddyparamsrestrictrms")
196+
wf.connect(prep, "fsl_eddy.out_shell_alignment_parameters",
197+
datasink, "preafq.qc.@eddyparamsshellalign")
198+
207199
wf.connect(get_tensor, "out_file", datasink, "preafq.dti.@tensor")
208200
wf.connect(get_tensor, "fa_file", datasink, "preafq.dti.@fa")
209201
wf.connect(get_tensor, "md_file", datasink, "preafq.dti.@md")

0 commit comments

Comments
 (0)