read a condition to progress in a script

Share your programming ideas for various measurement and analysis tasks here
Post Reply
erwan Grandgirard
Posts: 8
Joined: Wed May 12, 2021 4:46 pm
Location: Strasbourg

read a condition to progress in a script

Post by erwan Grandgirard »

a) An image is made with 5x objective and after analysis with Zen I detect the number of objects and I create a table

#script
ias = ZenImageAnalysisSetting()
ImageAS = 'Nuclei R'
Number_of_object = 10
Image= Zen.Application.ActiveDocument
print(output_OVScan)

ias.Load(ImageAS)

# Analyse the image interactively
Zen.Analyzing.AnalyzeInteractive(Image, ias)

# Create Zen table with results for all detected objects
AllObj = Zen.Analyzing.CreateRegionsTable(Image)
Zen.Application.Documents.Add(AllObj)


b) conditions is set; for instansce if the 'Number of Object detected ' is >10 continu the script else stop the script

do you know if there is a function to read the number of object in the table (AllObj)?

thank you

best
Erwan from Strasbourg!
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: read a condition to progress in a script

Post by CarlZeissMicroscopy3 »

Hello erwan Grandgirard,

I'm not sure if I fully understand your case but maybe the following idea helps.

The AllObj table is of Type ZenTable and ZenTable is derived from DataTable.

So most of the things you can do with a DataTable (see .Net DataTable / DataRow in the internet or intellisense in the Macro Editor) is applicable.

Code: Select all

table = Zen.Application.ActiveDocument

firstRow = table.Rows[0]
firstCell = firstRow[0]
stringValue = firstCell.ToString()
print stringValue

for row in table.Rows:
    print row[0]
I hope this helps to proceed.
erwan Grandgirard
Posts: 8
Joined: Wed May 12, 2021 4:46 pm
Location: Strasbourg

Re: read a condition to progress in a script

Post by erwan Grandgirard »

It's works and it's perfect!!!

thank you !! :)
jamieyam smith
Posts: 2
Joined: Thu Mar 23, 2023 12:17 pm

Re: read a condition to progress in a script

Post by jamieyam smith »

To include a condition for progression in a script, you can use an if statement. An if statement allows you to execute a certain block of code only if a specific condition is met. Here's an example of how to incorporate a condition into a script, the script prompts the user to enter a number. If the entered number is greater than 10, the script proceeds Pinterest Gifs Downloader with the "Proceeding.." message and executes any additional code inside the if block. If the number is less than or equal to 10, the script instead displays the "Exiting..." message and executes any additional code inside the else block.
Rose J Lever
Posts: 30
Joined: Tue Jun 20, 2023 10:20 pm

Re: read a condition to progress in a script

Post by Rose J Lever »

To populate a CSV table with image names, you can use Python to iterate through the image files in a directory and write their names into a CSV file. By utilizing the os and csv modules, you can easily accomplish this task. First, you specify the directory where the images are stored. Then, you retrieve the list of image files in that directory. Next, you create a CSV file and write a header row to it. Finally, you iterate through the image files, writing each image name into a new row in the CSV file. This allows you to create a table with the image names in a CSV format for further analysis or processing. If anyone want to know about Garage door replacement Windsor visit here
Post Reply