Extract aperture and field parameters from czi metadata

Everything OAD-related that won't fit in the other categories: share general aspects of macro programming and discuss the OAD environment
Post Reply
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Extract aperture and field parameters from czi metadata

Post by user-6033 »

Hi,

I just wonder if there is an easy way to get those two parameters from czi image? I extract them in case of jpg and tif from the xml-file. I guess I can temporarily save czi image as tif/jpg and extract the parameters from the generated xml file but maybe there is an easier way. It would have been nice to have specially the aperture in the metadata (common for all file formats) since this is a parameter that, at least for us, quite often is changed by the user when adjusting the micrscope settings. However, the field setting is quite static from user to user in our case.

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

Post by user-4 »

Hello Fredrik,

it is a good idea to export an image with XML first.
In the XML you can see the path to the data required.

In the next step get the data according to the example shown below:

Code: Select all

## Remove all open documents
Zen.Application.Documents.RemoveAll()
##
## Load an image interactively with Open dialog (File menu)
## Display the image
image = Zen.Application.LoadImage()
Zen.Application.Documents.Add(image)
##
## get metadata
cCol = image.Metadata.GetMetadataWithPath('Metadata/DisplaySetting/Channels[current]/Color')
cScene = image.Metadata.GetMetadataStringWithPath('Metadata/Information/Image/Dimensions/S/Scenes[current]/Name')
zoom = image.Metadata.GetMetadataStringWithPath('Metadata/Information/Image/MicroscopeSettings/ZoomSettings/Magnification')
## show values
print 'Current color: ',cCol
print 'Current scene: ',cScene
print 'Zoom factor of Axio Zoom: ',zoom
Zen.Application.Pause('Current color: ' + cCol +'\n' + 'Current scene: ' + cScene +'\n' + 'Zoom factor: ' + zoom)
Post Reply