Skip to content

Conversation

@OCopping
Copy link
Contributor

This PR aims to fix NDPluginStats and allow for using the "Profiles" tool for colour cameras. Currently the code manually assigns Dim 0 and Dim 1 to sizeX and sizeY respectively, but this is only the case for mono cameras. For RGB cameras, Dim 0 is used for RGB channels.

Instead I propose we use a the same logic as use in NDPluginROI, where getInfo determines the correct variables, based on the number of dims and the selected colour mode, and assigns it to an NDArrayInfo_t structure that is returned to the script for better assignment.

Fixes #541

@OCopping OCopping force-pushed the fix-ndstats-for-colour-cams branch from 23a3dc5 to 8c7cb70 Compare July 24, 2025 08:03
@MarkRivers
Copy link
Member

I don't think this is going to help with your goal of producing profiles for color cameras. NDArrays for RGB color cameras have 3 dimensions, [NX, NY, 3]. Note that the documentation here:
https://areadetector.github.io/areaDetector/ADCore/NDPluginStats.html
says this:

Each calculation can be independently enabled and disabled. Calculations 1 and 4 can be performed on arrays of any dimension. Calculations 2 and 3 are restricted to 2-D arrays.

Calculations 2 and 3 are centroids and profiles. This is enforced here:

if (pArray->ndims > 2) return(asynError);

and here:
if (pArray->ndims > 2) return(asynError);

@OCopping
Copy link
Contributor Author

Closed re- conversation in #541

@OCopping OCopping closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NDStats plugin "Profiles" is broken for colour cameras

2 participants