Tile image acquisition in ZENcore

In this subforum specific Topics concerning ZEN Core, e.g workbenches, are discussed
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Tile image acquisition in ZENcore

Post by Andrei Poliakov »

Hello, I am writing a script allowing a user to automatically acquire multiple images covering a rectangular area of interest on a sample. I think I more or less got the grasp of how to do that with simple images, that is, I seem to be able to control stage movement, adjust some camera settings, take and save the images. However I would like the user to optionally take tile images and this is where I am stuck at the moment. I am afraid I don't quite understand the programmatic aspects of tile acquisition and am missing something important.

So... would you be able to give me a code example, or point me to the proper documentation, or possibly just tell me what Zen object I should be using (I will try introspection on it and that might help)? A task is like this: I need to take X by Y tiled image using overlap N%. I can roughly estimate the resulting image size in microns and thus the center (or the corner) position of the image within my sample. I can move the stage to the proper starting position and focus the sample programmatically. I need the code that will set up and run tile acquisition for X, Y and N above (more parameters may come useful of course) and stitch the image. Any help will be really appreciated!
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Tile image acquisition in ZENcore

Post by CarlZeissMicroscopy3 »

Hello Andrei Poliakov,

sorry, but before we discuss your case could you please post which Microscope you use and what your ‘future intensions’ are.

What I mean is that we have to clarify in the first step if ZenCore is really the ideal software for your work or if there is an option to switch to Zen blue.
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Re: Tile image acquisition in ZENcore

Post by Andrei Poliakov »

Hello, we use Axio Imager.Z2m and our clients, which are important in this context, have similar systems.

Our intentions are these. We have been developing and maintaining an AxioVision VBA-based automated mineralogy solution for quite a while, and a number of our clients are using it already. Apparently, with AxioVision out of support, they need to move to a ZEN-based solution which we are working on at the moment. Automated acquisition of multiple images is an extremely important component of the solution and fully relies on the API provided by Zeiss, Python OAD in this particular case. We have a good understanding of the workflow required from our previous AxioVision work and are pretty confident we can repeat the essential part of it with ZEN (but I may come up with some questions of course). The only critical component missing appears to be Tiles (former MosaiX) acquisition. I remember that I had to ask Zeiss directly about MosaiX as its API wasn't really documented at the time. Seems to be a similar situation here.

Before we seriously consider switching to ZEN blue let me say that, at the time we ordered our own upgrade, Zeiss strongly recommended ZENcore for our sort of application, which we purchased. Even more importantly, we have passed that recommendation to our clients, and some of them as far as I know have also ordered ZENcore-based upgrades. Thus, it would be very good to be able to obtain a ZENcore-based solution. If the details are not quite suitable for public discussion please feel free to contact me directly at andrei.poliakov@csiro.au. Your prompt response will be highly appreciated and I hope you all stay safe and well in these troubled times. Thank you, Andrei
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Tile image acquisition in ZENcore

Post by CarlZeissMicroscopy3 »

Hello Andrei Poliakov,

ok, now I have a better understanding of your situation.

Just some general thoughts. First, without a deeper knowledge of your application it is of course not possible to say Zen blue fits ‘better’ for your case than Zen Core. On the other side you mentioned that you had AxioVision before with MosaiX. Although programming in AxioVision, most probably in VBA, was not too easy it offered a wide variety of features. I also understand that you and your clients have already updated to Zen Core.
Now comes the tricky part. Even if Zen Core is the optimum platform for you and your clients YOU, as the developing part, might need ONE license of Zen blue to ‘extend’ the programming capabilities of Zen Core.

A very simple example. You have already worked with the macro object model and perhaps you have found

Zen.Acquisition.Execute(ZenExperiment)

This is a great function to start an arbitrary experiment, including simple to complex mosaic (tiles) experiments. But the question is, where can you get a ZenExperiment from? To my knowledge there is no way to ‘generate’ a ZenExperiment in Zen Core. But ‘experiments’ are a main feature of Zen blue and are configured and saved more or less automatically via the GUI. Tiles (mosaic) even has a very good ‘Advanced Tiles Viewer’ in addition to just adding tiles. The same is true for hardware-settings etc.

So my intention is not to push you away from Zen Core but I would like to recommend having a look at Zen blue before you start programming so that you also know the ‘hidden capabilities’ of your system. Maybe you can get a ‘full blown’ demo version of Zen blue for a couple of days.
(And don’t forget to enable ‘Show All’ in the headline of all the windows on the Acquisition Tab ; -)

