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
Clone this wiki locally