Repository navigation
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1376 +/- ##
==========================================
+ Coverage 72.57% 72.87% +0.29%
==========================================
Files 301 301
Lines 26279 26278 -1
Branches 3702 3700 -2
==========================================
+ Hits 19073 19150 +77
+ Misses 5655 5568 -87
- Partials 1551 1560 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
7 of 13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE UNTIL PR #1373 IS MERGED!!
Quick description
Fixes #1372. Builds on #1373: until it is merged, this PR also shows its two commits. Please review only the last two commits.
BundleSegmethods passed data to each other throughself(model_streamlines,model_centroids,neighb_centroids,neighb_indices), so followingrecognize()meant tracking which method last wrote each attribute. This is what caused #1371. Each step now takes its inputs as arguments and returns its outputs, so the whole data flow is visible inrecognize(). Only the data shared by all bundles (tractogram memmaps, clusters, centroids, rng) stays on the object.Type of change
Refactor: results are unchanged.
bundleseg.py:_cluster_model_bundle,_reduce_search_spaceand_register_model_to_neighbreturn their results;_register_model_to_neighbreturns the SLR matrix.recognize()applies the SLR matrix to both the model streamlines and centroids in one place, so the two can no longer get out of sync (BundleSeg: second_reduce_search_spaceignores the local SLR #1371).prune_far_from_modelis now private (_prune_far_from_model) like the other steps, and takes the registered model and the candidates as arguments.cleanup(), which was never called and did not free anything.voting_scheme.py: the transformation is passed tosingle_recognizeinstead of being stored onBundleSeg, which never used it.test_bundleseg.py: tests of_reduce_search_spaceand_register_model_to_neighb, now possible because they no longer depend on hidden state.Interface changes are internal to
BundleSeg: the constructor no longer takestransformation,prune_far_from_modelis now private, andcleanup()is removed. In scilpy,BundleSegis only created byVotingScheme. The interfaces ofVotingSchemeandscil_tractogram_segment_with_bundlesegare unchanged.scil_tractogram_segment_with_recobundlesis not affected as it uses dipy'sRecoBundlesdirectly and doesn't importvoting_scheme.pyorbundleseg.py.Check the relevant options.
Validation
Results compared exactly (recognized indices and scores) with the code before the refactor (#1373):
scil_tractogram_segment_with_bundleseg, seed 0, identicalresults.json:pytest src/scilpy/segmentandtest_tractogram_segment_with_bundleseg.pypass.Noticed while working on this, out of scope (separate issues):
slr_transform_type='scaling'raisesIndexError(#1374), andsingle_recognize_parallelinvoting_scheme.pyis unused and broken (#1375).Checklist