nipype
nipype copied to clipboard
ENH: Interfaces with automated population of outputs
Proof of concept for #3149
This is a very rough draft of how such an interface would look like. It only tests automatic templated names filling (glob patterns should be fairly easy to add, and regexes too).
Some wrinkles around the corners need to be ironed out. E.g., implementing a keep_ext metadata for outputs, and raising an error if two inputs are set in the template and extensions are different. Similarly, raise error if not all the arguments were replaced.
But in general, it seems doable.
BTW the pattern matching and replacing part of this PR could also be useful to accept the name_template metadata in BaseInterfaces (currently, it is only allowed in command line interfaces).
WDYT @satra, @mgxd, @djarecka, @mgxd ?
EDIT: The new AutoOutputInterface is basically a copy of the current BaseInterface, but removing the _list_outputs and aggregate_outputs, and adding this: https://github.com/nipy/nipype/pull/3150/files#diff-1353462138ab420e9b6ce7f8a19ab284R407-R456
Codecov Report
Merging #3150 into master will decrease coverage by
3.76%. The diff coverage is45.16%.
@@ Coverage Diff @@
## master #3150 +/- ##
==========================================
- Coverage 67.62% 63.86% -3.77%
==========================================
Files 299 298 -1
Lines 39487 39623 +136
Branches 5220 5268 +48
==========================================
- Hits 26703 25304 -1399
- Misses 12073 13252 +1179
- Partials 711 1067 +356
| Flag | Coverage Δ | |
|---|---|---|
| #smoketests | ? |
|
| #unittests | 63.86% <45.16%> (-1.01%) |
:arrow_down: |
| Impacted Files | Coverage Δ | |
|---|---|---|
| nipype/interfaces/base/experimental.py | 45.16% <45.16%> (ø) |
|
| nipype/interfaces/nilearn.py | 38.98% <0%> (-57.63%) |
:arrow_down: |
| nipype/workflows/__init__.py | 47.05% <0%> (-52.95%) |
:arrow_down: |
| nipype/utils/spm_docs.py | 20% <0%> (-48%) |
:arrow_down: |
| nipype/interfaces/freesurfer/base.py | 45.68% <0%> (-32.76%) |
:arrow_down: |
| nipype/utils/logger.py | 58.46% <0%> (-30.77%) |
:arrow_down: |
| nipype/algorithms/rapidart.py | 34.42% <0%> (-29.68%) |
:arrow_down: |
| nipype/interfaces/spm/base.py | 57.66% <0%> (-29.34%) |
:arrow_down: |
| nipype/utils/provenance.py | 55.16% <0%> (-28.71%) |
:arrow_down: |
| nipype/interfaces/fsl/model.py | 55.18% <0%> (-25.4%) |
:arrow_down: |
| ... and 37 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 5d2fe1d...75d12f4. Read the comment docs.
This seems reasonable on first glance. I think problems are likely to be found while trying to work through a few examples.
I assume that we'll still support the old style, though? Otherwise a lot of interfaces will need to be rewritten mostly from scratch.
@oesteban - this looks reasonable.