Skip to content

Adding keyword to be used with volume_stats_in_labels#1312

Open
EliseCos wants to merge 4 commits intoscilus:masterfrom
EliseCos:add_subkeys_json-excel
Open

Adding keyword to be used with volume_stats_in_labels#1312
EliseCos wants to merge 4 commits intoscilus:masterfrom
EliseCos:add_subkeys_json-excel

Conversation

@EliseCos
Copy link
Contributor

Quick description

I added the subkeys from scil_volume_stats_in_labels. These keywords are optional and the script can still be used when you only have mean and std
...

Type of change

Check the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Provide data, screenshots, command line to test (if relevant)

...

Checklist

  • My code follows the style guidelines of this project (run autopep8)
  • I added relevant citations to scripts, modules and functions docstrings and descriptions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I moved all functions from the script file (except the argparser and main) to scilpy modules
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 27.27273% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.87%. Comparing base (fc390bf) to head (736cb34).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1312      +/-   ##
==========================================
+ Coverage   72.72%   72.87%   +0.15%     
==========================================
  Files         295      295              
  Lines       25445    25471      +26     
  Branches     3565     3574       +9     
==========================================
+ Hits        18505    18563      +58     
+ Misses       5437     5403      -34     
- Partials     1503     1505       +2     
Flag Coverage Δ
smoketests 69.71% <27.27%> (-0.01%) ⬇️
unittests 14.27% <0.00%> (+0.44%) ⬆️

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

Components Coverage Δ
Scripts 75.36% <27.27%> (-0.03%) ⬇️
Library 69.90% <ø> (+0.35%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@EliseCos
Copy link
Contributor Author

EliseCos commented Mar 2, 2026

Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

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

LGTM - @frheault do you think we would need an option to get all optional_keys ?

@frheault
Copy link
Member

frheault commented Mar 4, 2026

In what situation does this happen? What is the use-case this covers?

I would need a bit more context @EliseCos

@arnaudbore arnaudbore requested a review from frheault March 4, 2026 13:59
@EliseCos
Copy link
Contributor Author

EliseCos commented Mar 4, 2026

Actually the script only merges mean and std but when you applied scil_volume_stats_in_labels for example it generates additional outputs (ROI-idx, ROI-name, nb-vx-roi, nb-vx-seed, max, plus mean/std). Since, the script does not expect these extra columns, it fails to process them. I had an --extra_key option to obtain the other outputs. My PR works for numeric values but needs correction to handle string data.

p.add_argument('--no_sort_subs', action='store_false',
help='If set, subjects won\'t be sorted alphabetically.')

p.add_argument('--extra_key', nargs='+', default=[],
Copy link
Member

Choose a reason for hiding this comment

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

'Optional keys to export (must be associated to numeric values only).'

for m_stat in bundle_dict.values():
if isinstance(m_stat, dict):
found_keys.update(m_stat.keys())
keys_present = set(optional_keys) & found_keys
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the intersection would be clearer in the future with set1.intersection(set2)
(Or leave a comment to say it is an intersection operation

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.

3 participants