Installation¶
We recommend installing HistoKit in a dedicated Conda environment.
Quick Installation¶
For users familiar with Conda and pip, the installation can be summarized as follows:
git clone https://github.com/ZAEDPolSl/HistoKit.git
cd HistoKit
conda create -n histokit python=3.10 -y
conda activate histokit
python -m pip install -r requirements.txt
python -m pip install openslide-python openslide-bin
python -m pip install -e .
python -c "import histokit; print('HistoKit installed successfully!')"
Prerequisites¶
Before installing HistoKit, make sure the following tools are available:
- Python 3.10
- Anaconda or Miniconda
- Git
- pip
Installation from Source¶
1. Clone the Repository¶
Clone the HistoKit repository using Git:
git clone https://github.com/ZAEDPolSl/HistoKit.git
cd HistoKit
Alternatively, download the repository as a ZIP archive, extract it, and navigate to the extracted project directory.
2. Create a Conda Environment¶
Create a dedicated environment with Python 3.10:
conda create -n histokit python=3.10 -y
Activate the environment:
conda activate histokit
3. Install HistoKit with PIP¶
Install requirements:
python -m pip install -r requirements.txt
Navigate to the root directory of the HistoKit repository, where pyproject.toml or setup.py is located.
Install HistoKit using:
python -m pip install -e .
This command installs HistoKit in editable mode, allowing Python to import the package directly from the local source directory.
If the package metadata declares all required dependencies, pip will install them automatically.
5. Install OpenSlide¶
HistoKit uses OpenSlide for reading whole-slide images.
On supported Windows environments, install the OpenSlide Python bindings and native binaries:
python -m pip install openslide-python openslide-bin
6. Verify the Installation¶
Verify that HistoKit can be imported successfully:
python -c "import histokit; print('HistoKit installed successfully!')"
Check the installed package information:
python -m pip show histokit
External models¶
GrandQC¶
GrandQC provides deep learning-based artifact segmentation for whole-slide images (WSIs).
License and citation requirements
GrandQC is available for academic research and non-commercial use only. See license.md for licensing details.
If you use GrandQC, please cite the original publication:
Model download¶
To use GrandQC-based artifact segmentation, download the pretrained model weights from the external repository:
Download GrandQC models from Zenodo
The following model resolutions are available:
| Resolution (µm/px) | Magnification |
|---|---|
| MPP 1.0 | ~10× |
| MPP 1.5 | ~7.5× |
| MPP 2.0 | ~5× |
Model selection
According to the article, higher magnification (lower MPP) provides more precise artifact segmentation, while lower magnification offers faster processing with a minor reduction in artifact segmentation quality.
Configuration¶
After downloading the selected model, update the model_path parameter
in the config/grandqc.yaml configuration file to point to the downloaded
model weights.
# output
saver: hdf5
out_dir: ./outputs/
save_mag: 10.0
# model
model_path: /path/to/models/GrandQC_MPP1.pth
Replace the example model_path with the actual path to your downloaded model file.
Test installation¶
To verify that HistoKit has been installed correctly, run the example segmentation pipelines using the provided configuration files.
From the root directory of the HistoKit repository, navigate to
the scripts_cohort directory:
cd scripts_cohort
Whole-slide images (SVS)¶
Run the segmentation pipeline on the example whole-slide image:
python run_segmentation_cohort.py --config ./configs/cohort_svs.yaml
Standard images (PNG)¶
Run the segmentation pipeline on the example PNG images:
python run_segmentation_cohort.py --config ./configs/cohort_png.yaml
Expected results¶
After successful execution, the segmentation results should be
generated in the Examples/Data/example_data/ directory.
If both pipelines complete successfully, your HistoKit installation is ready to use.
Troubleshooting¶
HistoKit Cannot Be Imported¶
If you encounter:
ModuleNotFoundError: No module named 'histokit'
Make sure the correct Conda environment is active:
conda activate histokit
Then reinstall HistoKit from the repository root:
python -m pip install -e .
OpenSlide Errors¶
If OpenSlide cannot load WSI files, verify the installation:
python -m pip show openslide-python openslide-bin
Make sure the required native OpenSlide libraries are available for your operating system.
Dependency Conflicts¶
Check for dependency conflicts:
python -m pip check
If dependency conflicts persist, consider creating a fresh Conda environment and reinstalling HistoKit.