Use RLE to calculate morphological features #70
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.
This PR is a proof of concept approach that demonstrates the performance improvements that may be gained by using RLE to calculate metrics. It is an extension of what was implemented in #66. In particular, modifications were made to the way the convex hull, basic morphology, and contour calculations were made. Each of these modifications improves the performance of Nyxus by reducing run time, and in the case of calculating the contour, also reducing memory overhead (since the aux image and padding doesn't need to be calculated).
As reported in issue #69, It appears as though the contour is incorrectly calculated. Assuming the calculation is correct, the performance improvements of
*ALL_MORPHOLOGIES*improves by a factor of 3-4x overall when using RLE. If the assumed bug is fixed from #69, then the improvements are 40%-50% when using RLE. The reason why fixing the presumed bug makes the non-RLE version run more quickly is likely due to the number of neighbors calculation.This PR is intended to only be a proof of concept, as with #66. It is possible there are bugs or additional considerations may need to be made for larger images and accounting for tile boundaries.