-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.m
More file actions
29 lines (24 loc) · 765 Bytes
/
Copy pathexample.m
File metadata and controls
29 lines (24 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function example
myimage = imread('1P5XGlomeruli_00001_00001.tif');
roiwindow = CROIEditor(myimage);
% wait for roi to be assigned
waitfor(roiwindow,'roi');
if ~isvalid(roiwindow)
disp('you closed the window without applying a ROI, exiting...');
return
end
% get ROI information, like binary mask, labelled ROI, and number of
% ROIs defined
[mask, labels, n] = roiwindow.getROIData;
roiwindow.saveROI
delete(roiwindow);
% do something with the ROIs, e.g. display some statistics
for i=1:n
roi_data = double(myimage(labels==i));
std_of_roi_i = std(roi_data);
var_of_roi_i = var(roi_data);
mean_of_roi_i = mean(roi_data);
fprintf('ROI %d has a stddev of %4.2f, a variance of %4.2f and a mean of %4.2f\n',...
i, std_of_roi_i, var_of_roi_i, mean_of_roi_i);
end
end