我有以下宏,它以 TIFF 格式同时从 QuPath 导出多个注释。是否可以更改代码以使输出 TIFF 文件的名称包含其相应的注释标签?我将不胜感激任何建议。
def server = getCurrentServer()
// Define output path (relative to project)
def name = GeneralTools.getNameWithoutExtension(server.getMetadata().getName())
def pathOutput = buildFilePath(PROJECT_BASE_DIR, 'Tiff_Images', name)
mkdirs(pathOutput)
// Define output resolution & convert to downsample (or downsample directly)
//double requestedPixelSize = 2.0
//double downsample = requestedPixelSize / server.getPixelCalibration().getAveragedPixelSize()
// Don't downsample
double downsample = 1.0
// Export each region
int i = 0
for (annotation in getAnnotationObjects()) {
def region = RegionRequest.createInstance(
server.getPath(), downsample, annotation.getROI())
i++
//def outputPath = buildFilePath(pathOutput, 'Region ' + i + '.tif')
def outputPath = buildFilePath(pathOutput, name + 'BAPP_' + i + '.tif')
writeImageRegion(server, region, outputPath)
}