Skip to content

Commit

Permalink
change default ring and resize value options
Browse files Browse the repository at this point in the history
  • Loading branch information
WALIII committed Aug 2, 2019
1 parent f3db44a commit f34cede
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Analysis Pipeline/FS_AV_Parse.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function FS_AV_Parse(DIR,varargin)
gif_dir=[pwd,'/gif'];
error_dir =[pwd,'/error'];
plot_spectrogram =0;
resize_factor = 0.3;
resize_factor = 1;

if exist(mat_dir,'dir') rmdir(mat_dir,'s'); end
if exist(gif_dir,'dir') rmdir(gif_dir,'s'); end
Expand Down
23 changes: 16 additions & 7 deletions Analysis Pipeline/FS_Plot_ROI.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
crop_correct=0;
counteri = 1;
ring = 0; % subtract ring around ROI ( local backgrounds)

resize = 0.3


nparams=length(varargin);
Expand Down Expand Up @@ -126,6 +126,8 @@

roi_n=length(ROIS.coordinates);
roi_t=zeros(roi_n,frames);
ring_t=zeros(roi_n,frames);

ave_time=0:1/ave_fs:length(mic_data)/fs;
[path,file,ext]=fileparts(mov_listing{i});
save_file=[ file '_roi' ];
Expand All @@ -147,14 +149,15 @@
fprintf(1,formatstring,round((j/roi_n)*100));

for k=1:frames
tmp=mov_data(ROIS.coordinates{j}(:,2),ROIS.coordinates{j}(:,1),k);
tmp=mov_data(round(ROIS.coordinates{j}(:,2)*resize),round(ROIS.coordinates{j}(:,1)*resize),k);

if ring == 1;

[yCoordinates, xCoordinates] = GetRing(ROIS.coordinates{j},rows,columns);
[yCoordinates, xCoordinates] = GetRing(round(ROIS.coordinates{j}*resize),rows,columns);
annul=mov_data(yCoordinates,xCoordinates,k);
roi_t(j,k)=mean(tmp(:))-mean(annul(:));
else
roi_t(j,k)=mean(tmp(:));
ring_t(j,k) = mean(annul(:));
else
roi_t(j,k)=mean(tmp(:));

end
Expand All @@ -174,7 +177,7 @@

%------[ Background and Neuropil]--------%

[Bgnd, Npil] = FS_neuropil(mov_data,ROIS);
[Bgnd, Npil] = FS_neuropil(mov_data,ROIS,resize);

roi_ave.Bgnd{counteri}=interp1(timevec,Bgnd,ave_time,'spline');
roi_ave.Npil{counteri}=interp1(timevec,Npil,ave_time,'spline');
Expand All @@ -185,8 +188,14 @@
for j=1:roi_n
clear tmp; clear dff; clear yy2; clear yy;


if ring ==1;
% tmp=roi_t(j,:) - ring_t(j,:);
tmp = roi_t(j,:)-smooth(ring_t(j,:),12)';
tmp(:,1:10) = roi_t(j,1:10)-ring_t(j,1:10);
else
tmp=roi_t(j,:);
end

tmp = tmp(:,(1:size(timevec,2)));
if baseline==0
norm_fact=mean(tmp,3);
Expand Down
3 changes: 1 addition & 2 deletions Analysis Pipeline/GetRing.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
G = boundary(ROI_dat);
G2 = round(G*1);

scalF = 1.1;
scalF = 1.5;
scalF2 = scalF-1;


Expand All @@ -14,7 +14,6 @@
% figure(); imagesc(h3)



[yCoordinates, xCoordinates] = find(h3);

% figure(); plot(ROI.coordinates{1}(:,1),ROI.coordinates{1}(:,2)); hold on; plot(xCoordinates,yCoordinates,'*');
Expand Down
6 changes: 3 additions & 3 deletions Analysis Pipeline/helpers/FS_neuropil.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [Bgnd, Npil] = FS_neuropil(out_mov,ROI)
function [Bgnd, Npil] = FS_neuropil(out_mov,ROI,resize)
% Extract Neuropil

% d09/24/17
Expand All @@ -8,9 +8,9 @@
% Make indexes for the ROI coordinates
for i = 1:size(ROI.coordinates,2);
if i == 1;
X2 = [ROI.coordinates{i}(:,2),ROI.coordinates{i}(:,1)];
X2 = [round(ROI.coordinates{i}(:,2)*resize),round(ROI.coordinates{i}(:,1)*resize)];
else
X = [ROI.coordinates{i}(:,2),ROI.coordinates{i}(:,1)];
X = [round(ROI.coordinates{i}(:,2)*resize),round(ROI.coordinates{i}(:,1)*resize)];
X2 = cat(1,X2,X);
end
end
Expand Down

0 comments on commit f34cede

Please sign in to comment.