Skip to main content

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

img.png

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 WSIdemerger 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 WSIdemerger 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 WSIdemerger 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wsidemerger-0.1.4.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

WSIdemerger-0.1.4-py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page