Skip to content

slideMacro

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

slideMacro is designed to extract macro images from whole-slide image (WSI) files (e.g., *.TIF, *.ndpi) in .png-format. It allows users to specify the magnification level and additional options for displaying, saving, and handling the output.

Two versions are available:

  • This is a bash implementation.
  • This is a python3 implementation which is much faster than the bash version.

Supported formats

  • TIFF
  • Aperio
  • Hamamatsu
  • iScan
  • iScanHT
  • Leica

Bash version

The bash version is using ImageMagick.

Examples:

  • Setting the file:
    ./slideMacro -f "file.TIF"
  • Setting the macro suffix:
    ./slideMacro --file="file.TIF" --macrosuffix=".layer5"
  • Forcing a specific layer:
    ./slideMacro --file="file.TIF" -l 3
  • Setting additional convert arguments:
    ./slideMacro --file="file.TIF" --convert-args='-resize 300x300 -rotate 90'
  • Ignoring dependencies:
    ./slideMacro --file="file.TIF" --ignore-dependencies
  • Displaying help:
    ./slideMacro --help
  • Displaying version information:
    ./slideMacro --version

Job list examples:

  • Print a job list
find "$(pwd)" -iname "*.TIF" -printf 'slideMacro is processing file [ %p ].\n' -exec $(command -v "$SCRIPTNAME") --file "{}" \;
  • Print a job list for SLURM
find "$(pwd)" -iname "*.TIF" -type f \
    -exec printf "sbatch $DEFAULT_SLURMARGS --chdir=\"$(pwd)/\" " \; \
    -exec printf "$(command -v "$SCRIPTNAME") " \; \
    -exec echo "--file=\"{}\"" \;

Argument(s):

  • -f, --file <filename>
    • Specifies the virtual slide file to create a mask from.

Optional argument(s):

  • --macrosuffix <text>
    • Sets the macro suffix. The default is ".macro".
  • -l, --layer <integer>
    • Forces a specific layer by layer id.
  • --convert-args='<arguments>'
    • Sets convert arguments (use '=' sign and quotes).
  • --ignore-dependencies
    • Ignores missing dependencies but gives a warning.
  • --help
    • Displays the help message.
  • --version
    • Displays version and license information.

Dependencies

  • convert

Python version

Example usage:

python slideMacro.py --input AE1234.SR.ndpi

Argument(s):

  • -i, --input
    • Specifies the input, which can be either a single image file, a directory containing files, or a wildcard pattern (e.g., *.ndpi). Required.
  • -l, --levels
    • Magnification level to extract, with '6' as level 6. Try: 6. Required.

Optional argument(s):

  • -o, --outdir
    • Output dir, default is present working directory. Optional.
  • -s, --suffix
    • Suffix to append to end of file, default is 'm' for thumbnail and '#' for a given level. Optional.
  • -t, --type
    • Output file type, default is png (which is slower), other options are tif. Optional.
  • -f, --force
    • Force output even if it exists. Optional.
  • -v, --verbose
    • While writing images also display image properties. Optional.
  • -h, --help
    • Show this help message and exit. Optional.

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