areaDetector / ADGenICam

areaDetector base class for GenICam cameras.
https://areadetector.github.io/areaDetector/ADGenICam/ADGenICam.html
8 stars 17 forks source link

Camera colour mode setting behaviour #3

Closed LeeHudsonDLS closed 4 years ago

LeeHudsonDLS commented 4 years ago

Hi, I'm not sure if this is intended behaviour but I noticed that setting the :ColorMode PV (from ADCore, NDArrayBase.template) to the desired mode no longer propagates though to the camera via :GC_PixelFormat. This results in this PV doing nothing with the camera. Is this correct?

MarkRivers commented 4 years ago

Yes, I think you are correct. ADGenICam directly supports PixelFormat which is more flexible and powerful, and removes the need to map vendor-specific enums to the limited ColorMode enums.

LeeHudsonDLS commented 4 years ago

Am I right in saying a fix for this is non-trivial as both :DataType and :ColorMode would need to be mapped into :GC_PixelFormat some how?

I've also noticed something I don't quite understand. Using a Manta G325B, when I change :GC_PixelFormat between Mono8 and Mono12 I actually get a change from 8 bit to 16bit in the data. The camera is reporting to be 12bit (:GC_SensorBits). Any idea what's going on here?

LeeHudsonDLS commented 4 years ago

After reading my comment I now see it's obvious it needs to be 8 bit or 16 bit to be a standard data type. I'd still like to know if there's any way we can map :DataType and :ColorMode to :GC_PixelFormat though.

MarkRivers commented 4 years ago

If you look at the mapping table in aravisGigE you will see that if you select DataType=NDUInt16 and ColorMode=NDColorModeMono then it will select the first of these formats that the camera actually supports:

ARV_PIXEL_FORMAT_MONO_14 is commented out because of a problem with a Manta.

One of the pixel formats I actually use a lot is the equivalent of ARV_PIXEL_FORMAT_MONO_12_PACKED which is not in that conversion table at all. This format packs 2 12-bit pixels into 3 bytes, rather than the 4 bytes that are required for 2 pixels with ARV_PIXEL_FORMAT_MONO_12. This reduces the network bandwidth by 25%, increasing the frame rate. In order for it to work there must be code in the IOC that unpacks the data into NDUInt16 arrays. Both the Vimba and Spinnaker SDKs provide that conversion function, but I don't think aravis does.

It seems to me that mapping NDDataType, NDColorMode, and NDBayer into the PIXEL_FORMAT is quite limiting. Each combination of those could map into several of the PixelFomat feature enums depending on packing, number of data bits, etc. One would also need to worry about the order of processing the high-level NDDataType, NDColorMode, and NDBayr versus the low-level GC_PixelFormat feature. Presumably if the user selects a GC_PixelFomat explicitly then that is what we want to use.