-
Notifications
You must be signed in to change notification settings - Fork 297
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
ENH: fsLR output space, cifti output in HCP grayordinate space #1887
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
51685b6
wip: BOLD timeseries to fsLR surface
mgxd a898085
enh: new pathway for fslr resampling
mgxd 355dd09
fix: fslr and medial wall nan compatibility
mgxd a1d2c6f
fix: syntax, add density parameter to bold_surf_wf
mgxd b2d2fe5
enh: add workbench dependency
mgxd 81f63c1
fix: various runtime fixes
mgxd 2ba1462
wip: use fslr with cifti interface
mgxd 38ee520
enh: re-add surface density
mgxd 72d41c1
rf+enh: output space parsing for hcp ciftis
mgxd f6e69cb
fix: files for fsaverage -> fsLR resampling
mgxd a9be360
fix: clean up GenerateCifti inputs
mgxd fc621dd
fix: save ALL CIFTIs
mgxd b4ccfaa
merge conflict
mgxd af3e275
fix: simplify exception
mgxd 5ed2547
pin: test upstream dependencies
mgxd 1533207
Merge branch 'master' into enh/cifti-hcp
mgxd d979b9c
fix: address @oesteban review
mgxd b142bcd
fix: update outputs/connections to upstream cifti changes
mgxd b74c898
PIN[temporary]: upstream PR
mgxd 11ded98
fix: sort outputs
mgxd 9df2503
fix: only generate hcp compatible CIFTIs
mgxd 590b8af
enh: add density to fslr/cifti outputs
mgxd be43eea
maint: update cifti test, outputs
mgxd 311fba6
pin: poldracklab/niworkflows#436
mgxd abeeff9
sty: flake8
mgxd 6c7c048
enh: update fsLR/CIFTI documentation
mgxd 17abbff
fix: output sorting
mgxd e4d7192
fix: allow fsLR surfs without --cifti-output
mgxd 7e5cd86
fix: coerce templates to strings
mgxd 815bf36
fix: use same --output-spaces command
mgxd 88f7f52
fix: ensure templates are always fetched
mgxd 5645707
Merge branch 'master' into enh/cifti-hcp
oesteban 35dec43
PIN: niworkflows 1.1.0
mgxd 1a8b112
enh+doc: augment --cifti-output flag capabilities
mgxd 4cc78a8
Merge branch 'master' into enh/cifti-hcp
mgxd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,8 +232,11 @@ def get_parser(): | |
g_surfs.add_argument('--no-submm-recon', action='store_false', dest='hires', | ||
help='disable sub-millimeter (hires) reconstruction') | ||
g_surfs_xor = g_surfs.add_mutually_exclusive_group() | ||
g_surfs_xor.add_argument('--cifti-output', action='store_true', default=False, | ||
help='output BOLD files as CIFTI dtseries') | ||
g_surfs_xor.add_argument('--cifti-output', nargs='?', const='91k', default=False, | ||
choices=('91k', '170k'), | ||
help='output preprocessed BOLD as a CIFTI dense timeseries. ' | ||
'Optionally, the number of grayordinate can be specified ' | ||
'(default is 91k, which equates to 2mm resolution)') | ||
g_surfs_xor.add_argument('--fs-no-reconall', | ||
action='store_false', dest='run_reconall', | ||
help='disable FreeSurfer surface preprocessing.') | ||
|
@@ -700,14 +703,6 @@ def parse_spaces(opts): | |
# Set the default template to 'MNI152NLin2009cAsym' | ||
output_spaces = opts.output_spaces or OrderedDict([('MNI152NLin2009cAsym', {})]) | ||
|
||
FS_SPACES = set(['fsnative', 'fsaverage', 'fsaverage6', 'fsaverage5']) | ||
if opts.run_reconall and not list(FS_SPACES.intersection(output_spaces.keys())): | ||
print("""\ | ||
Although ``--fs-no-reconall`` was not set (i.e., FreeSurfer is to be run), no FreeSurfer \ | ||
output space (valid values are: %s) was selected. Adding default "fsaverage5" to the \ | ||
list of output spaces.""" % ', '.join(FS_SPACES), file=stderr) | ||
output_spaces['fsaverage5'] = {} | ||
|
||
# Validity of some inputs | ||
# ERROR check if use_aroma was specified, but the correct template was not | ||
if opts.use_aroma and 'MNI152NLin6Asym' not in output_spaces: | ||
|
@@ -717,18 +712,32 @@ def parse_spaces(opts): | |
The argument "MNI152NLin6Asym:res-2" has been automatically added to the list of output spaces \ | ||
(option ``--output-spaces``).""", file=stderr) | ||
|
||
if opts.cifti_output and 'MNI152NLin2009cAsym' not in output_spaces: | ||
if 'MNI152NLin2009cAsym' not in output_spaces: | ||
output_spaces['MNI152NLin2009cAsym'] = {'res': 2} | ||
print("""Option ``--cifti-output`` requires functional images to be resampled to \ | ||
``MNI152NLin2009cAsym`` space. Such template identifier has been automatically added to the \ | ||
list of output spaces (option "--output-space").""", file=stderr) | ||
if not [s for s in output_spaces if s in ('fsaverage5', 'fsaverage6')]: | ||
output_spaces['fsaverage5'] = {} | ||
print("""Option ``--cifti-output`` requires functional images to be resampled to \ | ||
``fsaverage`` space. The argument ``fsaverage:den-10k`` (a.k.a ``fsaverage5``) has been \ | ||
automatically added to the list of output spaces (option ``--output-space``).""", file=stderr) | ||
if opts.cifti_output: | ||
grayords = {'91k': '32k', '170k': '59k'} # CIFTI total grayords to surface densities | ||
output_spaces['fsLR'] = {'den': grayords[opts.cifti_output]} | ||
if 'MNI152NLin6Asym' not in output_spaces: | ||
output_spaces['MNI152NLin6Asym'] = {'res': '2'} | ||
print("""\ | ||
Option ``--cifti-output`` requires functional images to be resampled to \ | ||
``MNI152NLin6Asym`` space. This space has been automatically added to the list of output \ | ||
spaces (option ``--output-spaces``).""", file=stderr) | ||
|
||
if 'fsLR' in output_spaces: | ||
output_spaces['fsLR'] = {'den': output_spaces.get('fsLR', {}).get('den') or '32k'} | ||
# resample to fsLR from highest density fsaverage | ||
output_spaces['fsaverage'] = {'den': '164k'} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, now asking for CIFTIs in fsLR means that I'm also getting GIFTI outputs in fsaverage space. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, see above |
||
print("""\ | ||
To generate "fsLR" surfaces, functional images are first resampled to ``fsaverage:den-164k``. \ | ||
This space has been automatically added to the list of output spaces \ | ||
(option ``--output-spaces``).""", file=stderr) | ||
|
||
FS_SPACES = set(('fsnative', 'fsaverage', 'fsaverage6', 'fsaverage5')) | ||
if opts.run_reconall and not FS_SPACES.intersection(output_spaces.keys()): | ||
print("""\ | ||
Although ``--fs-no-reconall`` was not set (i.e., FreeSurfer is to be run), no FreeSurfer \ | ||
output space (valid values are: %s) was selected. Adding default "fsaverage5" to the \ | ||
list of output spaces.""" % ', '.join(FS_SPACES), file=stderr) | ||
output_spaces['fsaverage5'] = {} | ||
return output_spaces | ||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 you really want to force GIFTI outputs if you're having CIFTI outputs? If they're not explicitly asking for it, it's a lot of duplicated output.
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.
that's how we are currently handling CIFTIs, i.e. fsaverage5/6 surfaces are always produced atm.
I hope to get this functionality in, and then address the inherent problem after (#1892)
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.
Okay.