Skip to content

[FIX]: AFNI Allineate #2098

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

Merged
merged 7 commits into from
Sep 11, 2017
Merged

[FIX]: AFNI Allineate #2098

merged 7 commits into from
Sep 11, 2017

Conversation

rmarkello
Copy link
Collaborator

Changes proposed in this pull request

  • Fixes issues in OutputSpec mapping for AFNI Allineate interface where out_file name was not successfully generated or mapped.
  • Added xor options in AFNI Allineate interface for mutually exclusive input options
  • Included new overwrite option for AFNI Allineate interface

Errors in OutputSpec mapping for Allineate, where out_file name was not
successfully generated or mapped. Added xor options for some input options
that are mutually exclusive. Included new "overwrite" feature to overwrite
output if it already exists.
@codecov-io
Copy link

codecov-io commented Jun 25, 2017

Codecov Report

Merging #2098 into master will decrease coverage by <.01%.
The diff coverage is 29.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2098      +/-   ##
==========================================
- Coverage   72.25%   72.25%   -0.01%     
==========================================
  Files        1168     1168              
  Lines       58405    58418      +13     
  Branches     8400     8404       +4     
==========================================
+ Hits        42203    42208       +5     
- Misses      14868    14870       +2     
- Partials     1334     1340       +6
Flag Coverage Δ
#smoketests 72.25% <29.16%> (-0.01%) ⬇️
#unittests 69.91% <29.16%> (-0.01%) ⬇️
Impacted Files Coverage Δ
...ipype/interfaces/afni/tests/test_auto_Allineate.py 85.71% <ø> (ø) ⬆️
nipype/interfaces/afni/preprocess.py 80.92% <29.16%> (-0.46%) ⬇️
nipype/interfaces/base.py 83.3% <0%> (-0.19%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32e724c...9b71e71. Read the comment docs.

outputs['out_file'] = self._gen_filename(self.inputs.in_file,
suffix=self.inputs.suffix)
outputs['out_file'] = self._gen_fname(self.inputs.in_file,
suffix='_allineate.nii')
Copy link
Member

Choose a reason for hiding this comment

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

does this command always produce a .nii file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, sorry! That was an oversight on my part that I'll resolve shortly. However, it does lead to a somewhat interesting discussion...

If generated, the out_file dataset will always be a neuroimage; however, Allineate doesn't necessarily need to produce an out_file at all. If you don't specify any of (1) out_file, (2) out_matrix, (3) out_param_file, or (4) out_weight_file, but you do specify a base and source, 3dAllineate will happily run and print the fit parameters to stdout.

As such, I can remove the current _list_outputs section if you'd like and just do a few

if isdefined(self.inputs.X): 
    outputs['X'] = self.inputs.X

for the various potential OutputSpec files in a new commit.

However (and I know I'm going a bit overboard in response to a pretty straightforward question) dealing with the uniqueness and variability of AFNI outputs is something that hasn't really been addressed in nipype. For many AFNI programs, you don't need to specify an output file/prefix--AFNI will simply default to outputting BRIK/HEAD files with a moderately relevant name. While this wouldn't necessarily be a problem, AFNI also adds the "view" (+orig/tlrc/acpc) to the output (i.e., instead of output.BRIK and output.HEAD, you get output+orig.BRIK and output+orig.HEAD).

In order to allow piping in a workflow, these output files would need to be properly specified in an interface; however, you can't know the output view without calling additional commands (i.e., 3dinfo -view) on the input datasets, and even then there's a possibility they might be different for the resultant dataset. As such, many of the AFNI interface out_file parameters are going to be mis-specified, unless you coerce them (i.e., via to generate .nii files. Given that the ability to integrate nipype interfaces into workflows is critical, I think it might be worth discussing how to deal with these "atypical" AFNI outputs and potentially devising a mechanism for standardizing them to work seamlessly with nipype workflow chaining. I'd be happy to open an issue with a few examples of these features and some potential solutions if you think this would be a worthwhile discussion.

Copy link
Member

Choose a reason for hiding this comment

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

@rmarkello - thanks for this clarification and sorry for the delay in responding to this. perhaps we can do this in two stages. first lets fix this interface. then we can use a separate PR to implement the logic you outlined above.

@satra
Copy link
Member

satra commented Aug 3, 2017

@rmarkello - could you please merge master and push?

@satra
Copy link
Member

satra commented Aug 12, 2017

@rmarkello - since i merged @Shotgunosine's PR before this there are some conflicts. perhaps you guys can resolve and update this.

Edited AFNI Allineate interface to accommodate updated master branch. Updated
xor options for allcostx.
@satra satra merged commit b0aea0d into nipy:master Sep 11, 2017
@satra satra added this to the 0.14.0 milestone Oct 20, 2017
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.

3 participants