Acquire EDF image

Post your acquisition-related questions and macros here
Post Reply
Danilo Lussana
Posts: 2
Joined: Fri Dec 17, 2021 11:32 am

Acquire EDF image

Post by Danilo Lussana »

I am happily using the OAD module, creating several helpful scripts. However, I still cannot found a complete documentation (links are welcome!) and thus I miss some functions. In particular, I want to acquire an EDF image like in the ZEN menu. I would like something like:

image = Zen.Acquisition.AcquireImageWithEDF (zmin, zmax)

I cannot find anything useful on the forum, as well as on Github. However "EDF" is present in the OAD help, so I think it is possible to use it. If a simple function like the one I suggested is not present, can you show me a script to combine a set of images at different z to a single EDF image?

Thank you
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Acquire EDF image

Post by CarlZeissMicroscopy3 »

Hello Danilo Lussana,

I would recommend the following steps:
* Set up your ZStack experiment manually on the acquisition tab of Zen blue
* Start the experiment so that you know that it is running
* Finally save the experiment as 'MyZStack'.
* Execute the macro:

Code: Select all

zenExperiment = ZenExperiment()
zenExperiment.Load("MyZStack")
imageZStack = Zen.Acquisition.Execute(zenExperiment)

imageEDF = Zen.Processing.Filter.Sharpen.EDF(imageZStack)

Zen.Application.Documents.Add(imageEDF)
You can improve the macro e.g. by saving an EDF-Setting and hand it over to the EDF-function.

I hope this helps ...
Danilo Lussana
Posts: 2
Joined: Fri Dec 17, 2021 11:32 am

Re: Acquire EDF image

Post by Danilo Lussana »

Thanks, but the problem is that I can't record experiments because I'm using ZenCore and not Zen Blue. However, I think I have found a solution. The experiment output is a ZenImage object with all individual images. I got the same object using Add.SubImage (), then I processed it with Zen.Processing.Filter.Sharpen.EDF (). It works fine for me.

At the bottom you will find a function that is basically the one I asked for in the first post. I hope it will be useful to someone else, also because I think it is more flexible than the experiment way, you can dynamically change the range for z-stack.
Would you like to add a comment? Did I miss any important aspects?

Thanks again.

Code: Select all

def AcquireWithEDF(step,slices):
    if slices%2==0:
        slices=slices+1 #so we have the actual focus slice and the same number of slices over and under
    #get actual z
    z0 =Zen.Devices.Focus.ActualPosition
    #create Z-stack images object
    z_stack=ZenImage()

    #acquire images
    for i in range(slices):
        z=z0+(i-int(slices/2))*step 
        Zen.Devices.Focus.MoveTo(z)
        image=Zen.Acquisition.AcquireImage()
        #image.Save('d:\\EDF\\provaEDF'+str(i+1)+'.jpg')
        z_stack.AddSubImage(image,0,0,i)
    #return to original z
    Zen.Devices.Focus.MoveTo(z0)

    #Combining images with EDF
    processingsetting = Zen.Processing.Filter.Settings.EDFSetting()
    processingsetting.Method = ZenExtendedFocusMethod.Wavelets
    processingsetting.WaveletSetting.ZStackAlignment = ZenAlignmentQuality.NoAlignment
    EDFimage = Zen.Processing.Filter.Sharpen.EDF(z_stack, processingsetting)
    
    return EDFimage
and then it can be used like:

Code: Select all

img=AcquireWithEDF(10,12)
img.Save('d:\\EDF\\provaEDF.jpg')
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Acquire EDF image

Post by CarlZeissMicroscopy3 »

Dear Danilo Lussana,

yes, you can do it by building up a ZStack image step by step and then call EDF-function.

Sorry for leading you in the direction of Zen blue but there is a separate part within the forum for "ZEN Core Specific Topics" ...
julie diane
Posts: 24
Joined: Wed Jun 28, 2023 1:25 am

Re: Acquire EDF image

Post by julie diane »

Danilo Lussana wrote: Fri Dec 17, 2021 2:57 pm I am happily using the OAD module, creating several helpful scripts. However, I still cannot found a complete documentation (links are welcome!) and thus I miss some functions. In particular frugal living at 62, I want to acquire an EDF image like in the ZEN menu. I would like something like:

image = Zen.Acquisition.AcquireImageWithEDF (zmin, zmax)

I cannot find anything useful on the forum, as well as on Github. However "EDF" is present in the OAD help, so I think it is possible to use it. If a simple function like the one I suggested is not present, can you show me a script to combine a set of images at different z to a single EDF image?

