Skip to content

Refactor image saving and update save path formatting#1165

Merged
AdvancedImagingUTSW merged 6 commits intodevelopfrom
file-saving
Jan 20, 2026
Merged

Refactor image saving and update save path formatting#1165
AdvancedImagingUTSW merged 6 commits intodevelopfrom
file-saving

Conversation

@AdvancedImagingUTSW
Copy link
Collaborator

Refactored the MIP image saving logic in ImageWriter to a dedicated save_mip method, which now saves 8-bit TIFFs with improved scaling. Updated create_save_path to generate lowercased, space-free directory names and a new directory structure that includes the date and metadata in a single folder name. Also updated opencv-python dependency version in pyproject.toml.

Refactored the MIP image saving logic in ImageWriter to a dedicated save_mip method, which now saves 8-bit TIFFs with improved scaling. Updated create_save_path to generate lowercased, space-free directory names and a new directory structure that includes the date and metadata in a single folder name. Also updated opencv-python dependency version in pyproject.toml.
Copilot AI review requested due to automatic review settings January 14, 2026 14:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors image saving functionality by extracting MIP image saving into a dedicated method with 8-bit TIFF scaling, and restructures the directory naming convention to use lowercased, space-free names in a flattened hierarchy.

Changes:

  • Extracted MIP saving logic into a dedicated save_mip method with improved 8-bit scaling
  • Changed directory structure from multi-level hierarchy to flattened format with combined metadata folder names
  • Updated path formatting to remove spaces entirely and apply lowercase transformation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/navigate/tools/file_functions.py Refactored create_save_path to flatten directory structure and apply lowercase/space-removal transformations
src/navigate/model/features/image_writer.py Extracted MIP saving to dedicated save_mip method with 8-bit scaling and changed extension to .tiff
pyproject.toml Updated opencv-python dependency from 4.5.5.62 to 4.5.5.64

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Simplified the construction of MIP image filenames in ImageWriter using f-strings and zero-padded indices. Removed unnecessary lowercase conversion from date string in create_save_path to preserve original formatting.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Refactored test_file_functions.py to match the updated save path structure, which now uses lowercase, concatenated strings and a new directory naming convention. Adjusted expected directory paths and setup logic in unit tests to reflect these changes.
Adjusts the test to handle cases where multiple images are acquired in a single batch, updating the image count logic and increasing max iterations for reliability.
Modified CreateSavePathTestCase to generate expected save directory paths using the current date instead of a hardcoded date string. This ensures the tests remain valid regardless of the date they are run.
Updated the construction of expected_save_directory in CreateSavePathTestCase to use separate arguments for each path component in os.path.join, improving readability and consistency.
@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.29%. Comparing base (f4c0aff) to head (2dd9891).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
src/navigate/model/features/image_writer.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1165      +/-   ##
===========================================
- Coverage    53.47%   53.29%   -0.18%     
===========================================
  Files          197      197              
  Lines        23304    23433     +129     
===========================================
+ Hits         12461    12489      +28     
- Misses       10843    10944     +101     
Flag Coverage Δ
unittests 53.29% <95.00%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdvancedImagingUTSW AdvancedImagingUTSW merged commit d0d1b54 into develop Jan 20, 2026
1 check passed
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.

3 participants