-
Notifications
You must be signed in to change notification settings - Fork 59
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
Tractogram scripts part7: segmentation scripts #993
Tractogram scripts part7: segmentation scripts #993
Conversation
Hello @EmmaRenauld, Thank you for updating ! There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2024-05-31 00:18:40 UTC |
5f05e88
to
4af9c3b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #993 +/- ##
==========================================
+ Coverage 68.14% 68.23% +0.09%
==========================================
Files 419 419
Lines 21369 21388 +19
Branches 3216 3206 -10
==========================================
+ Hits 14561 14594 +33
+ Misses 5533 5527 -6
+ Partials 1275 1267 -8
|
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.
Looks good from my limited knowledge of these scripts! Only a small comment. Also, do you know why Github doesn't understand some of the scripts that were simply renamed, instead of thinking you deleted/added a file...
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.
A couple of questions for this review.
formatter_class=argparse.RawTextHelpFormatter, | ||
description=__doc__) | ||
p.add_argument('in_tractograms', nargs='+', | ||
help='Tractogram filename (s). Format must be one of \n' |
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 we keep saying trk, tck, fib, vtk ...
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.
I agree, it's heavy. Could belong in a PR removing it everywhere.
remove_loops = not args.no_remove_loops | ||
remove_outliers = not args.no_remove_outliers | ||
remove_curv_dev = not args.no_remove_curv_dev | ||
construct_hdf5_from_connectivity( |
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.
Pretty sure @frheault can answer this question but why so much post processing here instead of using already cleaned tractograms ?
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.
I wondered the same. We are writing in our draft scilpy paper that we DON'T do that, and people can combine scripts themselves.
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.
It is because each time you clean a tractogram with one script you save a copy of the tractogram and you save it on IO, so it is often required to do it all at once for key steps in the pipeline.
Also, since 30-40% of streamlines don't even touch the labels, you save some processing by computing these on a filtered tractogram (touching labels). Outliers removal is bundle-based, so it has to happen while segmenting (we cant save 10 000 TRK to run 10 000 outliers removal)
We have the scripts to do it yourself and turn it off if you want. But if you wanted to avoid doing inside the script you would have to:
binarize the labels, remove all streamlines not touching the labels (to save 30-40% of computation for loop), run remove loop, then run that script.
Then run that script, it not that complex, but its a function call and 1-2 parameters in that script, so I am not sure if it is worth it to remove it
PS: This script also cut streamline if entering/exiting gray matter multiple time, so this affect the results of postprocessing (because we change the streamline during the script.
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.
Would it make sense to have enough information to be able to replicate the preproc of this script and to do it outside of the script if the user wants and then use it without any preproc ? @frheault
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 would require 3-4 scripts to either support .h5 as input and output or to duplicate scripts (one version for trk/tck and one for h5).
That's a complexity that is not so worth it I think.
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.
I don't know much about segmentation script but I scrolled through the code and, as far as I'm concerned, it seems alright.
4af9c3b
to
61c729a
Compare
Quick description
The four segmentation scripts. (Renaming = made changes in many files). Improved doc everywhere to reference each other.
scil_tractogram_segment_bundles_with_bundleseg.py
:scil_tractogram_segment_connections_from_labels.py
:scilpy.tractanalysis.connectivity_segmentation
! Will be difficult to review, sorry.--out_dir
.remove_loops_and_sharp_turns
into two: remove_loops, remove_sharp turns for more clarification; the "remove_loops" part was used twice (option args.loop_max_angle), once at the remove loops step, once at the remove_sharp_turn steps. Unnecessary processing removed.scilpy.tractograms.streamline_operations
scil_tractogram_tractogram_segment_with_recobundles.py
:if args.verbose
.to_rasmm
,to_center
to clarify, but it's the default when loading.scil_tractogram_tractogram_segment_with_ROI_and_score.py
:Type of change
Check the relevant options.
Checklist