-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectROIManually.m
More file actions
31 lines (23 loc) · 1.05 KB
/
SelectROIManually.m
File metadata and controls
31 lines (23 loc) · 1.05 KB
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
30
31
%Pre-select the overall ROI manually.
%To be used together with the Kmeans script, so we don't have to select the
%ROI during Kmeans calculation.
%
%Note: Written on 2018/07/06.
function []=SelectROIManually(InFile)
%Load the *FilterAndRegisterImages.mat files.
load(InFile);
NofFrames=size(RegisteredImages,4);
%Sort the image to get high intensity values and apply threshold.
SortedImage=squeeze(sort(RegisteredImages(:,:,SignalChannel,:),4,'descend'));
%This is hard coded for now, but can be specified.
PercentToUse=10;
FramesToUse=ceil(NofFrames*PercentToUse/100);
MaxMeanImage=mean(SortedImage(:,:,1:FramesToUse),3);
figure,imshow(MaxMeanImage,[])
%Manual selection of the responding region.
ManualROI=roipoly;
position=strfind(InFile,'.'); %gives the position of the period in the string FileName. This is the last of the set of the files from the same region.
NewName=InFile(1:position-1); %string NewName has the file name without the ".tiff".
Outfile = strcat(NewName,'SelectROIManually');
save(Outfile,'ManualROI');
clear