-
Notifications
You must be signed in to change notification settings - Fork 533
[ENH] Extended MRtrix3 interface #2338
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
Conversation
This reverts commit bb9f5b4.
…into enh-mrtrix3
nipype/interfaces/niftyfit/asl.py
Outdated
@@ -147,7 +147,7 @@ class FitAsl(NiftyFitCommand): | |||
>>> from nipype.interfaces import niftyfit | |||
>>> node = niftyfit.FitAsl() | |||
>>> node.inputs.source_file = 'asl.nii.gz' | |||
>>> node.cmdline | |||
>>> node.cmdline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are still a few weird things like this. that added space is unnecessary.
@@ -23,7 +23,7 @@ def test_identitynode_removal(tmpdir): | |||
def test_function(arg1, arg2, arg3): | |||
import numpy as np | |||
return (np.array(arg1) + arg2 + arg3).tolist() | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
there are some weird ones still. could you please run: |
I removed the last trailing spaces, now the changed files in my branch compared to master are only the ones relevant to the pull request: master...matteomancini:enh-mrtrix3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this large update to our MRtrix3 interfaces! I see a lot of inputs removed/renamed, so this will be a big change to our api.
If the new MRtrix3 api has completely changed these interfaces, it may be better to leave the old interfaces as is and make new class for the latest version, similar to how some of our freesurfer interfaces are setup after FS6 was released. Thanks again for the contribution!
desc='specify one or more dw gradient shells') | ||
algorithm = traits.Enum('msmt_5tt','dhollander','tournier','tax', argstr='%s', position=-6, | ||
mandatory=True, desc='response estimation algorithm (multi-tissue)') | ||
dwi_file = File(exists=True, argstr='%s', position=-5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of this remaining in_file
to keep some consistency across nipype interfaces
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense. I will go through the PR and refers to the input diffusion data as in_file.
@@ -16,87 +16,47 @@ | |||
import os.path as op | |||
|
|||
from ..base import (CommandLineInputSpec, CommandLine, traits, TraitedSpec, | |||
File, isdefined) | |||
File, isdefined, Undefined) | |||
from .base import MRTrix3BaseInputSpec, MRTrix3Base | |||
|
|||
|
|||
class ResponseSDInputSpec(MRTrix3BaseInputSpec): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these changes remove backward compatibility to previous versions of dwi2response
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they do since the current version of MRtrix provides different APIs from the ones implemented at the moment in the Nipype interface (#2299).
if isdefined(self.inputs.out_sf): | ||
outputs['out_sf'] = op.abspath(self.inputs.out_sf) | ||
outputs['wm_file'] = op.abspath(self.inputs.wm_file) | ||
if self.inputs.gm_file!=Undefined: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.inputs.gm_file != Undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take care of the missing spaces.
outputs['wm_file'] = op.abspath(self.inputs.wm_file) | ||
if self.inputs.gm_file!=Undefined: | ||
outputs['gm_file'] = op.abspath(self.inputs.gm_file) | ||
if self.inputs.csf_file!=Undefined: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
nipype/interfaces/mrtrix3/reconst.py
Outdated
' image')) | ||
algorithm = traits.Enum('csd','msmt_csd', argstr='%s', position=-8, | ||
mandatory=True, desc='FOD algorithm') | ||
dwi_file = File(exists=True, argstr='%s', position=-7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in_file
for consistency
wm_odf = File('wm.mif', argstr='%s', position=-5, usedefault=True, | ||
mandatory=True, desc='output WM ODF') | ||
gm_txt = File(argstr='%s', position=-4, desc='GM response text file') | ||
gm_odf = File('gm.mif', argstr='%s', position=-3, desc='output GM ODF') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usedefault=True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new interfaces for estimating the SD responses are now able to estimate different responses for different tissues in case of multi-tissue CSD. However, the related command can be used to estimate also SD responses without taking into account tissues and therefore only related to white matter:
https://github.com/matteomancini/nipype/blob/e92e11296ccd4e1894ef835d431977bc67834955/nipype/interfaces/mrtrix3/preprocess.py#L23-L25
Setting usedefault=True only for the output related to the white matter response allows to correctly use the command both with canonical and multi-tissues algorithms.
gm_txt = File(argstr='%s', position=-4, desc='GM response text file') | ||
gm_odf = File('gm.mif', argstr='%s', position=-3, desc='output GM ODF') | ||
csf_txt = File(argstr='%s', position=-2, desc='CSF response text file') | ||
csf_odf = File('csf.mif', argstr='%s', position=-1, desc='output CSF ODF') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
nipype/interfaces/mrtrix3/reconst.py
Outdated
@@ -185,5 +132,12 @@ class EstimateFOD(MRTrix3Base): | |||
|
|||
def _list_outputs(self): | |||
outputs = self.output_spec().get() | |||
outputs['out_file'] = op.abspath(self.inputs.out_file) | |||
outputs['wm_odf'] = op.abspath(self.inputs.wm_odf) | |||
if self.inputs.gm_odf!=Undefined: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space before/after !=
The issue with the new interfaces was highlighted by @oesteban in the previous PR (#2299): I agreed with him that since the MRtrix API has changed, then the interfaces needed be updated and not replaced keeping the old ones (as I did initially). At the moment, an updated installation of MRtrix won't work with some of the current interfaces since they do not take into account the new structure of certain commandline tools (i.e. cmd algorithm inputs, as in dwi2response). I'm not sure of what the Nipype general policy is when the interfaced tool changes the API as in this case. If you let me know what is the best option (updating the API as suggested by @oesteban ; adding new interfaces for the updated API ; implementing the interfaces for the old API as new interfaces), I will promptly make the changes, together with the other minor issues highlighted. |
@matteomancini as someone who rarely uses the MRtrix3 software, I am onboard with just updating the interfaces to the current (and hopefully stable) API. My only concern was for users who are using the version currently support by nipype - this is where having user statistics that can track which interfaces are being used most frequently would come in handy. Since @oesteban originally added support for this package? and is pushing to update, I don't have a problem with that |
I don't have a problem either in case of adding interfaces to the old API, but I'm interested also for the future in knowing which is the best policy. |
Since there was no further reply, I wonder if then it is the case to proceed with updating the interface to the latest API as proposed in #2299 . |
@matteomancini happy to merge after the autotest conflict is fixed |
@mgxd I looked at the comparison and I can't the conflict, all I see is that the the three checks were successful and that the branch has no conflicts with the base. I looked both on this page (the PR) and on the comparison. Let me know if you still see the conflict or if I just need to merge master and repush. Thank you. |
it looks like |
I merged master, then ran |
{ | ||
"affiliation": "University College London", | ||
"name": "Mancini, Matteo", | ||
"orcid": "0000-0001-7194-4568" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the general ordering policy is, but I'm pretty sure Satra should be the last author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I thought the file was in some chronological order of contributions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @mgxd (or someone) reorders it later anyway, so fixing it won't save anybody time. #2338 (comment). Sorry for the noise.
@effigies the zenodo is fine for now - it will be rearranged (by lines contributed) on release anyways |
Changes proposed in this pull request (#2299):