Skip to content

Commit

Permalink
Merge pull request #264 from effigies/fix/revert_to_fast
Browse files Browse the repository at this point in the history
FIX: Revert to FAST for tissue probability maps
  • Loading branch information
effigies authored Sep 1, 2021
2 parents 80f0c80 + fc04f8a commit bd27239
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ install_requires =
matplotlib >= 2.2.0
nibabel >= 3.0.1
nipype >= 1.5.1
nilearn ~= 0.6.2
niworkflows ~= 1.3.1
numpy
packaging
Expand Down
37 changes: 14 additions & 23 deletions smriprep/workflows/anatomical.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,31 +408,28 @@ def _check_img(img):
]),
])

if not freesurfer: # Flag --fs-no-reconall is set - return
# Brain tissue segmentation - FAST produces: 0 (bg), 1 (wm), 2 (csf), 3 (gm)
t1w_dseg = pe.Node(fsl.FAST(segments=True, no_bias=True, probability_maps=True),
name='t1w_dseg', mem_gb=3)
lut_t1w_dseg.inputs.lut = (0, 3, 1, 2) # Maps: 0 -> 0, 3 -> 1, 1 -> 2, 2 -> 3.
fast2bids = pe.Node(niu.Function(function=_probseg_fast2bids), name="fast2bids",
run_without_submitting=True)
# Brain tissue segmentation - FAST produces: 0 (bg), 1 (wm), 2 (csf), 3 (gm)
t1w_dseg = pe.Node(fsl.FAST(segments=True, no_bias=True, probability_maps=True),
name='t1w_dseg', mem_gb=3)
lut_t1w_dseg.inputs.lut = (0, 3, 1, 2) # Maps: 0 -> 0, 3 -> 1, 1 -> 2, 2 -> 3.
fast2bids = pe.Node(niu.Function(function=_probseg_fast2bids), name="fast2bids",
run_without_submitting=True)
workflow.connect([
(buffernode, t1w_dseg, [('t1w_brain', 'in_files')]),
(t1w_dseg, lut_t1w_dseg, [('partial_volume_map', 'in_dseg')]),
(t1w_dseg, fast2bids, [('partial_volume_files', 'inlist')]),
(fast2bids, anat_norm_wf, [('out', 'inputnode.moving_tpms')]),
(fast2bids, outputnode, [('out', 't1w_tpms')]),
])

if not freesurfer: # Flag --fs-no-reconall is set - return
workflow.connect([
(brain_extraction_wf, buffernode, [
(('outputnode.out_file', _pop), 't1w_brain'),
('outputnode.out_mask', 't1w_mask')]),
(buffernode, t1w_dseg, [('t1w_brain', 'in_files')]),
(t1w_dseg, lut_t1w_dseg, [('partial_volume_map', 'in_dseg')]),
(t1w_dseg, fast2bids, [('partial_volume_files', 'inlist')]),
(fast2bids, anat_norm_wf, [('out', 'inputnode.moving_tpms')]),
(fast2bids, outputnode, [('out', 't1w_tpms')]),
])
return workflow

# Map FS' aseg labels onto three-tissue segmentation
lut_t1w_dseg.inputs.lut = _aseg_to_three()
split_seg = pe.Node(niu.Function(function=_split_segments),
name='split_seg')

# check for older IsRunning files and remove accordingly
fs_isrunning = pe.Node(niu.Function(function=_fs_isRunning),
overwrite=True, name='fs_isrunning')
Expand Down Expand Up @@ -460,12 +457,6 @@ def _check_img(img):
(('outputnode.bias_corrected', _pop), 'in_file')]),
(surface_recon_wf, applyrefined, [
('outputnode.out_brainmask', 'mask_file')]),
(surface_recon_wf, lut_t1w_dseg, [
('outputnode.out_aseg', 'in_dseg')]),
(lut_t1w_dseg, split_seg, [('out', 'in_file')]),
(split_seg, anat_norm_wf, [
('out', 'inputnode.moving_tpms')]),
(split_seg, outputnode, [('out', 't1w_tpms')]),
(surface_recon_wf, outputnode, [
('outputnode.subjects_dir', 'subjects_dir'),
('outputnode.subject_id', 'subject_id'),
Expand Down

0 comments on commit bd27239

Please sign in to comment.