Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Chris Markiewicz <[email protected]>
  • Loading branch information
oesteban and effigies authored Apr 19, 2020
1 parent f444218 commit 2478862
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions smriprep/workflows/anatomical.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def _check_img(img):
return workflow

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

Expand Down Expand Up @@ -633,7 +633,7 @@ def _pop(inlist):
return inlist


def _aseg_two_three():
def _aseg_to_three():
import numpy as np
# Base struct
aseg_lut = np.zeros((256,), dtype="int")
Expand Down Expand Up @@ -676,10 +676,9 @@ def _split_segments(in_file):
hdr.set_data_dtype('uint8')

out_files = []
for i, label in enumerate(("CSF", "WM", "GM")):
out_fname = str((Path() / f"aseg_label-{label}_mask.nii.gz").absolute())
segment = (data == i + 1).astype('uint8')
segimg.__class__(segment, segimg.affine, hdr).to_filename(out_fname)
for i, label in enumerate(("CSF", "WM", "GM"), 1):
out_fname = str(Path.cwd() / f"aseg_label-{label}_mask.nii.gz")
segimg.__class__(data == i, segimg.affine, hdr).to_filename(out_fname)
out_files.append(out_fname)

return out_files

0 comments on commit 2478862

Please sign in to comment.