-
Notifications
You must be signed in to change notification settings - Fork 287
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
[RTM] Code revision - fieldmaps #640
Conversation
@oesteban Can you merge/rebase master? Will make it easier to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty straightforward. Just a couple comments, but I think all of them apply to multiple points in the code.
fmriprep/interfaces/fmap.py
Outdated
@@ -68,12 +69,14 @@ def _run_interface(self, runtime): | |||
iterations=self.inputs.mask_erode | |||
).astype(np.uint8) # pylint: disable=no-member | |||
|
|||
self._results['out_file'] = genfname(self.inputs.in_file, suffix='enh') | |||
self._results['out_file'] = fname_presuffix( | |||
self.inputs.in_file, suffix='enh', newpath=os.getcwd()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
genfname
put a _
before suffices, so this should be suffix='_enh'
to keep behavior unchanged.
And since we're in _run_interface
, we can avoid the syscall with runtime.cwd
. (I know that this isn't a necessary optimization since we're not bottlenecked by syscalls; it's just a pattern I've been using in my interfaces to use the information provided in runtime
when possible.)
(Not going to tag all of the uses of fname_presuffix
, but both comments apply to most.)
fmriprep/workflows/fieldmap/fmap.py
Outdated
@@ -96,9 +91,11 @@ def init_fmap_wf(reportlets_dir, omp_nthreads, fmap_bspline, name='fmap_wf'): | |||
|
|||
else: | |||
torads = pe.Node(niu.Function(output_names=['out_file', 'cutoff_hz'], | |||
function=_torads), name='torads') | |||
function=_torads), name='torads', | |||
run_without_submitting=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not using run_without_submitting
on Function
nodes at present. See #554.
fmriprep/workflows/fieldmap/fmap.py
Outdated
|
||
if out_file is None: | ||
out_file = genfname(in_file, suffix='rad') | ||
out_file = fname_presuffix( | ||
in_file, suffix='rad', newpath=os.getcwd()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking this one: suffix='_rad'
, but os.getcwd()
is necessary here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "os.getcwd()
is necessary here"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That it can't be replaced with runtime.cwd. (Obviously, but just a flag in case you were going through with a search and replace.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, so you meant to replace os.getcwd()
by runtime.cwd
when it is possible? I missed that. Please confirm, and I'll update accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I was suggesting. As I said, it's no big deal. I'm happy to merge without that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry again, I missed that out. Updating it now...
|
||
|
||
def init_phdiff_wf(reportlets_dir, name='phdiff_wf'): | ||
def init_phdiff_wf(reportlets_dir, omp_nthreads=1, name='phdiff_wf'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a default value for omp_nthreads
?
|
||
|
||
def init_phdiff_wf(reportlets_dir, name='phdiff_wf'): | ||
def init_phdiff_wf(reportlets_dir, omp_nthreads, name='phdiff_wf'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The omp_nthreads
also needs to be added in the docstring.
#225 - depends on #629