Skip to main content

Preprocessing module for large histological images.

Project description

HistoPrep

Preprocessing large medical images for machine learning made easy!

DescriptionInstallationDocumentationHow To UseExamplesWhat's coming?

Description

This module allows you to easily cut and preprocess large histological slides.

  • Cut tiles from large slide images.
  • Dearray TMA spots (and cut tiles from individual spots).
  • Preprocess extracted tiles easily.

workflow

Installation.

pip install histoprep

How To Use

HistoPrep can be used programmatically and from the CLI to prepare medical slide images for machine learning tasks.

import histoprep as hp

# Cutting tiles is done with two lines of
cutter = hp.Cutter('/path/to/slide', width=512, overlap=0.25, max_background=0.7)
metadata = cutter.save('/path/to/output_folder')
jopo666@MacbookM1:~$ HistoPrep cut ./input_dir ./output_dir --width 512 --overlap 0.25 --img_type jpeg

After the tiles have been saved, preprocessing is just a simple outlier detection from the preprocessing metrics saved in metadata.csv!

from histoprep import preprocess

metadata = preprocess.collect_metadata('/path/to/output_folder')

blurry_tiles = all_metadata['sharpness_max'] < 10
pen_markings = all_metadata['hue_0.1'] < 120
weird_blue_shit = all_metadata['blue_0.05'] > 160

preprocess.Explore(metadata, channels=True)

explore

Examples

Detailed examples can be found in the docs or the examples folder.

What's coming?

HistoPrep is under constant development. If there are some features you would like to be added, just submit an issue and we'll start working on the feature!

Requested features:

  • Cutting and preprocessing for multichannel images (currently supports only RGB-images).
  • Add automatic detection of outliers from metadata.
    • This could be implemented with dimensionality reduction.

Citation

If you use HistoPrep in a publication, please cite the github repository.

@misc{histoprep2021,
  author = {Pohjonen J. and Ariotta. V},
  title = {HistoPrep: Preprocessing large medical images for machine learning made easy!},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/jopo666/HistoPrep}},
}

Changelog

Can be found here.

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

histoprep-0.0.2.10.tar.gz (35.3 kB view hashes)

Uploaded Source

Built Distribution

histoprep-0.0.2.10-py3-none-any.whl (42.0 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