slideMacro - swvanderlaan/slideToolKit GitHub Wiki
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 thebash
version.
Supported formats
- TIFF
- Aperio
- Hamamatsu
- iScan
- iScanHT
- Leica
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"
.
- Sets the macro suffix. The default is
-
-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
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.
- Specifies the input, which can be either a single image file, a directory containing files, or a wildcard pattern (e.g.,
-
-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.