Skip to content

[WIP] Major refactor of input/output specs and autonaming #1240

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

Closed
wants to merge 61 commits into from

Conversation

oesteban
Copy link
Contributor

@oesteban oesteban commented Oct 9, 2015

Make name_source available at BaseInterface level

This PR enables the functionality of name_source for any interface derived from BaseInterface. Previously, it only worked for CommandLine interfaces.

There's some previous discussion about this issue here #573.
And we started working on this from here #1234.

I have moved the old _filename_from_source in CommandLine to BaseInterface, with the new name of _resolve_namesource.

The run() method and cmdline in CommandLine call a wrapper to that function named _update_autonames. This must be done AFTER mandatory inputs are checked.

Regarding outputs, I set the output values in aggregate_outputs. I'm not 100% sure this is a good call though.

TODO list

  • Unset files that were not generated
  • Multiple replacements in name_template
  • Remove all _list_outputs
  • Implemente name_remove (ie nipype.algorithms.misc.Gunzip)
  • Implement name_source with Input/OutputMultiPath (ie nipype.algorithms.misc.ModifyAffine)
  • Implement name_source with several outputs (ie nipype.algorithms.misc.Matlab2CSV)

List of interfaces that should be updated when this PR works

  • nipype.algorithms.misc.TSNR

@oesteban oesteban changed the title [ENH] Make name_source available at BaseInterface level [WIP, ENH] Make name_source available at BaseInterface level Oct 9, 2015
@oesteban oesteban changed the title [WIP, ENH] Make name_source available at BaseInterface level [WIP] Make name_source available at BaseInterface level Oct 9, 2015
'--outformat is set to spline the format will be a (4D) file of spline '
'coefficients.'))
out_file = File(
argstr='--out=%s', position=-1, name_source=['in_file'], name_template='%s_coeffs.nii', keep_extension=True,
Copy link
Member

Choose a reason for hiding this comment

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

why are we forcing the output to be nifti here?

@chrisgorgo
Copy link
Member

please rebase/merge master - we have fixed the CircleCI tests

@oesteban oesteban changed the title [WIP] Make name_source available at BaseInterface level [WIP] Major refactor of input/output specs and autonaming Feb 15, 2016
@@ -665,14 +534,122 @@ def _run_interface(self, runtime):
nrows.append(mc_in.shape[0])
matrix = self._get_spm_submatrix(spmmat, sessidx, rows)
self._stimcorr_core(motparamlist[i], intensityfiles[i],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Codacy only found this?? Then it's useless! :P

Seriously, this is still very preliminary. I am coding with the pylint on, so I also address these issues. I'll let you know when this is ready.

BTW, with this refactoring, we get rid of the infamous _list_outputs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants