Depending of file internals type (bayer, or full color), only one pointer in imgdata.rawdata is non-NULL:
raw_image - for bayer or X-Trans (color filter array) images
color3_image - for full-color (Foveon, linear DNG) images if 3-channel data extractor was used
color4_image - for full-color images with 4-channel data extractor
(if color4_image is not-NULL, this does not always mean you have 4-channel input, it could-be 3-channeld and zeroes in 4th channel, inspect imgdata.idata.colors for that).
And similar three pointers for floating point input: float_image, float3_image, float4_image.
So, your code should check all six pointers (or only three if floating point input is not expected) and select image type based on 'what pointer is non-NULL'
Depending of file internals type (bayer, or full color), only one pointer in imgdata.rawdata is non-NULL:
raw_image - for bayer or X-Trans (color filter array) images
color3_image - for full-color (Foveon, linear DNG) images if 3-channel data extractor was used
color4_image - for full-color images with 4-channel data extractor
(if color4_image is not-NULL, this does not always mean you have 4-channel input, it could-be 3-channeld and zeroes in 4th channel, inspect imgdata.idata.colors for that).
And similar three pointers for floating point input: float_image, float3_image, float4_image.
So, your code should check all six pointers (or only three if floating point input is not expected) and select image type based on 'what pointer is non-NULL'