slideEMask: masking the areas without tissue using an image entropy filer.
slideEMask determines a tissue mask image by assessing image texture. This information is captured by using the standard formula for information entropy to determine the image entropy at each pixel point. This works because highly textured areas (foreground, tissue) can be considered "chaotic" in terms of entropy, and can thus be separated from non-texturized regions (background) using this measure.
To this extent, a 3x3 pixel 'neighborhood' is defined around each pixel. The center pixel's entropy value is calculated by taking the entropy of it's surrounding 3x3 neighborhood.
These values are then averaged in a 4x4 pixel neighborhood to smoothen the image (removing small gaps).
slideEMask can be used to derive masks from virtual slide files, or to derive entropy images from CellProfiler tiles (as generated by slide2Tiles
from slideToolKit), see usage message.
slideEMask was written in C++ and needs to be compiled to run. CentOS 7 and macOS (10.14.5+) precompiled binaries can be found in the binaries
directory.
For your convenience, we have created precompiled binaries for CentOS7+ and macOS Mojave (10.14.5+) using g++
. These are available in the binaries
folder:
slideEMask_macOS_Mojave10145
slideEMask_macOS_BigSur1152
slideEMask_macOS_Monterey1201
slideEMask_centos7
You can add slideEMask to your path by running the code below to make a symbolic link, while making sure to choose the binary appropriate for you system (macOS or CentOS).
mkdir -pv ~/bin/ && \
ln -s -f -v ~/git/slideEMask/binaries/slideEMask[choose_version] ~/bin/slideEMask
Argument(s):
-f
,--file
- The filename of the TIF file to process. (Required)
Optional argument(s):
-l
,--layer
The layer number of the image to use for processing. (Optional, default: -1)-c
,--cellprofiler
- Whether to prepare the image for CellProfiler (save as BMP instead of PNG, and prepend "ENTROPY_" to the filename). Default: false
-t
,--threshold
- The entropy gray value threshold for masking, a number between 0 and 255. (Optional, default: -1)
1. Basic Usage:
./slideEMask -f input_image.tif
This will process the TIFF image file input_image.tif
without specifying a layer or a threshold.
2. Specify Layer and Threshold:
./slideEMask -f input_image.tif -l 3 -t 200
This will process layer 3 of the TIFF image input_image.tif
with an entropy threshold of 200.
3. Prepare Image for CellProfiler:
./slideEMask -f input_image.tif -c
This will process the TIFF image input_image.tif
, save it as a BMP file with the filename prefixed by ENTROPY_
, and set the default threshold.
Remember to replace input_image.tif
with the actual filename of the TIFF image you want to process. Adjust the layer number and threshold as needed based on your specific requirements.
The MIT License (MIT): http://opensource.org/licenses/MIT.
slideEMask uses the CImg library, released under the CeCILL license.
Copyright (c) 2014-2024, Tim Bezemer & Sander W. van der Laan, UMC Utrecht, Utrecht, the Netherlands.