Skip to content
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

Add brainvol stats to the segstats command #474

Merged
merged 25 commits into from
Aug 21, 2024

Conversation

dkuegler
Copy link
Member

@dkuegler dkuegler commented Mar 6, 2024

This PR adds all the brainvol stats measures to segstats.py. This specifically includes eTIV and summary volumes.

It also adds mri_segstats.py and mri_brainvol_stats.py, which mimic freesurfer binaries, based on this code. They are much faster and use similar command line APIs (as compared to segstats.py, which has a different API).

@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch 5 times, most recently from 2b35cbd to e80b49e Compare March 21, 2024 15:49
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch 4 times, most recently from 9d235d3 to 67304c5 Compare April 1, 2024 15:46
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch 5 times, most recently from 88854f2 to b6060ee Compare April 20, 2024 14:19
run_fastsurfer.sh Outdated Show resolved Hide resolved
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch from d096571 to 4faacf4 Compare April 30, 2024 10:03
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch 2 times, most recently from 37cdb78 to 5d7607c Compare July 1, 2024 16:39
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch from 5d7607c to 4a6f2f3 Compare July 25, 2024 16:18
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch from 4a6f2f3 to 8795402 Compare August 8, 2024 10:34
- develop Measures in header
mri_segstats.py
- add mri_segstats wrapper script

utils.py
- add LTADict TypedDict
- rename readLT to read_lta
- clean up read_lta function
parser_defaults.py
- make FASTSURFER_ROOT a Path object
pyproject.toml
- update version
run_tools.py
- formatting
data_utils.py
- make read_classes_from_lut accept and work with Path objects
…ion elements)

fix the results of mri_brainvol_stats.py to be identical to mri_brainvol_stats

merge read_classes_from_lut from segstats and data_utils
fix sorting of measures in mri_brainvol_stats.py (make default_measures a variable instead of a constant)
fix classes for CorpusCallosum and BrainSeg
remove superfluous cases and classes
Fix measures --import <measures> settings
Add measures to aseg+DKT.stats file
Better error message if trying to import a measure that does not exist
Remove default values for imported measures (name, description and unit are read from the file anyways)
Add DKT regions to BrainVol Measure
remove brainvol_statsfile parameter and internal references, brainvolstats are now either saved into segstats files, or if no pvfile or normfile is passed there is just a brainvol.stats-like file generated (in legacy_freesurfer mode, plus a message written to the console)
Fix default value for volume_precision
Fix empty function
Update call of segstats in run_fastsurfer.sh
…nctions.sh.

recon_surf/recon-surf.sh
- Add a --segstats_legacy flag
- Put together consecutive statements that are piped to the same process, group them for less io/handles
- Update calls to segstats.py and mri_segstats.py
- fix id statements to get the username
- add pv_guide value

FastSurferCNN/utils/arg_types.py
- Fix docstring and typing

FastSurferCNN/utils/brainvolstats.py
- move default value for source segmentation file for Measures

FastSurferCNN/segstats.py
- Fix integration of brainvolstats

recon_surf/recon-surf.sh and run_fastsurfer.sh
- Integrate brainvolstats
update license checking
- remove nbsphinx from sphinx extensions
- suppress autosectionlabel warnings in sphinx
- fix doc

recon-surf
- fix the vox-size check
- fix which stats are calculated when

run_fastsurfer.sh
- remove echo_quoted
…I. Order of --import and --compute matters for ordering in the output file.

fix mri_segstats.py for the unification of computed_measures and imported_measures
- Fix/clean up Manager.__init__: parameters associated with segmentation map passing
- Fix errors of storage/caching of measures

FastSurferCNN/mri_brainvol_stats.py
- Fix API to Manager.__init__ -> measures should be (is_imported, measure_string) instead of only measure_string split into computed_measures and imported_measures

FastSurferCNN/mri_segstats.py
- Adapt script to new Manager.__init__ interface -> measures should be (is_imported, measure_string) instead of only measure_string split into computed_measures and imported_measures

FastSurferCNN/segstats.py
- Adapt script to new Manager.__init__ interface -> measures should be (is_imported, measure_string) instead of only measure_string split into computed_measures and imported_measures
- Fix Manager.format_measures to have use the same ordering of measures are the order in the arguments (all always last)
- Fix the spelling of the BrainSegVolNotSurf Measure
- Add Manager.needs_pv_calculation function to indicate when the Manager needs PV values

FastSurferCNN/mri_brainvol_stats.py
- Add measure_only=True
- Add --pvfile argument, so --no_legacy is actually possible.
- Use segstats.py main function instead of its own and remove this main function.

FastSurferCNN/mri_segstats.py
- Adapt script to new Manager.__init__ interface -> measures should be (is_imported, measure_string) instead of only measure_string split into computed_measures and imported_measures

FastSurferCNN/segstats.py
- Add --measure_only flag for brainvol.stats-like output
- Fix and optimize brainvol.stats output

recon_surf/recon-surf.sh
- Some cleanup (e.g. send pushd/popd output to /dev/null)
- Fix the parameters of the segstats-py calls
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch from 8795402 to 6b4930c Compare August 13, 2024 11:08
@dkuegler dkuegler force-pushed the feature/segstats/brainvolstats branch from 976807e to 0faf91b Compare August 16, 2024 14:40
@dkuegler dkuegler marked this pull request as ready for review August 21, 2024 15:29
@dkuegler dkuegler requested a review from m-reuter August 21, 2024 15:29
@m-reuter m-reuter merged commit 494460b into Deep-MI:dev Aug 21, 2024
2 checks passed
@dkuegler dkuegler deleted the feature/segstats/brainvolstats branch August 21, 2024 16:11
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