Skip to main content

Embedding of whole slide images with Foundation Models

Project description

Histopathology Slide Pre-processing Pipeline

PyPI version Docker Version

HS2P is an open-source project largely based on CLAM tissue segmentation and patching code.

empty empty

🛠️ Installation

System requirements: Linux-based OS (e.g., Ubuntu 22.04) with Python 3.11+ and Docker installed.

We recommend running the script inside a container using the latest hs2p image from Docker Hub:

docker pull waticlems/hs2p:latest
docker run --rm -it \
    -v /path/to/your/data:/data \
    waticlems/hs2p:latest

Replace /path/to/your/data with your local data directory.

Alternatively, you can install hs2p via pip:

pip install hs2p

Patch Extraction: Step-by-step guide

  1. Create a .csv file containing paths to the desired slides. Optionally, you can provide paths to pre-computed tissue masks under the 'mask_path' column

    wsi_path,mask_path
    /path/to/slide1.tif,/path/to/mask1.tif
    /path/to/slide2.tif,/path/to/mask2.tif
    ...
    
  2. Create a configuration file

    A good starting point is to look at the default configuration file under hs2p/configs/default.yaml where parameters are documented.

  3. Kick off slide tiling

    python3 -m hs2p.tiling --config-file </path/to/config.yaml>
    

Patch Sampling: Step-by-step guide

  1. Create a .csv file containing paths to the desired slides & associated annotation masks:

    wsi_path,mask_path
    /path/to/slide1.tif,/path/to/mask1.tif
    /path/to/slide2.tif,/path/to/mask2.tif
    ...
    
  2. Create a configuration file

    A good starting point is to look at the default configuration file under hs2p/configs/default.yaml where parameters are documented.

  3. Kick off tile sampling

    python3 -m hs2p.sampling --config-file </path/to/config.yaml>
    

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

hs2p-1.0.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hs2p-1.0.0-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file hs2p-1.0.0.tar.gz.

File metadata

  • Download URL: hs2p-1.0.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hs2p-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ff7e8a1c08a42e532764b0b395a05e897ae41e91ad7576d89b45396eb43d9308
MD5 af9a031c8070572415e651cc42f38911
BLAKE2b-256 cabb75026b074a58ce37b01b7d3d5b9f59d46617facae18996c36408c2faa9c9

See more details on using hashes here.

File details

Details for the file hs2p-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hs2p-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for hs2p-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f4e507e808458cc3afcb9b8c2fdd04f7a2062658d372d3894c24e1025f5d56f
MD5 ffa0cfca500428e9aedaacd6c64a597b
BLAKE2b-256 68b29d5fdbc036a318d468165f5c8bec099323bbba8ba43ec9dbcfe5e10cbe50

See more details on using hashes here.

Supported by

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