ScanImage 2019 : ROI Integration (Online Analysis)

Introduction

ScanImage allows to select several regions of interest (ROIs) for live analysis. The pixel intensities within these ROIs is averaged. The resulting time trace is plotted over time in the ROI Integration Display and can be used to drive a digital or analog output.

ROI Integration Experiment Setup
Error rendering macro 'html' : Notify your Confluence administrator that "Bob Swift Atlassian Add-ons - HTML" requires a valid license. Reason: VERSION_MISMATCH

Integration ROIs

An Integration ROI is a 3D object, that defines the geometry of an image feature. See Scanfields, ROIs, ROI Groups to learn more about the ROI concept. The ROI is defined by 2D-cross sections at different z-positions. For each of these slices, a mask can be defined that weighs the underlying pixel values.

 

3D ROI Integration Experiment Setup
Error rendering macro 'html' : Notify your Confluence administrator that "Bob Swift Atlassian Add-ons - HTML" requires a valid license. Reason: VERSION_MISMATCH

Cross-section of an Integration ROI at one z-slice. The ROI contains a weighted mask.

Calculation of Intensity

If no mask is assigned to an integration ROI, the sum of all pixels of the ROI is calculated and is divided by the number of all pixels in the ROI. If the ROI stretches over more than one slice, the sum of all pixels of all slices in the ROI is calculated. The final output is generated when the last slice of the integration ROI is acquired. 

If a mask is assigned to an integration ROI, each pixel is multiplied by the associate weight of the mask. Next, the sum of all weighted pixels is calculated. This sum is then divided by the sum of all elements in the mask.

Icon

The ROI integration is done in the Matlab thread. If processing a single frame does not finish before the next frame arrives, Matlab can drop the incoming frame to stay in sync with the acquisition (the frame data is still logged to disk in this case). If this happens, the ROI Integration does not process the dropped frame.

 

Output File Format

If ROI Integration is enabled in the Integration Control Window, saving is enabled in the Main Controls Window, and a Grab or Loop is performed, ScanImage saves the integration value for all integration values into a CSV file, which is located in the same directory as the Tiff file containing the video stream.

 

Programmatic ROI access

The integration ROIs can be created, modified and deleted using the ScanImage API. See ROI API to learn more.

Example: Modify the geometry of an Integration ROI
hSI.hIntegrationRoiManager.roiGroup.rois(1).scanfields(1).centerXY = [1,1];      % define the center of the scanfield in scan angle coordinates
hSI.hIntegrationRoiManager.roiGroup.rois(1).scanfields(1).sizeXY = [1,1];        % define the size of the scanfield in scan angle coordinates
hSI.hIntegrationRoiManager.roiGroup.rois(1).scanfields(1).mask = rand(10,10);    % define a (random) weighted mask for an integration scanfield

 

Motion Correction

If the sample moves during an active acquisition, the pre-defined Integration ROIs might not process the correct portion of the image. To ensure the Integration ROIs track the sample, enable ScanImage's Motion Correction feature.

 

Output Channels

The output generated by the ROI Integration module can be used to drive analog and digital outputs or to call user defined functions. See ROI Integration Output Channels for more information.

 

Attachments: