sta

staintools

Tools for tissue image stain normalisation and augmentation in Python 3

Showing:

Popularity

Downloads/wk

0

GitHub Stars

186

Maintenance

Last Commit

5mos ago

Contributors

2

Package

Dependencies

0

License

Categories

Readme

StainTools

Tools for tissue image stain normalization and augmentation in Python 3.

Install

  1. pip install staintools
  2. Install SPAMS. This is a dependency to staintools and is technically available on PyPI (see here). However, personally I have had some issues with the PyPI install and would instead recommend using conda (see here).

Quickstart

Normalization

Original images:

Stain normalized images:

# Read data
target = staintools.read_image("./data/my_target_image.png")
to_transform = staintools.read_image("./data/my_image_to_transform.png")

# Standardize brightness (optional, can improve the tissue mask calculation)
target = staintools.LuminosityStandardizer.standardize(target)
to_transform = staintools.LuminosityStandardizer.standardize(to_transform)

# Stain normalize
normalizer = staintools.StainNormalizer(method='vahadane')
normalizer.fit(target)
transformed = normalizer.transform(to_transform)

Augmentation

# Read data
to_augment = staintools.read_image("./data/my_image_to_augment.png")

# Standardize brightness (optional, can improve the tissue mask calculation)
to_augment = staintools.LuminosityStandardizer.standardize(to_augment)

# Stain augment
augmentor = staintools.StainAugmentor(method='vahadane', sigma1=0.2, sigma2=0.2)
augmentor.fit(to_augment)
augmented_images = []
for _ in range(100):
    augmented_image = augmentor.pop()
    augmented_images.append(augmented_image)

More examples

For more examples see files inside of the examples directory.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100