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

FIX: Properly mount local templates #2020

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

mgxd
Copy link
Collaborator

@mgxd mgxd commented Mar 4, 2020

This PR re-enables use of custom templates after the output spaces refactoring.

The local directory where the custom template exists is now mounted to the TemplateFlow home within the container.

Related issue: https://neurostars.org/t/custom-template-fmriprep-20-0-1/6232

@auto-comment
Copy link

auto-comment bot commented Mar 4, 2020

Thank your for raising your pull request.

Some of the fMRIPRep maintainers will review your changes as soon as time permits.
I'm attaching below a Review Checklist for the reviewers, to check off during the
review.

PR Review

Please check off boxes as applicable, and elaborate in comments below. Your review is not limited to these topics, as described in the reviewer guide

  • As the reviewer I confirm that there are no conflicts of interest for me to review this work.

Please check what applies in the following aspects of the PR:

Code documentation

  • New functions and modules are documented following the guidelines.
  • Existing code required amendments in documentation and has been updated.
  • Sufficient inline comments ensure readability by other contributors in the long term.

Documentation site

  • The modifications to fMRIPrep in this PR do not require extra documentation. This is a common situation when a bug fix that does not change the code base substantially is submitted.
  • This PR requires documentation. The corresponding documentation will be submitted as an additional PR in the future.
  • This PR requires extra documentation, and will be included within this PR. Please check the boxes that apply best:
    • An existing feature is substantially modified, changing the interface and/or logic of a module.
    • A new feature is being added, therefore full documentation of it will be included
    • This PR addresses an error in existing documentation.
  • Yes, all expected sections of documentation were generated by the CI build, and look as expected

Tests

  • The new functionalities in this PR are covered by the existing tests
  • New test batteries have been included with this PR

Data

  • This PR does not require any additional data to be uploaded to OSF.
  • This PR requires additional data for tests.

Dependencies: smriprep

  • This PR does not require any update on smriprep; or
  • smriprep has correctly been pinned.

Dependencies: niworkflows

  • This PR does not require any update on niworkflows; or
  • niworkflows has correctly been pinned.

Dependencies: sdcflows

  • This PR does not require any update on sdcflows; or
  • sdcflows has correctly been pinned.

Dependencies: Nipype

  • This PR does not require any update on nipype; or
  • nipype has correctly been pinned.

Dependencies: other

  • This PR does not require any update on other dependencies; or
  • other dependencies have correctly been pinned.

Reports generated within CI tests

  • Yes, I have checked the reports of ds005 and they are not modified or the changes are as expected
  • Yes, I have checked the reports of ds054 and they are not modified or the changes are as expected
  • Yes, I have checked the reports of ds010 and they are not modified or the changes are as expected

command.extend(['-v', ':'.join((os.path.abspath(space), target, 'ro'))])
spaces.append(target)
spaces.append(tpl[4:])
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we're baking in some assumptions that the directory will be called tpl-XYZ. We should either require that (error if tpl[:4] != 'tpl-') or be a bit more forgiving (if not tpl.startswith('tpl-'): tpl = 'tpl-' + tpl).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, we can add a check to ensure the directory is compliant with templateflow standards.

Copy link
Member

Choose a reason for hiding this comment

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

This may be obvious, but in case you're about to do a significant amount of work, I would really keep this very simple. If the error is going to show up early and be clear inside fMRIPrep proper, then we really don't need to do anything here.

I'm mostly worried about if somebody types --output-spaces /my/template and gets strange errors about "tpl-late not found", or something like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

since this check is happening within the niworkflows SpatialReference, that would probably be the best place for that. Since the wrapper behavior is a little different (it has to actually mount the directory), we can include a check here too

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.

LGTM.

@mgxd mgxd merged commit 86bc390 into nipreps:maint/20.0.x Mar 4, 2020
@mgxd mgxd deleted the fix/wrapper-custom-templates branch March 4, 2020 19:29
@mgxd mgxd added this to the 20.0.2 milestone Mar 4, 2020
effigies added a commit that referenced this pull request Mar 11, 2020
Merge notes:

* Fix gh-2014 appears to have been made unnecessary by gh-2018.

Tag message:

20.0.2 (March 6, 2020)
======================
A bug squashing release in the 20.0.x series.

This release fixes the use of custom templates within the docker wrapper, remedies crashes
when FreeSurfer HOME was not set, and improves the documentation for local installations.

With thanks to Blaise Frederick for the contribution.

  * DOC: Update standalone installation requirements (#2009)
  * FIX: Crashes whenever FREESURFER_HOME is not set (#2014)
  * FIX: Local template mounting (wrapper) (#2020)
  * MAINT: Pin minor series of nipype, major series of nibabel (#2021)
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.

2 participants