Skip to content

Commit

Permalink
Merge pull request #18 from gardner-lab/Liberti
Browse files Browse the repository at this point in the history
Liberti
  • Loading branch information
WALIII authored Jan 23, 2020
2 parents b00b8d1 + ab00ded commit 4bdcb27
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
15 changes: 9 additions & 6 deletions Analysis Pipeline/FS_Plot_ROI.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
n = 1; % How much to interpolate by?
roi_ave.samp_rate = 30;
ave_fs=roi_ave.samp_rate*n; % multiply by a variable 'n' if you want to interpolate
save_dir='roi';
date = datestr(now);
save_dir=['roi_',date];
template=[];
per=2;
max_row=5;
Expand All @@ -28,7 +29,7 @@
crop_correct=0;
counteri = 1;
ring = 0; % subtract ring around ROI ( local backgrounds)
resize = 0.3
resize = 0.3;


nparams=length(varargin);
Expand Down Expand Up @@ -111,8 +112,8 @@




mov_data = double(mov_data2);
disp(['resizing video by a factor of', num2str(resize)]);
mov_data = imresize(double(mov_data2),resize);

% Check For Dropped Frames:
if any(G >.25) %0.05 for 30fps
Expand Down Expand Up @@ -156,7 +157,7 @@
[yCoordinates, xCoordinates] = GetRing(round(ROIS.coordinates{j}*resize),rows,columns);
annul=mov_data(yCoordinates,xCoordinates,k);
roi_t(j,k)=mean(tmp(:));
ring_t(j,k) = mean(annul(:));
ring_t(j,k) = median(annul(:));
else
roi_t(j,k)=mean(tmp(:));

Expand Down Expand Up @@ -190,13 +191,15 @@

if ring ==1;
% tmp=roi_t(j,:) - ring_t(j,:);
tmp = roi_t(j,:)-smooth(ring_t(j,:),12)';
tmp = roi_t(j,:)-smooth(ring_t(j,:),5)';
tmp(:,1:10) = roi_t(j,1:10)-ring_t(j,1:10);
tmp = tmp+min(smooth(ring_t(j,:),5)); % add back the min...
else
tmp=roi_t(j,:);
end

tmp = tmp(:,(1:size(timevec,2)));

if baseline==0
norm_fact=mean(tmp,3);
elseif baseline==1
Expand Down
2 changes: 1 addition & 1 deletion Analysis Pipeline/FS_tiff.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function FS_tiff(videodata,varargin)



filename = 'G.tiff';
filename = 'G';
format_switch = 1;
nparams=length(varargin);

Expand Down
8 changes: 6 additions & 2 deletions Analysis Pipeline/GetRing.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
G = boundary(ROI_dat);
G2 = round(G*1);

scalF = 1.5;
scalF = 2.5;
scalF2 = scalF-1;

moat = 2;
scalF3 = moat-1;


h = poly2mask(ROI_dat(G,1)*scalF-mean(ROI_dat(G,1))*scalF2 ,ROI_dat(G,2)*scalF -mean(ROI_dat(G,2)*scalF2),row,col);
h2 = poly2mask(ROI_dat(G,1),ROI_dat(G,2),row,col);
h2 = poly2mask(ROI_dat(G,1)*moat-mean(ROI_dat(G,1))*scalF3 ,ROI_dat(G,2)*moat -mean(ROI_dat(G,2)*scalF3),row,col);
% h2 = poly2mask(ROI_dat(G,1)+moat,ROI_dat(G,2),row,col);

h3 = h-h2;
% figure(); imagesc(h3)
Expand Down

0 comments on commit 4bdcb27

Please sign in to comment.