Skip to content

slideThumb

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

slideThumb provides a command-line interface for extracting and optionally displaying thumbnails from whole-slide images. Users can customize various parameters, and the script includes helpful information about image properties and licensing. The thumbnail extraction is using ImageMagick (bash-version) or based on the OpenSlide library (python-version), and the script is designed to be flexible for different use cases.

Two versions are available:

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

Bash version

The bash version relies on external commands like convert and tiffinfo (part of the ImageMagick toolkit) and Perl.

Argument(s):

  • -f, --file <filename>
    • Specify the virtual slide file from which to extract the thumbnail.

Optional argument(s):

  • -l, --layer <integer>
    • Force a specific layer by layer id.
  • --suffix <text>
    • Specify a suffix to be appended to the filename for the output thumbnail. Default is ".thumb".
  • --extension <text>
    • Specify the output extension for the thumbnail. Default is "png".
  • --output-dir <path>
    • Specify the path to the output directory. Default is "." (relative to the input file).
  • --resize <widthxheight>
    • Specify the maximum output dimensions for the thumbnail. Default is "1024x1024".
  • --convert-args='<arguments>'
    • Specify additional arguments for the convert command (equal sign and quotes are required).
  • --ignore-dependencies
    • Ignore missing dependencies and continue with a warning.
  • --help
    • Display help information.
  • --version
    • Display version and license information.

Examples:

  • Example 1: Basic usage
./slideThumb -f "file.svs"
  • Example 2: Specify layer and custom suffix and extension
./slideThumb --layer=5 --suffix=".suffix" --extension="jpg" "file.tif"

Print a job list for parallel processing:

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

Print a job list for 'SLURM' (if using a queueing system):

for i in $(find ./ -iname "*tif"); do
  j="$(echo "$(cd "$(dirname "$i")"; pwd)"/"$(basename "$i")")";
  echo "sbatch $DEFAULT_SLURMARGS" "$(command -v "$SCRIPTNAME")" --file="${j}"
done

Python version

Example usage:

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

Argument(s):

  • -i, --input
    • Provide a single WSI or list of WSIs. Required.

Optional argument(s):

  • -d, --display
    • Also show Thumbnail on display, default simply writes thumbnails. Optional.
  • -o, --outdir
    • Output dir, default is present working directory. Optional.
  • -s, --suffix
    • Suffix to append to end of file, default is 'thumb' for thumbnail. 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