Skip to content

ENH: Adds interfaces for MRtrix utils shconv and sh2amp #3280

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 24 commits into from
Jun 16, 2021

Conversation

tclose
Copy link
Contributor

@tclose tclose commented Dec 2, 2020

Summary

This PR adds the predicted signal output option of MRtrix's dwi2tensor two interfaces to mrtrix3.utils: SHConv and SH2Amp, which wrap the MRtrix3 (>v3.0.0) commands shconv and sh2amp respectively. Together these can be useful for calculating the residual signal after fitting tensor or ODF models.

List of changes proposed in this PR (pull-request)

  • Adds predicted_signal output to FitTensor interface
  • Adds mrtrix3.SHConv interface
  • Adds mrtrix3.SH2Amp interface

Acknowledgment

  • (Mandatory) I acknowledge that this contribution will be available under the Apache 2 license.

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.

Overall looks good. Some small comments.

@@ -187,6 +203,9 @@ def _list_outputs(self):
outputs["gm_odf"] = op.abspath(self.inputs.gm_odf)
if self.inputs.csf_odf != Undefined:
outputs["csf_odf"] = op.abspath(self.inputs.csf_odf)
if self.inputs.predicted_signal != Undefined:
Copy link
Member

Choose a reason for hiding this comment

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

I assume that you're being consistent with the rest of this function. If you feel the urge, you can fix up the others, but I think we should do this the standard way.

Suggested change
if self.inputs.predicted_signal != Undefined:
if isdefined(self.inputs.predicted_signal):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On this interface, I remembered that 'predicted_signal' is only a valid option when using the 'msmt_csd' algorithm. Is there a way to specify this in the input spec?

Comment on lines 815 to 816
>>> sh.inputs.in_file = 'odf.mif'
>>> sh.inputs.response = 'response.txt'
Copy link
Member

Choose a reason for hiding this comment

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

These files should exist in https://github.com/nipy/nipype/tree/master/nipype/testing/data. If there isn't already one with a name that works for this tool, feel free to create an empty file with that name.

>>> sh = mrt.SHConv()
>>> sh.inputs.in_file = 'odf.mif'
>>> sh.inputs.response = 'response.txt'
>>> sh.cmdline # doctest: +ELLIPSIS
Copy link
Member

Choose a reason for hiding this comment

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

No ... appears in the output line.

Suggested change
>>> sh.cmdline # doctest: +ELLIPSIS
>>> sh.cmdline

>>> sh = mrt.SH2Amp()
>>> sh.inputs.in_file = 'sh.mif'
>>> sh.inputs.directions = 'grads.txt'
>>> sh.cmdline # doctest: +ELLIPSIS
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> sh.cmdline # doctest: +ELLIPSIS
>>> sh.cmdline

@effigies
Copy link
Member

effigies commented Dec 2, 2020

Also can you run black on the files you've touched and make specs?

@tclose
Copy link
Contributor Author

tclose commented Dec 2, 2020

Ok, I think I have made all the changes you requested now

@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #3280 (e096c19) into master (5d2e224) will increase coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3280      +/-   ##
==========================================
+ Coverage   65.07%   65.08%   +0.01%     
==========================================
  Files         307      307              
  Lines       40323    40362      +39     
  Branches     5326     5329       +3     
==========================================
+ Hits        26240    26270      +30     
- Misses      13010    13019       +9     
  Partials     1073     1073              
Flag Coverage Δ
unittests 64.80% <66.66%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nipype/interfaces/mrtrix3/__init__.py 100.00% <ø> (ø)
nipype/interfaces/mrtrix3/reconst.py 75.00% <38.46%> (-6.49%) ⬇️
nipype/interfaces/mrtrix3/utils.py 83.00% <79.31%> (-0.61%) ⬇️
nipype/__init__.py 53.19% <0.00%> (+6.38%) ⬆️

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 5d2e224...e096c19. Read the comment docs.

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.

Regarding msmt_csd, please see #3176 and #3004.

I think what we want to do is leave EstimateFOD alone and improve ConstrainedSphericalDeconvolution, since that one is capable of doing something other than msmt_csd. This would encourage people to move to the more "correct" interface to get the full feature set.

Some small suggestions, but otherwise this is looking good.

@effigies
Copy link
Member

Hey @tclose just a reminder that there are unresolved suggestions here.

@tclose
Copy link
Contributor Author

tclose commented May 6, 2021

Sorry, I think I was on leave when they came through and they slipped of the radar.

@effigies effigies mentioned this pull request May 26, 2021
14 tasks
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.

Just about there, @tclose. Can you merge master, as well, to get any bug fixes from there?

@effigies
Copy link
Member

I'm going to try to make a release in the next couple days. If you want to try to finish this off, I'd love to include it!

tclose and others added 2 commits June 11, 2021 20:10
@tclose
Copy link
Contributor Author

tclose commented Jun 11, 2021

Sorry to miss your release, I'm just getting back into this now. Hopefully it passes the checks now (I'm off to bed:).

On a very tangential note, I have created a new Pydra task repository for Dcm2niix at tclose/pydra-dcm2niix, which is nearly ready to go I think. Would it be good to migrate it into the nipype org, and if so, which is the best way to do this?

@effigies
Copy link
Member

Oh, hey Tom. We didn't actually release due to some failing checks, so I'll try to get this in.

Re pydra-dcm2niix, would you mind opening an issue on https://github.com/nipype/pydra-tasks-template/issues? We don't really have a process for transitioning projects into nipype control, so this would be a good one to work through manually. At some point, it would be nice to have something like a conda-forge/feedstocks setup. (cc @satra I think this is what we discussed?)

@tclose
Copy link
Contributor Author

tclose commented Jun 16, 2021

Ok great, so it is all good to go now?

@effigies
Copy link
Member

Looks like it! In it goes.

@effigies effigies merged commit 935d209 into nipy:master Jun 16, 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