Chunk data#
Opto Engineering cameras can append additional information to image data, arranged in chunks.
Examples of common chunk data sent with image data are exposure time, image width and height, gain and many other. Each value refers of course to the image it’s sent with.
Each chunk stored with the image is represented by a GenICam feature and it can be retrieved by calling the IImage.GetChunkNode
function.
First of all, chunk data functionality must be manually enabled via the device nodemap.
//Enable chunk data
GenApi.IBoolean chunkModeActive = device.GetNodeMap().GetNode<IBoolean>("ChunkModeActive");
chunkModeActive.Value(true);
Single chunks (each one provided by a dedicated node) can be enabled or disabled individually.
The IEnumeration
interface allows the client code to select the desired chunk and then enable or disable it via ChunkEnable
.
For example, let’s enable the exposure time chunk.
//Get the node for chunk data selection and select exposure time chunk
GenApi.IEnumeration chunkSelector = device.GetNodeMap().GetNode<IEnumeration>("ChunkSelector");
chunkSelector.FromString("ChunkExposureTime");
//Enable the exposure time chunk data
GenApi.IBoolean chunkEnable = device.GetNodeMap().GetNode<IBoolean>("ChunkEnable");
chunkEnable.Value(true);
When a new image is grabbed, the chunk data nodes can be accessed via its interface.
Itala.IImage image = device.GetNextImage(500);
if (image.HasChunkData)
{
//Read the chunk value, automatically updated by ItalaApiNET after grab
GenApi.IFloat chunkExposureTime = image.GetChunkNode("ChunkExposureTime");
Console.WriteLine("Current exposure time is " + chunkExposureTime.Value);
}
pImage.Dispose();
Note
Chunk feature names and types are also standardized by SFNC (Standard Feature Naming Convention), which is part of the GenICam standard. Please refer to the official SFNC document to gather information about a particular chunk. Refer to the official GenICam document to find a more in-depth description of the standard. All the material is freely accessible from the GenICam Introduction page.