I am trying to run scripts on some .scn slides by QuPath-m0.2.3 on Linux.
./QuPath-m0.2.3 script tile_exporter.groovy -i myslide.scn
The exported tiles are generated from the macro image, instead of slide image data.
I have tested a .svs and it works fine.
Wehn I drag and drop the .scn into QuPath GUI on windows, a prompt pops up and ask me which image I would like to open. Is there an equivalent in scripting?
How do I export the slide image data instead of the macro image of .scn?
Official tile exporter script from the docs:
tile_exporter.groovy
/**
* Script to export image tiles (can be customized in various ways).
*/
// Get the current image (supports 'Run for project')
def imageData = getCurrentImageData()
// Define output path (here, relative to project)
def name = GeneralTools.getNameWithoutExtension(imageData.getServer().getMetadata().getName())
def pathOutput = buildFilePath(PROJECT_BASE_DIR, 'tiles', name)
mkdirs(pathOutput)
// Define output resolution in calibrated units (e.g. µm if available)
double requestedPixelSize = 5.0
// Convert output resolution to a downsample factor
double pixelSize = imageData.getServer().getPixelCalibration().getAveragedPixelSize()
double downsample = requestedPixelSize / pixelSize
// Create an exporter that requests corresponding tiles from the original & labelled image servers
new TileExporter(imageData)
.downsample(downsample) // Define export resolution
.imageExtension('.tif') // Define file extension for original pixels (often .tif, .jpg, '.png' or '.ome.tif')
.tileSize(512) // Define size of each tile, in pixels
.annotatedTilesOnly(false) // If true, only export tiles if there is a (classified) annotation present
.overlap(64) // Define overlap, in pixel units at the export resolution
.writeTiles(pathOutput) // Write tiles to the specified directory
print 'Done!'