Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add n4_only workflow -- to skip brain extraction #435

Merged
merged 6 commits into from
Dec 11, 2019

Conversation

adelavega
Copy link
Contributor

@adelavega adelavega commented Dec 4, 2019

Allows skipping brain extraction with n4_only workflow.

See: nipreps/smriprep#116

I think the main remaining todo is this comment from @oesteban:

I've been looking at some masks after binarization. I think they would benefit a lot from a binary opening followed by closing to remove the irregular boundary. Also, it would also make sense to fill holes. We might want to implement that as part of the Binarize interface. I'll have a look into this tomorrow.

@pull-assistant
Copy link

pull-assistant bot commented Dec 4, 2019

Score: 0.97

Best reviewed: commit by commit


Optimal code review plan

     Add init_n4_only_wf

     Fix docstring

     Apply suggestions from code review

     FIX: Connection input to binarize

     Update niworkflows/anat/ants.py

     out_mask for Binarize thr_brainmask

Powered by Pull Assistant. Last update 2ce0b5b ... 298f067. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 5, 2019

Codecov Report

Merging #435 into master will decrease coverage by 4.3%.
The diff coverage is 9.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #435      +/-   ##
==========================================
- Coverage   59.98%   55.68%   -4.31%     
==========================================
  Files          57       57              
  Lines        5448     5675     +227     
  Branches      644      647       +3     
==========================================
- Hits         3268     3160     -108     
- Misses       2137     2456     +319     
- Partials       43       59      +16
Flag Coverage Δ
#masks ?
#reportlettests 100% <ø> (ø) ⬆️
#unittests 43.52% <9.52%> (-0.1%) ⬇️
Impacted Files Coverage Δ
niworkflows/anat/ants.py 12.15% <9.52%> (-0.35%) ⬇️
niworkflows/func/tests/test_util.py 0% <0%> (-100%) ⬇️
niworkflows/func/util.py 28% <0%> (-52%) ⬇️
niworkflows/interfaces/fixes.py 47.05% <0%> (-39.22%) ⬇️
niworkflows/engine/workflows.py 26.31% <0%> (-15.79%) ⬇️
niworkflows/interfaces/registration.py 52.15% <0%> (-9.92%) ⬇️
niworkflows/viz/utils.py 74.09% <0%> (-7.52%) ⬇️
niworkflows/interfaces/utils.py 40.71% <0%> (-7.39%) ⬇️
niworkflows/interfaces/ants.py 67.7% <0%> (-6.25%) ⬇️
niworkflows/interfaces/images.py 47.47% <0%> (-4.78%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6ff8a54...298f067. Read the comment docs.

Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to avoid future iterations to add the binary dilation, let's do it now.

niworkflows/anat/ants.py Outdated Show resolved Hide resolved
niworkflows/anat/ants.py Show resolved Hide resolved
niworkflows/anat/ants.py Outdated Show resolved Hide resolved
niworkflows/anat/ants.py Outdated Show resolved Hide resolved
@oesteban oesteban changed the title Add n4_only workflow -- to skip brain extraction ENH: Add n4_only workflow -- to skip brain extraction Dec 7, 2019
adelavega and others added 2 commits December 9, 2019 13:36
Co-Authored-By: Oscar Esteban <code@oscaresteban.es>
Copy link
Member

@oesteban oesteban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one detail left...

niworkflows/anat/ants.py Outdated Show resolved Hide resolved
adelavega and others added 2 commits December 11, 2019 12:53
Co-Authored-By: Oscar Esteban <code@oscaresteban.es>
wf.connect([
(inputnode, inu_n4_final, [('in_files', 'input_image')]),
(inputnode, thr_brainmask, [(('in_files', _pop), 'in_file')]),
(thr_brainmask, outputnode, [('out_mask', 'out_mask')]),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the dilated mask be output, or the undilated one (which is what we're doing here)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say the undilated. I believe we should refactor the Binarize interface so that it can do the binary closing and opening, which will give a smoother mask (and that will be good for the dilated mask too).

@oesteban oesteban merged commit c88c521 into nipreps:master Dec 11, 2019
@adelavega adelavega deleted the enh/n4_only_workflow branch December 11, 2019 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants