Skip to content

Improve annotation mode sorting, status updates, and notifications#5

Merged
anderstorstensson merged 2 commits intomainfrom
sort-images-by-size
Feb 4, 2026
Merged

Improve annotation mode sorting, status updates, and notifications#5
anderstorstensson merged 2 commits intomainfrom
sort-images-by-size

Conversation

@anderstorstensson
Copy link
Member

Features:

  • Sort unclassified images by ROI area (largest first) in annotation mode This groups similar-sized organisms together for faster annotation
  • Add width, height columns to classifications data frame for size-based sorting

Bug fixes:

  • Fix sample dropdown not updating status symbol (pencil) after saving Use JavaScript to update display text without rebuilding entire dropdown
  • Only update sample status when changes are actually saved Previously status changed even when switching from unchanged samples
  • Fix incorrect image count in loading notifications Now shows count after filtering empty triggers, not before

Files changed:

  • R/sample_loading.R: Add width/height columns to all loading functions
  • R/server.R:
    • Add pending_sample_select to reactiveValues
    • Add update_current_sample_status() helper using JavaScript
    • Modify filtered_images() reactive for size-based sorting in annotation mode
    • Capture save_sample_annotations() return value before updating status
    • Move loading notification to after empty trigger filtering
    • Add mode_message parameter to extract_sample_images()

Features:
- Sort unclassified images by ROI area (largest first) in annotation mode
  This groups similar-sized organisms together for faster annotation
- Add width, height columns to classifications data frame for size-based sorting

Bug fixes:
- Fix sample dropdown not updating status symbol (pencil) after saving
  Use JavaScript to update display text without rebuilding entire dropdown
- Only update sample status when changes are actually saved
  Previously status changed even when switching from unchanged samples
- Fix incorrect image count in loading notifications
  Now shows count after filtering empty triggers, not before

Files changed:
- R/sample_loading.R: Add width/height columns to all loading functions
- R/server.R:
  - Add pending_sample_select to reactiveValues
  - Add update_current_sample_status() helper using JavaScript
  - Modify filtered_images() reactive for size-based sorting in annotation mode
  - Capture save_sample_annotations() return value before updating status
  - Move loading notification to after empty trigger filtering
  - Add mode_message parameter to extract_sample_images()
@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
R/sample_loading.R 93.75% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
+ Coverage   86.89%   87.59%   +0.70%     
==========================================
  Files           4        4              
  Lines         351      379      +28     
==========================================
+ Hits          305      332      +27     
- Misses         46       47       +1     
Files with missing lines Coverage Δ
R/sample_loading.R 97.40% <93.75%> (-0.56%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…on switch

- Escape single quotes and backslashes in update_current_sample_status()
  before interpolating into JavaScript via sprintf (XSS prevention)
- Replace unsafe positional indexing in load_from_mat() with safe
  roi_number lookup via which(), matching load_from_classifier_mat()
- Use NA_real_ fallback for missing ROI dimensions in both loading
  functions (consistent with load_from_csv)
- Replace sapply with vapply for type safety in ROI data extraction
- Extract duplicated switch-to-validation logic (~48 lines) into
  shared do_switch_to_validation() helper
@anderstorstensson anderstorstensson merged commit 144ec1b into main Feb 4, 2026
7 checks passed
@anderstorstensson anderstorstensson deleted the sort-images-by-size branch February 4, 2026 18:16
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.

2 participants