IntegrationRoiManager

scanimage.components.IntegrationRoiManager, reachable as hSI.hIntegrationRoiManager, computes intensity traces from integration ROIs while an acquisition runs, and can drive analog or digital outputs from those traces.

See also

ROI Integration (Online Analysis) for the feature guide and IntegrationField API for building integration scanfields.


Properties

Property

Description

roiGroup

scanimage.mroi.RoiGroup holding the integration ROIs.

enable

Enable the computation of intensity traces.

enableDisplay

Plot the traces.

integrationHistoryLength

Number of samples retained in the trace history. Default 1000.

postProcessFcn

Function handle applied to the integration values before they drive the outputs.

outputChannelsNames

Names of the configured output channels.

outputChannelsPhysicalNames

The physical terminal each output channel is bound to.

outputChannelsEnabled

Logical array, one per output channel.

outputChannelsFunctions

Cell array of function handles, one per output channel, mapping integration values to an output value.

outputChannelsRoiNames

The ROI each output channel evaluates.


Methods

Method

Description

[intRois,values,timestamps,framenumbers] = hSI.hIntegrationRoiManager.getIntegrationValues()

The most recent integration value for each ROI.

[intRois,valueHistory,timestampHistory,framenumberHistory] = hSI.hIntegrationRoiManager.getIntegrationHistory()

The retained history, integrationHistoryLength samples deep.

hSI.hIntegrationRoiManager.refreshOutputChannelsList()

Re-read the configured dabs.generic.IntegrationRoiOutputChannel devices.

hSI.hIntegrationRoiManager.enable = true;

[rois,vals,ts] = hSI.hIntegrationRoiManager.getIntegrationValues();
for idx = 1:numel(rois)
    fprintf('%s: %.3f\n',rois(idx).name,vals(idx));
end

% history, for plotting
[rois,hist,tHist] = hSI.hIntegrationRoiManager.getIntegrationHistory();
plot(tHist,hist);

Post processing and outputs

postProcessFcn runs on every update, before the output channel functions. It is the hook for closed-loop experiments: threshold a trace, and drive an output.

The signature matches the shipped default, scanimage.components.integrationRois.integrationPostProcessingFcn, which simply passes the values through:

hSI.hIntegrationRoiManager.postProcessFcn = @myPostProcess;

function integrationValues = myPostProcess(rois,integrationDone,arrayIndices, ...
        integrationValueHistory,integrationTimestampHistory,integrationFrameNumberHistory)
    integrationValues = integrationValueHistory(arrayIndices);
    % ... modify integrationValues here ...
end

Setting postProcessFcn to empty restores the default function.

Note

The post-process function and the output channel functions run inside the frame callback. Keep them short - work done here delays the display and, on a loaded system, the acquisition.


Events

updateAnalysisDisplay fires when new integration values are available; resetIntegrationRoiDisplay fires when the display should be cleared, for example when the ROI group changes.