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
1hSf = scanimage.mroi.scanfield.fields.IntegrationField(); % create an Integration Scanfield
2hSf.channel = 1; % assign IntegrationField to channel 1
3hSf.centerXY = [0.5,0.5]; % set center [x,y] of IntegrationField to center of Reference space
4hSf.sizeXY = [0.25,0.25]; % set size [x,y] of IntegrationField in Reference space
5hSf.rotationDegrees = 0; % set rotation of IntegrationField in Reference space
6hSf.mask = rand(10); % set a mask with weights for underlying pixels
7
8hRoi = scanimage.mroi.Roi(); % create empty Roi
9z = 0;
10hRoi.add(z,hSf); % add IntegrationField at z = 0
11
12hSI.hIntegrationRoiManager.roiGroup.add(hRoi); % add IntegrationRoi to IntegrationRoiManager
Create IntegrationField by masking entire Imaging Scanfield
1hSf_imaging = hSI.hRoiManager.currentRoiGroup.rois(1).scanfields(1); % get the current imaging Scanfield
2z = hSI.hRoiManager.currentRoiGroup.rois(1).zs(1); % get z of the current imaging Scanfield
3resXY = hSf_imaging.pixelResolution; % get pixel resolution of current imaging Scanfield
4mask = zeros(resXY(2),resXY(1)); % create a mask for the scanfield that has the same pixel resolution as the imaging scanfield
5mask(1:10,1:10) = 1; % set upper left corner to 1
6
7hSf = scanimage.mroi.scanfield.fields.IntegrationField.createFromMask(hSf_imaging,mask); % create IntegrationField from imaging scanfield and mask
8hSf.channel = 1; % assign IntegrationField to channel 1
9
10hRoi = scanimage.mroi.Roi(); % create empty Roi
11hRoi.add(z,hSf); % add IntegrationField to Roi
12hSI.hIntegrationRoiManager.roiGroup.add(hRoi); % add IntegrationRoi to IntegrationRoiManager
Create IntegrationField by masking individual pixels of Imaging Scanfield
1hSf_imaging = hSI.hRoiManager.currentRoiGroup.rois(1).scanfields(1); % get the current imaging Scanfield
2z = hSI.hRoiManager.currentRoiGroup.rois(1).zs(1); % get z of the current imaging Scanfield
3
4% define mask by assigning a weight to individual pixels in the imaging scanfield
5mask = [1,1, 1; ...
6 1,2, 1; ...
7 2,1, 1; ...
8 2,2, 1];
9hSf = createFromMask(hSf_imaging,mask); % create IntegrationField from imaging scanfield and mask
10hSf.channel = 1; % assign IntegrationField to channel 1
11
12Roi = scanimage.mroi.Roi(); % create empty Roi
13hRoi.add(z,hSf); % add IntegrationField to Roi
14hSI.hIntegrationRoiManager.roiGroup.add(hRoi); % add IntegrationRoi to IntegrationRoiManager