Remove redundant copies and recomputation in the CLI analysis path - #38
Merged
Conversation
- compute_radii now accepts a pre-computed EDT, and the pipeline computes it once per object crop instead of running distance_transform_edt twice (once for junction cleanup's temporary radius matrix, again for the final mask_radius output) whenever both extraction.junction_cleanup and extraction.mask_radius are enabled. - Drop the second connected-components labeling pass in _analyze_single_object: it was mathematically equivalent to the _skeleton_has_no_branches check just above it (both detect "every component is a single isolated pixel"), so it ran scipy's labeling twice on the same skeleton for no reason. - Fix compute_radii evaluating `skeleton > 0` twice in the same expression instead of once. - save_skeleton/save_radius pass copy=False to astype() so no full array copy happens when the array is already the target dtype (always true in practice, since lee94_thin and compute_radii already guarantee it).
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.
skeleton > 0twice in the same expression instead of once.