Refactor image saving and update save path formatting#1165
Refactor image saving and update save path formatting#1165AdvancedImagingUTSW merged 6 commits intodevelopfrom
Conversation
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.
There was a problem hiding this comment.
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_mipmethod 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.
There was a problem hiding this comment.
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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.