Apply Region Filter on Images with no Scale Info

In this subforum specific Topics concerning ZEN Core, e.g workbenches, are discussed
Post Reply
Fredrik Olsson
Posts: 16
Joined: Mon May 25, 2020 9:53 am

Apply Region Filter on Images with no Scale Info

Post by Fredrik Olsson »

Hi,

When retrieving subimages from a ZenImage container the scaling is lost. We would like to apply region filters based on the feature size in mikrometers. The image analysis settings are applied automatic and since binning and objective may vary I wonder if there is a way to change the numbers of pixels in the region filter automatically? We currently use ZenCore 3.1.

Best regards
Fredrik Olsson
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Apply Region Filter on Images with no Scale Info

Post by CarlZeissMicroscopy3 »

Hello Fredrik Olsson,
the scaling is lost
maybe a workaround is to read the scaling (X,Y,Z) of the ZenImage and applying the scaling to the subimages.

something like

Code: Select all

imageSub.Scaling.X = imageMain.Scaling.X
imageSub.Scaling.Y = imageMain.Scaling.Y
imageSub.Scaling.Z = imageMain.Scaling.Z
for each individual subimage.

I hope this solves your problem.
Fredrik Olsson
Posts: 16
Joined: Mon May 25, 2020 9:53 am

Re: Apply Region Filter on Images with no Scale Info

Post by Fredrik Olsson »

Yes it works.
However, the unit becomes somehow nm instead of µm. The magnitude of different feature dimensions seems ok although now in nm, but one need to consider the shift in units when setting up the ias and the region filter. For instance, if 2 µm is the target for minimum Bound Height one need to fill in 2000 instead of 2.

BR
Fredrik Olsson
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Apply Region Filter on Images with no Scale Info

Post by CarlZeissMicroscopy3 »

Hello Fredrik Olsson,

thanks for your reply!

The problem will be discussed internally and I will try to get a fix for that!
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Apply Region Filter on Images with no Scale Info

Post by CarlZeissMicroscopy3 »

Hello Fredrik Olsson,

meanwhile there is an open bug concerning your problems with scaling.
We will fix this by including the ScalingUnits (X,Y,Z) in the macro interface.

As we could not reproduce your case easily it would be interesting for us to get a code snippet showing the problem!

Thank you!
Fredrik Olsson
Posts: 16
Joined: Mon May 25, 2020 9:53 am

Re: Apply Region Filter on Images with no Scale Info

Post by Fredrik Olsson »

Hi,

I have used something like:

for item in self.posList:
xPos = item.X
yPos = item.Y
Zen.Devices.Stage.MoveTo(xPos, yPos)

if imageCollection:
if Count == 0:
try:
Zen.Acquisition.AutoExposure()
except:
sys.exit('Autoexposure failed')
first = Zen.Acquisition.AcquireImage()
first.Name = sampleName + '_' + str(Count)
first.Save(destFolder + '\\' + first.Name + '.czi')
container = ZenImage()
container.AddSubImage(first,0,0,Count)
else:
image = Zen.Acquisition.AcquireImage()
image.Name = sampleName + '_' + str(Count)
container.AddSubImage(image,0,0,Count)

##and later...

imageFirst = Zen.Application.LoadImage(destfolder + ‘\\’ sample_data.getSample_ID() + ‘_0.czi’)
images = Zen.Application.LoadImage(destfolder + ‘\\’ sample_data.getSample_ID() + ‘.czi’)
for nr in range(1,NrOfImages + 1):
image = images.CreateSubImage('Z('+str(nr)+')')
image.Name = sample_data.getSample_ID() + '_' + str(nr) + '.czi'
image.Scaling.X = imageFirst.Scaling.X
image.Scaling.Y = imageFirst.Scaling.Y

--------------------------------------------------------------------
and so on...

BR
Fredrik Olsson
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Apply Region Filter on Images with no Scale Info

Post by CarlZeissMicroscopy3 »

Thank you Fredrik Olsson!

I will come back on the scaling-problem when there is a solution available.
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Apply Region Filter on Images with no Scale Info

Post by CarlZeissMicroscopy3 »

Hello all,

the next version Zen Core 3.4 allows to transfere the scaling from one image to another

e.g.:
imageNew.Scaling = imageOriginal.Scaling
RodneyK Hrlich
Posts: 2
Joined: Wed Oct 04, 2023 5:29 am

Re: Apply Region Filter on Images with no Scale Info

Post by RodneyK Hrlich »

This scaling factor can be obtained from the image's metadata or by calibrating the system using known standards. Once you have the pixel dimensions, you can manually adjust the area filter settings in ZenCore to match your desired feature size.
Post Reply