Skip to content

Schreiber et al. (2024) - H&E Thresholding-based Tissue Segmentation

License Citation Use

The H&E Thresholding method segments tissue in haematoxylin and eosin (H&E)-stained whole-slide images (WSIs) using the color transformation proposed by Schreiber et al. (2024). Unlike conventional grayscale Otsu thresholding, it exploits the relative intensities of RGB channels to distinguish pink and purple tissue from background and certain pen marks and scanning artifacts.

The method requires no trained model, and runs on a CPU.

Original method and citation

HistoKit implements the algorithm described by Schreiber et al. Please cite the original publication when using this method in research. See Citation and acknowledgements.

Algorithm

  1. Image acquisition. Read the WSI at segmentation_mag.
  2. Normalization. Divide RGB intensities by 255 to obtain values in \([0,1]\).
  3. Color transformation. Compute positive red–green and blue–green differences:

    \[ D_R(x)=\max(R(x)-G(x),0),\qquad D_B(x)=\max(B(x)-G(x),0). \]
  4. Tissue response. Calculate the element-wise product:

    \[ T(x)=D_R(x)D_B(x). \]
  5. Thresholding. Estimate the Otsu threshold \(\tau\) over the response map and generate a binary mask:

    \[ M(x)=\begin{cases}1 & T(x)>\tau,\\0 & \text{otherwise}.\end{cases} \]
  6. Optional dilation and post-processing. When blur_kernel_width is nonzero, convolve the binary mask with a square kernel of ones and retain pixels with positive responses.

  7. Region extraction. Split the final mask into regions and scale them to save_mag.

Configuration

See example YAML configuration file:

config/hethr.yaml
1
2
3
4
5
6
7
saver: hdf5
out_dir: ./outputs/
save_mag: 10.0
segmentation_mag: 2.5
vis_mag: 2.5
nbins: 256
blur_kernel_width: 0
Parameter Type Description
saver str Output saving backend.
out_dir str / Path Output directory.
save_mag float Magnification of saved masks and bounding boxes.
segmentation_mag float Magnification used for tissue segmentation.
vis_mag float Magnification used to read the visualization thumbnail.
nbins int Number of histogram bins used for Otsu thresholding.
blur_kernel_width int Size of the square dilation kernel. Set to 0 to disable filtration.
postprocess_steps sequence of callables Post-processing operations applied to the binary mask in order.

Choosing magnification

Lower magnifications reduce memory and computation requirements. Higher magnifications may better preserve small tissue structures.

Basic usage

With an initialized SchreiberConfig object (config) and an opened Slide object (slide):

segmenter = SchreiberSegmenter(config)
result = segmenter.segment(slide, basename="sample", verbose=True, save=True)

Outputs

Key Description
method HeThr
type tissue_mask
mask List of tissue masks.
bbox Corresponding bounding boxes.
thr Otsu threshold in the transformed color space.
mag_det, mag_save Segmentation and output magnifications.
mag_l0, mpp_l0, level_dimensions_0 Original slide metadata.
config Serialized configuration.
time Processing time in seconds.

The current implementation saves results under out_dir/mask_gamred when save=True. This directory name is retained in the description to match the supplied implementation.

Visualizations

The segmenter emits two collector outputs:

Output Description
thumbnail RGB overview at vis_mag.
tissue_overlay Tissue mask and corresponding RGB thumbnail.

Limitations

The method is designed for H&E images and does not provide multi-class artifact segmentation. Artifacts with colors similar to stained tissue may remain in the mask (e.g. pink marker traces).

Citation and acknowledgements

Please cite the publication when using this algorithm:

Schreiber, B. A., Denholm, J., Jaeckle, F., Arends, M. J., Branson, K. M., Schönlieb, C.-B., & Soilleux, E. J. (2024). Rapid artefact removal and H&E-stained tissue segmentation. Scientific Reports, 14, 309. https://doi.org/10.1038/s41598-023-50183-4.

License

The publication is available under the Custom License.

Acknowledgements

We acknowledge B. A. Schreiber and co-authors for developing and publishing the H&E-specific tissue segmentation method.