Skip to content

feat: apply process_pixel conversion in segmenter and capture threshold value#916

Open
babo989 wants to merge 2 commits intomainfrom
feature/process-pixel-conversion
Open

feat: apply process_pixel conversion in segmenter and capture threshold value#916
babo989 wants to merge 2 commits intomainfrom
feature/process-pixel-conversion

Conversation

@babo989
Copy link
Collaborator

@babo989 babo989 commented Mar 19, 2026

Summary

  • _extract_metadata_from_regionprop() now accepts pixel_size_um parameter and converts measurements:
    • Linear measurements (width, height, major, minor, perim, equivalent_diameter) × pixel_size
    • Area measurements (area, area_exc, convex_area, bounding_box_area) × pixel_size²
    • Dimensionless ratios (circularity, elongation, eccentricity, solidity) unchanged
  • Min ESD filter correctly converts µm threshold to pixels for comparison against equivalent_diameter_area
  • Captures threshold value from cv2.threshold in object metadata via new get_last_threshold_value() accessor
  • Sets process_pixel_applied = True in global metadata when conversion is applied, preventing double-conversion downstream
  • Expands metadata filter to include calibration prefix

Files changed

  • segmenter/planktoscope/segmenter/__init__.py — pixel conversion logic, min ESD fix, process_pixel_applied flag
  • segmenter/planktoscope/segmenter/operations.py — threshold value capture in simple_threshold()

Companion PR

…ld value

- Convert linear measurements by pixel_size and area measurements by pixel_size² in _extract_metadata_from_regionprop
- Fix min ESD filter to convert µm threshold to pixels using process_pixel
- Record threshold value from cv2.threshold in object metadata
- Set process_pixel_applied flag to prevent double-conversion downstream
- Expand metadata filter to include calibration prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant