Skip to content

[FIX/REF] Switch to new MRtrix3 labelconvert CL tool #2441

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 9 commits into from
Mar 9, 2018

Conversation

jguillon
Copy link
Contributor

Changes old MRtrix3 labelconfig to labelconvert.

http://mrtrix.readthedocs.io/en/latest/reference/commands/labelconvert.html

Changes proposed in this pull request

  • Refactor class name to LabelConvert
  • Remove now useless CL arguments

@satra
Copy link
Member

satra commented Feb 15, 2018

@jguillon - could you please merge with master, make specs, commit any changes relevant to these interfaces, and push?

@codecov-io
Copy link

codecov-io commented Feb 19, 2018

Codecov Report

Merging #2441 into master will increase coverage by <.01%.
The diff coverage is 62.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2441      +/-   ##
==========================================
+ Coverage   66.66%   66.66%   +<.01%     
==========================================
  Files         328      328              
  Lines       42529    42557      +28     
  Branches     5278     5281       +3     
==========================================
+ Hits        28350    28371      +21     
- Misses      13500    13505       +5     
- Partials      679      681       +2
Flag Coverage Δ
#smoketests 50.79% <ø> (ø) ⬆️
#unittests 63.98% <62.06%> (ø) ⬆️
Impacted Files Coverage Δ
nipype/interfaces/mrtrix3/__init__.py 100% <100%> (ø) ⬆️
nipype/interfaces/mrtrix3/connectivity.py 71.59% <60.71%> (-5.08%) ⬇️
nipype/pipeline/plugins/multiproc.py 82.14% <0%> (+2.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 88dbce1...6f4c68b. Read the comment docs.

@satra
Copy link
Member

satra commented Feb 19, 2018

@jguillon - you don't need to include the actual freesurfer color LUT, since the testing is only to ensure a filename exists. you can keep the file, but empty out the contents. that will reduce the size of the repo.

file contents not required for testing
@satra
Copy link
Member

satra commented Feb 19, 2018

@jguillon - i just emptied it out directly. will wait for at least the travis tests to pass and merge.

@effigies
Copy link
Member

effigies commented Feb 19, 2018

@satra You may have already been planning this, but it would be good to merge as a squashed commit, so the contents aren't sitting in the history. (Only a few kilobytes, but still. Nipype is already a heavy clone.)

@satra
Copy link
Member

satra commented Feb 19, 2018

@effigies - yes i was planning on that for this one.

@effigies
Copy link
Member

Quick question before merging: Is the old labelconfig tool no longer possible to use? Would it make sense to provide this as a new interface, rather than replacing the old one?

@jguillon
Copy link
Contributor Author

If, in general, nipype stays compatible with old versions of the wrapped softwares, yes it would make sense. But it could be complicated to respect this policy all the time... What about SPM8 ? And Freesurfer 5.X ?

@satra
Copy link
Member

satra commented Feb 20, 2018

nipype is fully compatible with SPM5/8 and FreeSurfer 5.X. we take care of this through versioning of interfaces/packages, and introducing fields that are dependent on min_ver and max_ver as noted here: http://nipype.readthedocs.io/en/latest/devel/interface_specs.html#common

@jguillon
Copy link
Contributor Author

Amazing! Then, let's keep the "old" labelconfig interface. But do you have an equivalent of those min_ver, max_ver attributes but for an entire interface and not just a trait?

@satra
Copy link
Member

satra commented Feb 20, 2018

@jguillon - there are a few ways of doing whole interfaces:

  1. overwrite _run_interface and/or add a version check in there
    example:

    class ContrastMgr(FSLCommand):

  2. create a new interface:
    example:

    class Normalize12InputSpec(SPMCommandInputSpec):

@effigies effigies added this to the 1.0.2 milestone Feb 23, 2018
@effigies
Copy link
Member

effigies commented Mar 2, 2018

@jguillon Have you had a chance to look at this further? Let us know if you have any more questions.

@jguillon
Copy link
Contributor Author

jguillon commented Mar 2, 2018

Hi again! Sorry I didn't have much time these last days.

I think I'll go with the simple solution of keeping the old interface of LabelConvert along with the new one. If that's fine with you?

As a side question, don't you ever check (and force) for the version of SPM when instantiating a SPM12-specific interface like this one:

class Normalize12(SPMCommand):

or did I miss something? Didn't test at all, just a curiosity.

@effigies
Copy link
Member

effigies commented Mar 2, 2018

Just restoring the old one and keeping your new one alongside is definitely easiest. That works for me. (If we want to add in deprecating code, we can push to your branch before merging.)

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.

This looks almost ready. A few comments.

'segmentation of the base of the spine where the streamlines'
' terminate, so that this can become a node in the connection'
' matrix.')
nthreads = traits.Int(
Copy link
Member

@effigies effigies Mar 7, 2018

Choose a reason for hiding this comment

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

This should be num_threads, to help nipype automatically do resource management.

>>> labels.inputs.in_file = 'aparc+aseg.nii'
>>> labels.inputs.in_config = 'mrtrix3_labelconfig.txt'
>>> labels.inputs.in_lut = 'FreeSurferColorLUT.txt'
>>> labels.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 ellipsis in the cmdline, so I think we can drop the doctest directive here.


if not isdefined(self.inputs.in_config):
from distutils.spawn import find_executable
path = find_executable(self._cmd)
Copy link
Member

Choose a reason for hiding this comment

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

We're looking at dropping the distutils dependency (#2348). Can you use nipype.utils.filemanip.which instead?

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.

LGTM. @satra any remaining issues?

@satra satra merged commit 04aa3c5 into nipy:master Mar 9, 2018
@jguillon jguillon deleted the fix/mrtrix3-labelconvert branch March 10, 2018 11:47
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.

4 participants