I would like to export a multi-position image as single scene images, with burnt-in annotations and data zone.
I have 2 issues I cannot fix:
- I don't know how to keep the comment in the data zone of the multi-scene image and don't know how to export the data zone with the image
- annotations are not kept after splitting scenes (I can insert a new scalebar automatically but I cannot keep/find the annotations drawn in the multi-scene image)
Can you help me please?
Thanks.
Here my code:
Code: Select all
from System.IO import File, Directory, FileInfo
# read active image
image = Zen.Application.ActiveWorkbench.GetDefaultInputValue()
# split scenes and save files in temp folder
path = 'C:\\Temp\\'
Zen.Processing.Utilities.SplitScenes(image,path,ZenCompressionMethod.None,True,True)
# define export path
window = ZenWindow()
Images = Zen.Application.Environment.GetFolderPath(ZenSpecialFolder.Images)
window.AddFolderBrowser('exportfolder','Export folder ',Images)
result=window.Show()
exportpath = str(result.GetValue('exportfolder'))
# export all scenes with data zone
files = Directory.GetFiles(path,'*.czi')
for i in range(0,files.Length):
file = files[i]
fileInfo = FileInfo(file)
pathAndFile = path + "\\" + fileInfo.Name
image = Zen.Application.LoadImage(pathAndFile,False)
# insert scalebar
image.InsertDefaultScaleBarGraphic()
# burn-in graphics
newimage = image.BurnInGraphics()
# fetch image name from splitted scenes
imagename = exportpath + "\\" + image.NameWithoutExtension + ".jpg"
# save single scenes
newimage.Save(imagename, 100,ZenSaveCompressionMode.AsIs,ZenCompressionMethod.None)
image.Close()
newimage.Close()