This project provides a modular Python solution for processing SVS (Scanned Virtual Slide) files. It includes functionality to download an SVS file, extract metadata, generate image data, create thumbnails, and convert the SVS file into PNG images at different downsampling levels. All outputs are saved in specified folders for easy access.
- Download SVS file from a specified URL.
- Extract and save metadata in CSV format.
- Extract image level data (dimensions and downsampling levels) in CSV format.
- Generate a thumbnail from the SVS file and save pixel data in CSV format.
- Dynamically generate PNG images for each downsampling level and save them in a
png/
folder. - All file paths and outputs are managed through organized folder structures.
project_directory/
│
├── images/
│ └── <downloaded_svs_file>.svs # The SVS file will be downloaded here.
│
├── output_directory/
│ ├── metadata.csv # Metadata extracted from the SVS file
│ ├── image_data.csv # Image level data (dimensions and downsampling factors)
│ ├── thumbnail.csv # Thumbnail pixel data extracted from the SVS file
│ └── png/
│ ├── <svs_filename>_level_0.png # PNG image at level 0
│ ├── <svs_filename>_level_1.png # PNG image at level 1
│ └── ... # More PNGs for other levels
git clone [email protected]:ElucidataInc/svs_processor.git
cd svs-processor
python -m venv venv
source venv/bin/activate
pip install openslide-python
pip install Pillow
For Ubuntu:
sudo apt-get install openslide-tools
For macOS:
brew install openslide
python3 main.py