Conversation
- Python port of NanoLocz level_weighted.m for AFM images and stacks - Supports region-weighted methods: 'plane', 'line', 'med_line', 'med_line_y', 'smed_line' - Implements polynomial and median-based background subtraction with per-region weighting - Handles 2D images and 3D stacks - Includes robust handling of masks, small regions, and degenerate cases - Preserves MATLAB-like centering and scaling for polynomial fits - Compatible with NumPy/SciPy ecosystem; ready for integration into NanoLocz workflow Also add typing to satisfy mypy.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
==========================================
+ Coverage 96.48% 96.64% +0.16%
==========================================
Files 4 5 +1
Lines 455 776 +321
==========================================
+ Hits 439 750 +311
- Misses 16 26 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This PR introduces a new module, level_weighted, providing weighted-region AFM image flattening and background leveling routines. The module is a Python port of the Nanolocz-lib MATLAB level_weighted.m used in the NanoLocz workflow and implements region-wise polynomial and median-based background estimation.
https://github.com/George-R-Heath/NanoLocz-Matlab-Library/blob/main/NanoLocz-lib/level_weighted.m
Supported levelling methods include:
The module supports masked images, handling multiple regions with weighted aggregation, and is compatible with both 2D images and 3D stacks.