Skip to content

Conversation

@EmmaRenauld
Copy link
Contributor

@EmmaRenauld EmmaRenauld commented Jan 28, 2026

Quick description

New script to compute the local angular error at each point of the streamline, compared to underlying peaks. For each point, the following segment direction is compared with the peaks in this voxel (nearest neighbor). If peaks come from DTI; simply compared to the vector e1. If peaks come from fODF, compared to the most aligned peak. The output is an angle in degree, saved in DPP. Value at the last coordinate of streamlines is always 0. Value if the voxel has no peak is also 0.

Optionally, the AE can also be saved as color, or projected to a map (mean of segments in that voxel).

Then, I also wanted a script to extract the worst N streamlines based on that value, so here it is at the same time.

I will add official tests soon, but this can already be tested.

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)

Using on ISMRM here

  • The ground truth streamlines
  • The DWI that I preprocessed using Tractoinferno: fodf peaks.
scil_tractogram_compute_ae INPUTS_AE/GT_ismrm.tck INPUTS_AE/ISMRM_fodf_peaks.nii.gz \
       TESTS_AE/test_ismrm_ae_fodf_GT.trk --no_bbox --save_mean_map TESTS_AE/test_ismrm_ae_fodf_GT_map.nii.gz \
      --save_as_color --processes 6 -v
scil_tractogram_extract_streamlines TESTS_AE/test_ismrm_ae_fodf_GT.trk TESTS_AE/test_ismrm_ae_fodf_GT_WorstNb500.trk \
      --from_dpp AE --top --nb 500 -v 

Results:

The tractogram:
image

With "Toggle 2D fiber mappers"
image

The projected map:
image

Extracted worst 500 streamlines:
image

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 ----> todo!
  • New and existing unit tests pass locally with my changes

@EmmaRenauld EmmaRenauld requested a review from mdesco January 28, 2026 21:18
@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 75.59809% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.55%. Comparing base (0ba0902) to head (5e1f493).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1302      +/-   ##
==========================================
+ Coverage   72.51%   72.55%   +0.04%     
==========================================
  Files         295      297       +2     
  Lines       25442    25651     +209     
  Branches     3565     3586      +21     
==========================================
+ Hits        18449    18611     +162     
- Misses       5488     5523      +35     
- Partials     1505     1517      +12     
Flag Coverage Δ
smoketests 69.77% <75.59%> (+0.06%) ⬆️
unittests 13.13% <0.00%> (-0.11%) ⬇️

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

Components Coverage Δ
Scripts 75.45% <82.11%> (+0.07%) ⬆️
Library 69.06% <58.62%> (-0.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant