Repository navigation
Define image profiles in physical coordinates - #98
Merged
Merged
Conversation
Line, segment, average and radial profiles are now defined and returned in the image physical coordinates, consistently with ROIs and analysis results: - parameters renamed (row/col -> y/x, row1..col2 -> x1..y2, x0/y0 -> xc/yc) so that scripts using former names fail explicitly; - nearest pixel selection, coordinates outside the image are refused; - segment and radial profiles sampled by the smallest pixel spacing (circular radial profile for anisotropic or non-uniform pixels), refused when X and Y units differ; - average profile selects pixels whose center lies in the rectangle; - X axis carries physical coordinates/distances with matching unit/label. Also fixes the radial profile center on calibrated images, vertical profile units and anti-diagonal segments. Contracts bumped to version 2. Closes #93 Assisted-by: Claude Opus 5.5
This was referenced Oct 25, 2026
Closed
Closed
Merged
Closed
Merged
PierreRaybaut
added a commit
that referenced
this pull request
Oct 26, 2026
Since #98, radial profiles bin the pixels in steps of the smallest distance between pixel centers, and get_radial_profile accumulated them with np.bincount on the bin index, which allocates every bin from the center to the largest distance: a tiny spacing (non-uniform coordinates, strongly anisotropic pixels) required arrays of several GB for a few pixels. Coincident pixel centers gave a zero step and an obscure error after divisions by zero. Only the bins holding pixels are now accumulated (np.unique with the inverse index, then np.bincount on it): the memory used never exceeds the size of the image, and the results are bit-identical (same bins, same order of accumulation). A bin width that is not positive and finite, non-finite distances (center or coordinates), and coincident pixel centers are refused with explicit errors; these inputs already failed. The contract of radial_profile is unchanged. Closes #103 Assisted-by: Claude Opus 5.5
This was referenced Oct 27, 2026
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.
Closes #93
Summary
Image profiles (
line_profile,segment_profile,average_profile,radial_profile) are now defined and returned in physical coordinates, consistently with ROIs and analysis results.LineProfileParam.row/col→y/x;SegmentProfileParam/AverageProfileParamrow1..col2→x1, y1, x2, y2(average:None= image edge instead of-1);RadialProfileParam.x0/y0→xc/yc.get_radial_profilegainsxcoords,ycoords,step.Validation
profile_physical_unit_test.py(anisotropic radial, non-uniform coordinates, unit refusal, former names refused, defaults); profile tests rewritten on calibrated anisotropic images.A DataLab companion PR (same branch name) adapts the profile dialog and tests.