Linear Access to the image data

This access is available on the ImagePlane, e.g. to access the first plane:

LinearAccessData imageData = image.Planes[0].GetLinearAccess();

This gives you the BasePtr, XInc, and YInc as IntPtrs. This call will throw if linear access is not possible, though. To get around that you can call:

image.Planes[0].TryGetLinearAccess(out LinearAccessData imageData);

This does not throw, but returns false if not possible. You then have to use:

image.Planes[0].Vpat

By the way: if you know the pixel datatype upfront you can also use (for byte pixels):

LinearAccessData<byte> imageData = image.Planes[0].GetLinearAccess<byte>();

Additionally to the base pointer and increments you get an indexer to access the pixel data:

imageData[x, y] = 255 - imageData[x, y];

(This is convenient, but direct pointer access is faster.)

3 Likes