Conversation
Codecov Report❌ Patch coverage is 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
mdesco
left a comment
There was a problem hiding this comment.
This looks great. I tested and reproduced the outputs. It would be nice to have a formal technical review from @karanphil or @CHrlS98 that have played with local fixels in the past PR.
| Compute the angular error (AE) for each segment of the streamlines. | ||
|
|
||
| For each segment of each streamline, the direction is compared with the | ||
| underlying peak (for single peak files like DTI) or with the closest peak |
There was a problem hiding this comment.
si possible, ajouter le terme eigen_vector pour le peak ici.
| help="Saves the streamlines in the top / lowest percentile.\n" | ||
| "Default if set: The top / bottom 5%%") | ||
| gg.add_argument( | ||
| '--mean_std', type=int, const=3, nargs='?', dest='std', |
There was a problem hiding this comment.
Not obvious that this argument takes the number of standard deviations as parameter.
| - WPC: wrong path connections, streamlines connecting correct ROIs but not | ||
| respecting the other criteria for that bundle. Such streamlines always | ||
| exist but they are only saved separately if specified in the options. | ||
| exist but they are only saved separately if specified{} in the options. |
There was a problem hiding this comment.
This may have been added by mistake?
| dirs = dirs / np.linalg.norm(dirs, axis=-1, keepdims=True) | ||
|
|
||
| # Concatenating streamlines for faster processing + nearest neighbor | ||
| coords = np.floor(np.vstack([s[1:] for s in sft.streamlines])).astype(int) |
There was a problem hiding this comment.
this won't be the intersection between the streamline and all voxels (if the step is greater than the voxel size or if there was streamlines compression). Is this what you want? Maybe, since you modify the dpp property.
But, if you wanted the intersection with all voxels, you could use subdivide_streamlines_at_voxel_faces in tractanalysis.voxel_boundary_intersection.
|
|
||
| # Using the abs value because vectors are undirected. | ||
| cos_theta = np.abs(np.dot(current_peaks, dirs[i])) | ||
| cos_theta = np.clip(cos_theta, -1.0, 1.0) # numerical safety |
There was a problem hiding this comment.
Since it's an absolute value you can clip between 0-1 no?
There was a problem hiding this comment.
could we name the script something like scil_tractogram_filter_by_dps? Feels like a filtering script.
There was a problem hiding this comment.
Ok, filtering is good. But it would be scil_tractogram_filter_by_dps_or_dpp. Too long, or still ok?
There was a problem hiding this comment.
Not that long but it is a bit weird having "or" in a script name, filter_by_streamlines_properties? maybe
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.
Provide data, screenshots, command line to test (if relevant)
Using on ISMRM here
Results:
The tractogram:

With "Toggle 2D fiber mappers"

The projected map:

Extracted worst 500 streamlines:

Checklist