append measurements results in a table

In this subforum specific Topics concerning ZEN Core, e.g workbenches, are discussed
Post Reply
Julien Toquant
Posts: 23
Joined: Fri May 29, 2020 1:54 pm

append measurements results in a table

Post by Julien Toquant »

Hi,

I would need a macro that merges all measurements results from several images in one final table.
All images are previously acquired, annotated with a length measurement tool and saved as .czi in a folder.
The macro should extract all measurement values of each image in this folder and append them in one table.
Could you help me please?
Thanks.
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: append measurements results in a table

Post by CarlZeissMicroscopy3 »

Hello Julien Toquant,

the zenTable object collects all measurement data from czi-files in the folder path.

Code: Select all

from System.IO import File, Directory, FileInfo

path = r'C:\Users\...\Pictures\ImageWithMeasurement'

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) 
    if i == 0:
        zenTable = Zen.Measurement.MeasureToTable(image)
    else:
        zenTable = Zen.Measurement.MeasureToTable(image, zenTable, True)
    image.Close()

Zen.Application.Pause('Number of Rows: ' + str(zenTable.RowCount))
I hope this is what you need.
Julien Toquant
Posts: 23
Joined: Fri May 29, 2020 1:54 pm

Re: append measurements results in a table

Post by Julien Toquant »

Hi,
Yes exactly.
Thanks a bunch.
Julien
Post Reply