Skip to content

[ENH] Give access to num_threads of N4BiasFieldCorrection #166

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

Merged
merged 9 commits into from
May 19, 2017

Conversation

oesteban
Copy link
Member

Defaults to 1 (keep current behavior). N4BiasFieldCorrection is part
of ANTs and the number of threads are controlled in the same way you'd
do with antsRegistration.

Defaults to 1 (keep current behavior). N4BiasFieldCorrection is part
of ANTs and the number of threads are controlled in the same way you'd
do with antsRegistration.
@@ -23,7 +23,8 @@ def afni_wf(name='AFNISkullStripWorkflow'):
outputnode = pe.Node(niu.IdentityInterface(
fields=['bias_corrected', 'out_file', 'out_mask', 'bias_image']), name='outputnode')

inu_n4 = pe.Node(ants.N4BiasFieldCorrection(dimension=3, save_bias=True),
inu_n4 = pe.Node(ants.N4BiasFieldCorrection(
dimension=3, save_bias=True, num_threads=n4_nthreads), num_threads=n4_nthreads,
name='CorrectINU')
Copy link
Member

Choose a reason for hiding this comment

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

Node takes an n_procs parameter, not num_threads. Also PEP8 fix for white space:

inu_n4 = pe.Node(
    ants.N4BiasFieldCorrection(dimension=3, save_bias=True, num_threads=n4_nthreads),
    n_procs=n4_threads,
    name='inu_n4')

And should we be copying the header, as in fmriprep? Maybe it would make sense to move that here, and thread in the n4_threads?

ants.N4BiasFieldCorrection(dimension=3, save_bias=True, num_threads=n4_nthreads),
n_procs=n4_nthreads,
name='inu_n4')
orig_hdr = pe.Node(CopyHeader(), name='orig_hdr')
Copy link
Member

Choose a reason for hiding this comment

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

orig_hdr has no in_file input.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, just noticed (f57c315)

@effigies
Copy link
Member

Very prompt fix.

@effigies
Copy link
Member

We could avoid issues like the above by pulling the whole init_n4bias_wf workflow from fmriprep.

@oesteban
Copy link
Member Author

That would create a circular dependency between both. IMHO, the permanent solution to this would be to include the feature (with a proper boolean switch) in the N4BiasFieldCorrection nipype interface.

@chrisgorgo
Copy link
Contributor

I read this as "moving" init_n4bias_wf to niworkflows not importing it.

@oesteban
Copy link
Member Author

Oh, ok, my bad.

@oesteban
Copy link
Member Author

oesteban commented May 18, 2017

Let's make it easier: nipy/nipype#2034

EDIT: I'll roll back this PR, so that it only works on the number of threads.

@oesteban oesteban merged commit 8b0838a into nipreps:master May 19, 2017
@oesteban oesteban deleted the enh/N4-num_threads branch May 19, 2017 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants