Hi,
can Zen analyze a 16-bit image to count the number of pixels with a value above a certain threshold (like 5000)? So far we have used Zen for controlling the Axio Observer microscope and only recently started using the image acquisition module. At the beginning of our imaging experiment, we take four snapshots of different Z planes. We need help for the next step in the macro - analyze the four images from different Z planes to find the image with a maximum number of pixels above 5000 threshold value, and select that Z plane for the rest of image acquisition.
We are taking snapshots instead of using the Z-stack feature of Zen, as the continuous laser exposure during Z-stack bleaches the sample. The exposure during snapshots for each plane is only 10 ms and the fluorophore bleach is minimal.
Here is our macro so far-
## Snapshot of 1st Z plane
experiment1 = Zen.Acquisition.Experiments.GetByName("JF552.czexp")
image1 = Zen.Acquisition.AcquireImage(experiment1)
Zen.Application.Documents.Add(image1)
## Snapshot of 2nd Z plane
focPos = Zen.Devices.Focus.ActualPosition
newfocPos = focPos + 40
Zen.Devices.Focus.MoveTo(newfocPos)
experiment2 = Zen.Acquisition.Experiments.GetByName("Jf552.czexp")
image2 = Zen.Acquisition.AcquireImage(experiment2)
Zen.Application.Documents.Add(image2)
## Snapshot of 3rd Z plane
newfocPos = focPos + 80
Zen.Devices.Focus.MoveTo(newfocPos)
experiment3 = Zen.Acquisition.Experiments.GetByName("DIC.czexp")
image3 = Zen.Acquisition.AcquireImage(experiment3)
Zen.Application.Documents.Add(image3)
## Snapshot of 4th Z plane
newfocPos = focPos + 120
Zen.Devices.Focus.MoveTo(newfocPos)
experiment4 = Zen.Acquisition.Experiments.GetByName("DIC.czexp")
image4 = Zen.Acquisition.AcquireImage(experiment4)
Zen.Application.Documents.Add(image4)
Thank you very much for your guidance.
Anand
Count number of pixels above a threshold value (5000)
-
- Posts: 14
- Joined: Wed Dec 02, 2020 7:53 pm
-
- Posts: 180
- Joined: Wed May 20, 2020 10:10 am
Re: Count number of pixels above a threshold value (5000)
Hello Anand Ranjan,
there are two ways to do that.
The primary approach is to use the analysis package with its analysis wizard.
In step 3 you can set the threshold between e.g. 5000 and 65535.
In step 6 'Classes 1' is selected, then click on Edit, finally double click on 'Area Unscaled' for calculation.
With this analysis setting you will get a Table with the value 'Area Unscaled' of the image selected.
The 'Area Unscaled' corresponds with the number of pixels having a value between 5000 and 65535.
The secondary approach is via processing.
The function Threshold allows to set the low and high value to e.g. 5000 and 65535.
With 'create binary' selected the output is an binary image which 'shows' values between 5000 and 65535.
there are two ways to do that.
The primary approach is to use the analysis package with its analysis wizard.
In step 3 you can set the threshold between e.g. 5000 and 65535.
In step 6 'Classes 1' is selected, then click on Edit, finally double click on 'Area Unscaled' for calculation.
With this analysis setting you will get a Table with the value 'Area Unscaled' of the image selected.
The 'Area Unscaled' corresponds with the number of pixels having a value between 5000 and 65535.
The secondary approach is via processing.
The function Threshold allows to set the low and high value to e.g. 5000 and 65535.
With 'create binary' selected the output is an binary image which 'shows' values between 5000 and 65535.
Re: Count number of pixels above a threshold value (5000)
Hi,
I have a related question, I acquired a multi-channel image by LSM980 with the set up of 8 bit. But my following up analysis require a 16 bit TIFF with 65,000 shades of grayscale. Is it possible to export 8 bit CZI to 16 bit TIFF? Does the 8 bit CZI only produce 8 bit TIFF?
Thank you,
Best,
Meng
I have a related question, I acquired a multi-channel image by LSM980 with the set up of 8 bit. But my following up analysis require a 16 bit TIFF with 65,000 shades of grayscale. Is it possible to export 8 bit CZI to 16 bit TIFF? Does the 8 bit CZI only produce 8 bit TIFF?
Thank you,
Best,
Meng
-
- Posts: 180
- Joined: Wed May 20, 2020 10:10 am
Re: Count number of pixels above a threshold value (5000)
Hello Meng Pu,
please have a look at the Processing tab and use function 'Change Pixel Type'.
In OAD you can call
You can use 'Image Export' (again Processing tab) to export the image.
Please be sure to enable 'Show All' so that all features can be seen.
Needless to say that 'Convert to 8 bit' has to be disabled in your case.
In OAD the macro looks like
In both cases it is possible use the Macro Recorder to generate the macro code for you!
I hope this helps.
please have a look at the Processing tab and use function 'Change Pixel Type'.
In OAD you can call
Code: Select all
imageGray16 = Zen.Processing.Utilities.ChangePixelType(imageGray8, ZenPixelType.Gray16)
Please be sure to enable 'Show All' so that all features can be seen.
Needless to say that 'Convert to 8 bit' has to be disabled in your case.
In OAD the macro looks like
Code: Select all
processingsetting = Zen.Processing.Utilities.Settings.SingleFileExportSetting(ZenExportFileType.JPEG)
processingsetting.Compression = ZenTiffCompression.None
processingsetting.ConvertTo8Bit = False
processingsetting.DestinationFolder = r'C:\Users\...'
processingsetting.OriginalData = True
...
Zen.Processing.Utilities.ExportSingleFile(imageGray16, processingsetting)
I hope this helps.