A package for extracting image patches from SVS files and performing color normalization
Project description
WSIdemerger
This package provides functionalities for extracting image patches from SVS files and performing color normalization on images.
Installation
To install this package, use:
pip install WSIdemerger
Usage
Key Verification
To use this package, you will need to input a key for verification. When you run the functions from this package, you will be prompted to enter the key. Ensure you have the correct key to proceed.
Extract Patches
To extract patches from SVS files, use the process_svs_files function:
from WSIprocessing import process_svs_files
# Define the paths
base_path = 'path/to/your/svs/files'
output_base = 'path/to/output/folder'
threshold = 50 # Saturation threshold for saving patches
patch_size = 512 # Size of the patches
target_magnification = 20 # Target magnification level
# Process SVS files to extract patches
process_svs_files(base_path, output_base, saturation_threshold=threshold, patch_size=patch_size, target_magnification=target_magnification)
Normalize Images
To normalize images using a reference image, use the normalize_images function:
from WSIprocessing import normalize_images
# Define the paths
input_folder = 'path/to/your/input/images'
reference_image_path = 'path/to/your/reference/image.png'
output_folder = 'path/to/output/folder'
# Normalize images
normalize_images(input_folder, reference_image_path, output_folder)
Example
Here is a complete example of how to use both functionalities:
1、Extract patches from SVS files and save them to a specified directory.
2、Normalize the extracted patches using a reference image.
from WSIprocessing import process_svs_files, normalize_images
# Step 1: Extract patches
base_path = 'path/to/your/svs/files'
output_base = 'path/to/output/folder'
threshold = 50 # Saturation threshold for saving patches
patch_size = 512 # Size of the patches
target_magnification = 20 # Target magnification level
process_svs_files(base_path, output_base, saturation_threshold=threshold, patch_size=patch_size, target_magnification=target_magnification)
# Step 2: Normalize the extracted patches
input_folder = 'path/to/output/folder'
reference_image_path = 'path/to/your/reference/image.png'
output_folder = 'path/to/normalized/output/folder'
normalize_images(input_folder, reference_image_path, output_folder)
Contributing
If you would like to contribute to this package, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for WSIdemerger-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 911af776c8f2d8ea2e76cdc864b5acd29f554086e30177aa2bea32e22e55c0b3 |
|
MD5 | d5c8bb89712c5c0dae9bbabfea85184b |
|
BLAKE2b-256 | 4d2d8e6d54990cd20183f960f314eb0b256c76e647ac6d824b3850f2a3a0501d |