Reading ChunkEncoderValue from AT C5

Hi! I’m trying to read ChunkEncoderValue node from AT C5-1280 using .NET API:

var device = DeviceFactory.Open("GenICam.vin");

var deviceModeMap = device.NodeMaps[NodeMapNames.Device];

CvbStream stream = device.Stream;
stream.Start();
try
{
    using (StreamImage image = stream.Wait())
    {
        var encoderValues = new List<long>();
        var scanLineSelector = deviceModeMap["ChunkScanLineSelector"] as IntegerNode;
        for (var scanLine = scanLineSelector.Min; scanLine <= scanLineSelector.Max; scanLine += scanLineSelector.Increment)
        {
            scanLineSelector.Value = scanLine;
            var encoderValueNode = deviceModeMap["ChunkEncoderValue"] as IntegerNode;
            encoderValues.Add(encoderValueNode.Value);
        }
    }
}
finally
{
    stream.Stop();
}

But accessing property encoderValueNode.Value throws error:

System.IO.IOException: 'IntegerNode[Std::ChunkEncoderValue]: Node is not readable.'

Why this node is not readable?

I can read this node using AT’s examples from cxSupportPackage with exactly the same camera settings.

I can read encoder value from chunk payload (Using Chunk Mode Data with CVB.NET). But I wanted to use vendor independed GenICam SFNC.

GenICam Browser is reading encoder values just fine. Seems like I’m missing something…
2021-04-26 13_22_57-GenICam Browser

Hi kokostek,

the transmission of chunk data needs to be enabled inside the GenICam.vin-driver to be available over the api.

Also the “Chunk Mode” needs to be activated over the camera NodeMap:
activateChunkMode

Than your code should be working.
Note that transmitting chunk data might have a negative inpact on the performance.

3 Likes

Hi Simon,

thanks a lot for your solution. It works fine (I didn’t test performance yet though).

I just want to add my two cents regarding using GenICam.vin driver. One can also set AttachChunk programmatically if she opens device using Discover. I myself prefer Discover option as it permits to select device using info like IP address, etc. (not just CVB channel number). Here is the example:

// Select device by serial number, IP address, etc...
// Selecting first device here to be short.
DiscoveryInformationList foundDevices = DeviceFactory.Discover();
var selectedDevice = foundDevices[0];

// Set CVB color format to "Raw".
// I suppose we need this when working with chunks.
selectedDevice.SetParameter("PixelFormat", "0");

// Turn on "Attach chunk" parameter, so that chunk
// nodes become readable.
selectedDevice.SetParameter("AttachChunk", "1");

// Open device and configure chunk mode.
var device = DeviceFactory.Open(selectedDevice);
var deviceNodeMap = device.NodeMaps[NodeMapNames.Device];
var chunkModeActive = deviceNodeMap["ChunkModeActive"] as IBooleanNode;
chunkModeActive.Value = true;

// Read encoder value(s) along with image.
CvbStream stream = device.Stream;
stream.Start();
try
{
    using (StreamImage image = stream.Wait())
    {
        var encoderValues = new List<long>();
        var scanLineSelector = deviceNodeMap["ChunkScanLineSelector"] as IntegerNode;
        for (var scanLine = scanLineSelector.Min; scanLine <= scanLineSelector.Max; scanLine += scanLineSelector.Increment)
        {
            scanLineSelector.Value = scanLine;
            var encoderValueNode = deviceNodeMap["ChunkEncoderValue"] as IntegerNode;
            encoderValues.Add(encoderValueNode.Value);
        }
    }
}
finally
{
    stream.Stop();
}

Credit to this post for example of setting driver parameters.

2 Likes