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

[RTM] Code revision - fieldmaps #640

Merged
merged 12 commits into from
Aug 4, 2017

Conversation

oesteban
Copy link
Member

@oesteban oesteban commented Aug 3, 2017

#225 - depends on #629

@oesteban oesteban changed the title [WIP] Code revision - fieldmaps [RTM] Code revision - fieldmaps Aug 3, 2017
@effigies
Copy link
Member

effigies commented Aug 3, 2017

@oesteban Can you merge/rebase master? Will make it easier to review.

@oesteban oesteban requested a review from effigies August 3, 2017 22:25
Copy link
Member

@effigies effigies left a 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.

@@ -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())
Copy link
Member

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.)

@@ -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)
Copy link
Member

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.


if out_file is None:
out_file = genfname(in_file, suffix='rad')
out_file = fname_presuffix(
in_file, suffix='rad', newpath=os.getcwd())
Copy link
Member

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.

Copy link
Member Author

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"?

Copy link
Member

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.)

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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'):
Copy link
Member

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'):
Copy link
Member

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.

@oesteban oesteban merged commit 15e955a into nipreps:master Aug 4, 2017
@oesteban oesteban deleted the enh/CodeRevision-fmap branch August 4, 2017 19:34
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.

None yet

2 participants