Skip to content

[RTM] Support GIFTI outputs in SampleToSurface #1886

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 3 commits into from
Mar 21, 2017

Conversation

effigies
Copy link
Member

This PR creates "implicit" output types for Freesurfer utilities, where no explicit --out_type is supported, but a filename with the associated extension will be correctly produced as that type.

At present, I've only tested this with GIFTI on mri_vol2surf. I expect mri_surf2surf will have the same level of support. I also suspect that any of the mris_convert outputs would work fine.

Note that .gii.gz actually produces a .mgz file with .gii.gz extension, and so any additional output types need to be checked for correctness. Similarly, not all files seem to produce a correct GIFTI; for example, --srchit test.gii produces a valid GIFTI file with completely different data.

@effigies effigies force-pushed the freesurfer_outtypes branch from fac6c4f to 839e250 Compare March 17, 2017 18:00
@codecov-io
Copy link

codecov-io commented Mar 17, 2017

Codecov Report

Merging #1886 into master will decrease coverage by 0.02%.
The diff coverage is 25.92%.

@@            Coverage Diff             @@
##           master    #1886      +/-   ##
==========================================
- Coverage   70.94%   70.92%   -0.03%     
==========================================
  Files        1057     1057              
  Lines       53142    53164      +22     
  Branches     7699     7709      +10     
==========================================
+ Hits        37703    37705       +2     
- Misses      14065    14096      +31     
+ Partials     1374     1363      -11
Flag Coverage Δ
#smoketests 43.41% <ø> (ø) ⬆️
#unittests 70.36% <25.92%> (-0.03%) ⬇️
Impacted Files Coverage Δ
nipype/interfaces/freesurfer/utils.py 62.72% <25.92%> (-0.81%) ⬇️
nipype/interfaces/base.py 83.28% <0%> (-0.19%) ⬇️
nipype/interfaces/fsl/utils.py 65.6% <0%> (ø) ⬆️
nipype/interfaces/spm/model.py 41.76% <0%> (ø) ⬆️
nipype/workflows/fmri/fsl/preprocess.py 72.77% <0%> (ø) ⬆️
nipype/interfaces/io.py 48.16% <0%> (ø) ⬆️
nipype/interfaces/spm/preprocess.py 55.93% <0%> (ø) ⬆️
nipype/workflows/dmri/fsl/artifacts.py 81.28% <0%> (ø) ⬆️
nipype/interfaces/fsl/base.py 77.17% <0%> (ø) ⬆️
nipype/utils/docparse.py 53.04% <0%> (ø) ⬆️

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 22ca05c...f786fce. Read the comment docs.

@effigies
Copy link
Member Author

I've done some playing, and mri_vol2surf with .gii file as output produces identical data as mri_vol2surf with .mgz output, followed by mris_convert.

Also, mri_surf2surf similarly accepts .gii in output filenames, so I've updated the SurfaceTransform interface.

@effigies
Copy link
Member Author

I guess one issue here is that, currently, setting output type allows you to get away with non-matching names. Here, setting the target type to gii would not set an output type, but would change the filename, provided that an output filename is not given. If output filename is set, setting the target type would have no effect.

So if this change is to be accepted, I should notify users. Would something in the interface docstring, trait description, or a runtime check for output filename and target type == 'gii' and emitting a warning? All of the above?

@chrisgorgo
Copy link
Member

We can throw an error in format_args if the type and extensions are inconsistent. Nothing good can come out of such combinations.

BTW is .gii.gz a thing?

@effigies
Copy link
Member Author

.gii.gz. I suspect this is just for compression on NITRC, not an officially supported extension. Since .gii can contain gzip-base64 encoded blocks, it's probably seen as a bit pointless.

For the error, I'd say a warning if they mismatch, an error if they mismatch and the extension belongs to a supported type. There are some extension-less FreeSurfer files, and catching all of those could be tricky.

@chrisgorgo
Copy link
Member

sounds good to me

Error if extension is associated with a known file type
Warn if extension is unknown
@satra
Copy link
Member

satra commented Mar 20, 2017

if there are no other changes requested, this looks good to me. feel free to merge.

@effigies effigies changed the title Support GIFTI outputs in SampleToSurface [RTM] Support GIFTI outputs in SampleToSurface Mar 20, 2017
@chrisgorgo chrisgorgo merged commit dfde970 into nipy:master Mar 21, 2017
@effigies effigies deleted the freesurfer_outtypes branch March 21, 2017 16:56
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