Stability issue of Zen.Analyze

In this subforum specific Topics concerning ZEN Core, e.g workbenches, are discussed
Post Reply
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Stability issue of Zen.Analyze

Post by user-6033 »

Hi,

We run Zen Core 2.6 with latest hotfix for 2.6. Quite often our software hangs when entering analyze/interactiveanalyze (we have evaluated both scenarios). The problems seems to disappear when adding a wait-step just before Zen.Anayze.... We use now 500 ms, 200 ms seemed to little. I have not yet seen any eventual cure for this problem in v2.7 and its hotfixes. When the software hangs one need to close the software and end the process in the task manager. Any suggestion?

Best regards
Fredrik Olsson
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Fredrik Olsson,

we tried to reproduce your case and discovered that the full path and filename must be given to load the ImageAnalysisSetting!

ias = ZenImageAnalysisSetting()
ias.Load("C:\\ProgramData\\Carl Zeiss\\ZenStorage\\Image Analysis Settings\\Setting.czias")


With this ImageAnalysisSetting and

img = Zen.Application.ActiveDocument

each of the following two lines of code

Zen.Analyzing.AnalyzeInteractive(img, ias)
tables = Zen.Analyzing.AnalyzeToTable(img, ias)


worked as expected.


Just to be on the save side: The ImageAnalysisSetting and the Image must fit together!


If you still have problems, please upload the Image and the ImageAnalysisSetting.
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Hi,

I am afraid that the problem might be more complicated. I am aware of the ias loading and always run an File.Exist within a separate function, see below, for the full path before attempting to load any ias files.

What we see is that within a for loop a large set of images both could be run without any problems at all but could also stop at different images while running the very same set of images several times. It is not so easy to understand the problem since the Zen.Analyzing.Analyze just get stuck without error messages until you kill the proces by means of the task manager. I tried to add closures of images at the end but are not fully sure whether they all are necessary, especially temporally objects like maskO. The problem seemed to be reduced while adding a pause before entering the Zen.Analyzing.Analyze but not completely. When I have seen it in interactive mode it seems to occur after an image is shown in the wizard but before default red color is applied during thresholding. However, running the very same image once more is normally not a problem. It then does not seem for me to be either directly related to the image or the ias. Can it be sensitive in some way for disposing objects while running over a large set of images? Do I have to add the image first to Zen.Application.ActiveDocument? Have you noticed similar problems where the Zen.Analyze may get stuck? I show you below an extracted code snippet which shows steps in closure to the analyze-part. I also upload the ias if that is of any help.


Kind regards
Fredrik Olsson


def GetImageAnalyingSetting(measFile):
""" Utility function to verify if the image analysing file exist since ias.Load
does not give any error message in case of missing file"""

ias = ZenImageAnalysisSetting()
if File.Exists(iasDir + measFile + '.czias'):
ias.Load(iasDir + measFile + '.czias')
else:
sys.exit('Cannot load '+ iasDir + measFile + '.czias')
return ias




ias = GetImageAnalyingSetting("MaxTwoFilter")

for item in files:
image = Zen.Application.LoadImage(item)
maskO = Zen.Processing.Segmentation.Threshold(image,threshold['GrayLow'] ,threshold['GrayHigh'],False)
maskO.Name = image.Name
Zen.Application.Wait(500)
maskA = Zen.Analyzing.Analyze(maskO,ias)


A lot of processing.............

image.Close()
maskO.Close()
Attachments
MaxTwoFilter.czias.txt
(16.19 KiB) Downloaded 311 times
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Fredrik Olsson,

sorry, but we cannot reproduce your case.
We tried small and medium sized images and it worked with your ias-file.
We always tested 'without Zen.Application.Wait(500)' which should never be needed in this context!

Do you have also problems when you use

image = Zen.Application.LoadImage(item)

to repeatedly load the same image and thus do exactly the same workflow say a 100 times?

Please tell us your ZenCore Version plus Hotfix you use.
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Hi

We upgraded to ZenCore 2.7 H2 yesterday (from 2.6 with latest hotfix). Unfortunately the problem with Zen.Analyzing.Analyze did not disappear. I have made some further testing both with full sets of different images and also running the very same image in a for loop ~120 times. The software get stuch each time, even for single image looping. It also get stucked quite randomly, sometimes only after a few loops and sometimes after up to 80 loops.


Adding a timestep did not really solve this issue however, what really improved was inserting an intermediate saving step of the mask (see below). I tried to run it with different images and could make it 120 times 9 times of 10. It did get stuck once and this time the system stopped by itself in Zen.Analyzing.Analyze telling me that there were errors (see attached image).

If you want I can provide an example image, but since they are 2752x2208 in Gray16 and in raw czi-format they are too big to be uploaded... But I doubt it could be the image itself which causes this.


maskO = Zen.Processing.Segmentation.Threshold(image,threshold['GrayLow'] ,threshold['GrayHigh'],False)
maskO.Name = image.Name
maskO.Save("saving directory...)
maskA = Zen.Analyzing.Analyze(maskO,ias)

Kind regards
Fredrik Olsson
Attachments
Error in analyze.jpg
Error in analyze.jpg (13.54 KiB) Viewed 8138 times
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Hello Fredrik,

I'm very sorry but this bug has not been fixed so far.

At the moment the bug is 'located' but it seems to be a 'nasty' bug that has to do with 'parallel' computing.

This is the reason why it cannot be 'exactly' reproduced and shows a different behavior on various computers.

I’m pushing this bug and hope it will be fixed with the next Hotfix.

It will be published in this thread when it is done!
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Thanks for letting us/me know.

Kind regards
Fredrik Olsson
user-4
Posts: 397
Joined: Thu Jan 01, 1970 1:00 am

Post by user-4 »

Definitely planned for the next Hotfix of ZenCore 2.7 (HF 5)
Martin Stas
Posts: 8
Joined: Mon Jun 19, 2023 12:04 pm

Re: Stability issue of Zen.Analyze

Post by Martin Stas »

Hey everyone!

I wanted to share my experiences and knowledge regarding the stability issue with Zen.Analyze. It seems like we're encountering frequent hangs when entering the analyze/interactiveanalyze functions, even with the latest hotfix for version 2.6. To mitigate this problem, we tried adding a wait-step just before initiating Zen.Analyze, and it helped alleviate the issue. Initially, we experimented with a 200 ms wait, but found that 500 ms worked better for us.

Unfortunately, I have not come across any definitive solution for this trouble in version 2.7 or its subsequent hotfixes. Whenever the software hangs, the solely recourse we have is to close the application and terminate the procedure through the task manager.

If all of us has encountered a similar issue or has any pointers to address this problem, I would greatly respect your insights. Let's collaborate and leverage our collective knowledge to find a resolution.

AI Customer Service & Support: Explore 6 Trend Solutions can be instrumental in tackling such technical challenges, and I'm excited to see how AI innovations can enhance stability and performance in software systems.
Post Reply