Skip to content

slideMask

Sander W. van der Laan edited this page Jan 8, 2024 · 3 revisions

slideMask is designed to create scaled mask and macro images from a virtual whole-slide image (WSI), e.g. in .TIF- or .ndpi-format, using the convert command from ImageMagick.

You can mask parts of your image that you do not want to process. This program will use convert to create a mask for you, which you can later edit if needed. The mask is a layer within the original WSI file. The slideToolKit excludes real black in further processing (color #000000). Two new files will be created, one file.macro.png, and one masked macro file (file.mask.png). Definitions of masking can be set with the --mask-args flag. A blur creates space between the mask and the tissue. A fuzz selects the background. A fuzz of 3% works well but fails on very light slides; a fuzz of 2% might be too easy on the selection, 5% works on slides with a darkish background. Pipe the 'multiple folders at once' output into parallel for parallel processing. For some slides, the virtual slide format is not known. For these instances, you need to run slideInfo to find the correct layer manually. When the mask layer is identified (approximately 2000x2000 pixels), use the --layer flag.

Example usage:

  • Example 1
./slideMask AE1234.SR.ndpi
  • Example 2
./slideMask --file=AE1234.SR.ndpi

Print a job list:

  find "\$(pwd)" -iname "*.TIF" -exec $(command -v "$SCRIPTNAME") -f "{}" \;

Print a job list for SLURM:

  find "\$(pwd)" -iname "*tif" -type f \
        -exec printf "sbatch $DEFAULT_SLURMARGS " \; \
        -exec printf "\$(command -v "$SCRIPTNAME") " \; \
        -exec echo "--file=\""{}"\" " \;

Argument(s):

  • -f, --file
    • Virtual slide to create mask from. Required.

Optional argument(s):

  • [--masksuffix]
    • Mask suffix [".mask"]
  • [--macrosuffix]
    • Macro suffix [".macro"]
  • [-l, --layer]
    • Force a specific layer by layer id
  • [--mask-args]
    • Mask arguments (ImageMagick) [-blur 40x40 -fuzz 4%]
  • [--ignore-dependencies]
    • Ignores all dependencies but gives a warning
  • --help
    • Display this help
  • --version
    • Display version and license information

Overview

Welcome to slideToolKit

Manual

Introduction
General instructions

slideToolKit scripts

slide2Tiles
slideAppend.sh
slideAppendGCT.sh
slideConvert
slideDirectory
slideDupIdentify.py
slideEMask
slideEntropySegmentation.py
slideExtract.py
slideExtractTiles.py
slideInfo
slideInfo.py
slideJobChecker
slideLookup
slideMacro
slideMacro.py
slideMask
slideNormalize
slideRename
slideRename.py
slideThumb
slideThumb.py

slideQuantify v1

slideQuantify_v1
slideQuantify_v1_1_expresshist_mask.sh
slideQuantify_v1_2_expresshist_tile.sh
slideQuantify_v1_3_tile_normalizing.sh
slideQuantify_v1_4_cellprofiler.sh
slideQuantify_v1_5_wrapup.sh

slideQuantify v2

slideQuantify_v2
slideQuantify_v2_1_entropy_segmentation.sh
slideQuantify_v2_2_extract_tiles.sh
slideQuantify_v2_3_tile_normalizing.sh
slideQuantify_v2_4_cellprofiler.sh
slideQuantify_v2_5_wrapup.sh

slideQuantifyOSX

slideQuantifyOSX
slideQuantify_cellprofiler.sh
slideQuantify_mask.sh
slideQuantify_normalizing.sh
slideQuantify_tiling.sh
slideQuantify_wrapup.sh

Other scripts

slideToolKitTest.py

Installation

macOSX

Conda version (default/preferred)
Homebrew version

Linux

Rocky 8 Conda version (default/preferred)

Legacy

Ubuntu 16.04 LTS
Ubuntu 12.04 CentOS7 Conda version with modules
Administrator version

Conda vs brew

Clone this wiki locally