Thank you
Here's a high-level script outline to create an EDF image from a stack of images at different focal planes:

python

# Import necessary modules
import Zen

# Define parameters
zmin = 0 # Minimum Z-position
zmax = 10 # Maximum Z-position
output_path = "path_to_save_edf_image.tif"

# Acquire a Z-stack of images
image_stack = []
for z in range(zmin, zmax + 1):
Zen.Acquisition.SetZPosition(z)
image = Zen.Acquisition.AcquireImage() # Acquire an image at the current Z-position
image_stack.append(image)

# Create the EDF image
edf_image = Zen.ImageProcessing.CreateExtendedDepthOfField(image_stack)

# Save the EDF image
Zen.IO.SaveImage(edf_image, output_path)

# Release resources
Zen.Acquisition.ReleaseImages(image_stack)
Please note that this is a simplified example, and you may need to adjust it based on your specific requirements and the scripting capabilities of Zen and the OAD module. Additionally, the actual implementation may vary depending on the version of Zen you are using, and you might need to consult the Zen documentation or contact their support for more specific guidance.

Remember to replace "path_to_save_edf_image.tif" with the actual file path where you want to save the EDF image.
Victoria Smith
Posts: 1
Joined: Thu Nov 23, 2023 7:21 am
Contact:

Re: Acquire EDF image

Post by Victoria Smith »

Hello, I’m glad to hear that you are using the OAD module for your microscopy tasks. I understand that you are looking for a way to acquire an EDF image using a script. Unfortunately, I could not find any documentation or example that shows how to do that with the OAD module. However, I did find some alternative solutions that might be helpful for you.

One option is to use the ImageJ software, which is a free and open source image processing program. ImageJ has a plugin called Extended Depth of Field1 that can merge a stack of images taken at different focal positions into a single in-focus image.
Adam Sara
Posts: 6
Joined: Fri Dec 15, 2023 2:20 am
Contact:

Re: Acquire EDF image

Post by Adam Sara »

good
[url=https://suikagame.io]Suika game[/url]
Sarah Smith
Posts: 2
Joined: Sat Nov 18, 2023 5:47 pm

Re: Acquire EDF image

Post by Sarah Smith »

To acquire an EDF (Extended Depth of Field) image using the OAD module in ZEN software of https://vscocamapk.com/, there isn't a direct function like `Zen.Acquisition.AcquireImageWithEDF(zmin, zmax)`, but you can create a script to achieve this. Here's an outline based on the information from the ZEISS Microscopy Developer Community:

1. Define a function to acquire a Z-stack of images and then apply EDF processing to combine them into a single image.
2. In this function, you would first get the current Z position, then create a loop to acquire images at different Z positions, and add them to a ZenImage object.
3. After acquiring the Z-stack, apply EDF processing using `Zen.Processing.Filter.Sharpen.EDF`.
4. The function returns the EDF image, which you can then save or process further as needed.

Here's a simplified version of such a function:

```python
def AcquireWithEDF(step, slices):
# ... (code to acquire Z-stack and apply EDF processing)
return EDFimage
```

You can use this function by specifying the step size and number of slices, and then save the resulting image:

```python
img = AcquireWithEDF(10, 12)
img.Save('path_to_save_image')
```

This approach offers flexibility in terms of dynamically changing the range for the Z-stack. For more specific implementation details and code examples, you should visit the ZEISS Microscopy Developer Community forum or the OAD GitHub repository, as they provide a wealth of information and examples for working with the OAD module in ZEN software.

Additionally, the ZEN Microscopy Software from ZEISS provides a comprehensive solution for microscopy users, with features like automated smart acquisition, intuitive image analysis, and cloud-based data management. This might be useful to explore further functionalities and updates related to your microscopy work.
vollent4 eer
Posts: 2
Joined: Thu Feb 01, 2024 9:01 am

Re: Acquire EDF image

Post by vollent4 eer »

For an immersive gaming experience, follow these steps on your gaming rig:

Configure your ZStack experiment manually using the acquisition tab on Zen Blue, just like fine-tuning your game settings.
Ensure the experiment is running smoothly to guarantee optimal performance, akin to launching your favorite game.
Save your customized experiment as 'MyZStack' for quick and easy access, much like saving your personalized game settings.
Execute the provided macro to streamline the process, making ZStack experiments on Zen Blue as seamless as setting up your preferred gaming environment. Level up your experimentation game with this efficient approach!" https://apkvent.com/haileys-treasure-adventure-apk-2/
Post Reply