Icon

For an overview of the ScanImage Roi concept, please review the article 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
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
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
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