Update SP_smallSample.py#6
Open
totochin1222 wants to merge 1 commit into
Open
Conversation
This script provides a pipeline for downsizing TIFF images from a dataset and optionally rotating them based on sample naming conventions. Original functionality: - Reads TIFF images from a specified folder. - Downsizes images by a given scale factor. - Converts color channels if necessary to ensure correct saving. - Rotates images based on specific naming patterns (e.g., samples containing certain codes like "H710C" or "H750A"). - Saves downsized images as PNG in a dedicated 'images' folder. - Supports parallel processing with multiple CPU cores to speed up the downsizing process. - Tracks which images were rotated by saving a "_rotatedImgs.txt" file. Key functions: - `downsize`: Main function for downsizing and organizing images, handles CPU parallelization. - `ds`: Performs individual image resizing, rotation, and saving. Modifications / Current usage: - Supports multiple image reading libraries (`tifffile` and `cv2`) to handle different image formats. - Rotation logic is conditional on sample names and an `unrotated` flag. - Added multiprocessing `spawn` method to ensure compatibility on macOS. - Allows flexible input paths and scaling factors. - Robust handling of errors during image reading, resizing, or saving, marking failures explicitly.
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.
This script provides a pipeline for downsizing TIFF images from a dataset and optionally rotating them based on sample naming conventions.
Original functionality:
Key functions:
downsize: Main function for downsizing and organizing images, handles CPU parallelization.ds: Performs individual image resizing, rotation, and saving.Modifications / Current usage:
tifffileandcv2) to handle different image formats.unrotatedflag.spawnmethod to ensure compatibility on macOS.