I hope this clarifies the situation a bit.
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Re: Tile image acquisition in ZENcore

Post by Andrei Poliakov »

Hello and thanks for your suggestion. I will certainly try to get my hands on ZEN blue (which was one of my ideas anyway). Just a couple of thoughts that I am unable to fully explore at the moment, so maybe you will be able to clarify things for me a bit.

- Is my understanding correct that ZenExperiment is essentially an XML file describing the setup that can be loaded into ZenExperiment class and then executed? Would you be able to supply me with a simple example of such file suitable for the task I described earlier (starting at the current stage position take an X by Y tiled image with N% overlap, stitch it and make programmatically available to the rest of the script or possibly just save with the name specified by the script; I assume it will have some real numbers rather than Xs but that's ok). That might be a perfect starting point for me.

- With regard to having access to ZenExperiment in ZENcore - earlier I tried to do something about that and discovered that, while Zen.Acquisition.Experiments has 0 count in Free mode in Job mode it actually changes to 1. Maybe not just for any job, in my case I had it with 2D Acquisition, Manual Tiles and OAD of course. My attempts to play around with that single object were not particularly successful, e.g. it looked like it had 0 blocks and thus most methods would not work. However I can certainly save it as XML, and presumably load another one after modification. It just looks like poking around the XML file blindly is not a particularly healthy approach; some key settings are also likely missing as the file looks structured but pretty blank. Which takes me back to the previous question of whether I can get from you a useful XML or a good description of the file parameters.

Many thanks,
Andrei
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Re: Tile image acquisition in ZENcore

Post by Andrei Poliakov »

Just a quick update after spending some time with the saved XML file above:

- Many fields seemingly related to Tiles experiment; most of them too cryptic for me to try modifying them unless I am absolutely desperate.
- Can load this experiment in Free mode and communicate with it programmatically with certain level of success; for example,.IsTilesExperiment(0) that failed completely in Job mode now returns False. Hoped for True of course...
- Attempting to execute the experiment returns an error "Exception during experiment start preparation occurred: Object reference not set to an instance of an object".

I guess I am more or less stuck at that so the questions in my previous post are still important.

Thanks in advance,
Andrei
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Tile image acquisition in ZENcore

Post by CarlZeissMicroscopy3 »

Hello Andrei Poliakov,

I fully understand your argumentation and your posts reveal that you have a deeper understanding of the mechanisms but it is not possible for me to deliver a ZenExperiment, especially tiles (MosaiX), that is suitable for a certain microscope.

After talking to several experts this can just be done by setting up the same microscope including camera etc. that you use. Sorry, but I am not in a position to do this.

In your case the only reasonable way to proceed is to install Zen blue on your system and create some experiments that are tailored to your hardware.
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Re: Tile image acquisition in ZENcore

Post by Andrei Poliakov »

Hello again, I have got ZEN blue and seem to be making some progress, that is, a Tile experiment recorded in ZEN blue seems to run in ZENcore and stage movement during the execution of the code below looks as expected.

Code: Select all

ze.Load(path + "Tile1_test.czexp")
image1 = Zen.Acquisition.AcquireImage(ze)
However image1 seems to be a single image, not the expected stitched tile image. The experiment itself produced a tile image. I suspect I am doing wrong something pretty trivial here, like an incorrect call, would you be able to advise? Many thanks!
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Tile image acquisition in ZENcore

Post by CarlZeissMicroscopy3 »

I suspect I am doing wrong something pretty trivial here, like an incorrect call ...
Hello Andrei Poliakov,

with
image = Zen.Acquisition.AcquireImage(ZenExperiment)
an image is acquired like a 'Snap' on the 'Locate' tab, but with settings defined in ZenExperiment, as far as the ZenExperiment is applicable to the 'Snap'.

As already stated before you will need
Zen.Acquisition.Execute(ZenExperiment)
to really ‚Start Experiment‘ with ZenExperiment ‘selected’ on the 'Acquisition' tab.

I hope this is the line of code you need to proceed.
Andrei Poliakov
Posts: 13
Joined: Tue Jan 19, 2021 7:46 am

Re: Tile image acquisition in ZENcore

Post by Andrei Poliakov »

So... how do I then access the acquired tile image from within the OAD script?
Post Reply