IntegrationField API

Note

For an overview of the ScanImage® Roi concept, please review the page Scanfields, ROIs, ROI Groups.

For an overview of the RoiGroup and Roi API, please review the article RoiGroup & Roi API

Integration Scanfield

Definition of an IntegrationField

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
hSf = scanimage.mroi.scanfield.fields.IntegrationField();  % create an Integration Scanfield
hSf.channel = 1;                                    % assign IntegrationField to channel 1
hSf.centerXY = [0.5,0.5];                           % set center [x,y] of IntegrationField to center of Reference space
hSf.sizeXY = [0.25,0.25];                           % set size [x,y] of IntegrationField in Reference space
hSf.rotationDegrees = 0;                            % set rotation of IntegrationField in Reference space
hSf.mask = rand(10);                                % set a mask with weights for underlying pixels

hRoi = scanimage.mroi.Roi();   % create empty Roi
z = 0;
hRoi.add(z,hSf);               % add IntegrationField at z = 0

hSI.hIntegrationRoiManager.roiGroup.add(hRoi);  % add IntegrationRoi to IntegrationRoiManager

Create IntegrationField by masking entire Imaging Scanfield

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
hSf_imaging = hSI.hRoiManager.currentRoiGroup.rois(1).scanfields(1);    % get the current imaging Scanfield
z = hSI.hRoiManager.currentRoiGroup.rois(1).zs(1);                      % get z of the current imaging Scanfield
resXY = hSf_imaging.pixelResolution;                                    % get pixel resolution of current imaging Scanfield
mask = zeros(resXY(2),resXY(1));                 % create a mask for the scanfield that has the same pixel resolution as the imaging scanfield
mask(1:10,1:10) = 1;                             % set upper left corner to 1

hSf = scanimage.mroi.scanfield.fields.IntegrationField.createFromMask(hSf_imaging,mask);    % create IntegrationField from imaging scanfield and mask
hSf.channel = 1;  % assign IntegrationField to channel 1

hRoi = scanimage.mroi.Roi();                    % create empty Roi
hRoi.add(z,hSf);                                % add IntegrationField to Roi
hSI.hIntegrationRoiManager.roiGroup.add(hRoi);  % add IntegrationRoi to IntegrationRoiManager

Create IntegrationField by masking individual pixels of Imaging Scanfield

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
hSf_imaging = hSI.hRoiManager.currentRoiGroup.rois(1).scanfields(1);    % get the current imaging Scanfield
z = hSI.hRoiManager.currentRoiGroup.rois(1).zs(1);                      % get z of the current imaging Scanfield

% define mask by assigning a weight to individual pixels in the imaging scanfield
mask = [1,1, 1; ...
        1,2, 1; ...
        2,1, 1; ...
        2,2, 1];
hSf = createFromMask(hSf_imaging,mask); % create IntegrationField from imaging scanfield and mask
hSf.channel = 1;                        % assign IntegrationField to channel 1

Roi = scanimage.mroi.Roi();                     % create empty Roi
hRoi.add(z,hSf);                                % add IntegrationField to Roi
hSI.hIntegrationRoiManager.roiGroup.add(hRoi);  % add IntegrationRoi to IntegrationRoiManager