Skip to content

Commit

Permalink
Modified v 1 and 3 to allow for variable number layers per stack in m…
Browse files Browse the repository at this point in the history
…ultiposition data-set.
  • Loading branch information
Alistair Boettiger committed Jun 27, 2011
1 parent 67f98ae commit 1d43931
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 31 deletions.
38 changes: 26 additions & 12 deletions Unsupervised_DotFinding.m
Expand Up @@ -8,15 +8,15 @@


tot_time = tic; tot_time = tic;
% Input options % Input options
old_lab = 0; old_lab = 0; Es = 0;
folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/'; folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% % rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %


stackfolder = 's01_MP09/';%'s07_MP08/';% 's03_MP02/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; % stackfolder = 's21_MP07/';% 's04_MP10/';% 's01_MP09/';%'s07_MP08/';% 's03_MP02/';% 's02_MP01/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
fname = 's01_MP09_Hz_22C_c';% 's07_MP08Hz_snaD_22C'; %'s03_MP02_Hz_22C_b';% 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; % fname = 'MP07het_snaD_22C'; % 's04_MP10Hz'; % 's01_MP09_Hz_22C_c';% 's07_MP08Hz_snaD_22C'; %'s03_MP02_Hz_22C_b';% 's01_MP09_Hz_22C_b';% 's02_MP01_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels mRNA_channels = 1; % 3; % 1; % total mRNA channels


sname = fname; % 's03_MP02_Hz_22C_b';% sname = 'MP07het_snaD_22C_1'; Es=4; Zs = 50; % MP07fname; % 's03_MP02_Hz_22C_b';%
ver = '';% '_v2'; ver = '';% '_v2';


% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30 % MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
Expand All @@ -25,11 +25,13 @@


filename = [rawfolder,'/',fname]; filename = [rawfolder,'/',fname];
load([rawfolder,'/',sname,'.mat']) load([rawfolder,'/',sname,'.mat'])
Zs = Datas.LSM_info.DimensionZ;
w = Datas.Stack1.Image1.IMG.width; w = Datas.Stack1.Image1.IMG.width;
h = Datas.Stack1.Image1.IMG.height; h = Datas.Stack1.Image1.IMG.height;
Es = length(fields(Datas)) - 3; % Number of Stacks if Es==0

Zs = Datas.LSM_info.DimensionZ;
Es = length(fields(Datas)) - 3; % Number of Stacks
end
% ------- Option: Focus on subset of image: ------------------- % % ------- Option: Focus on subset of image: ------------------- %
% m = 1/2048; % .9;% .7; % .5; .7; % 1/2048; % % m = 1/2048; % .9;% .7; % .5; .7; % 1/2048; %
% xp1= floor(h/2*m)+1; xp2 = floor(h/2*(2-m))+1; yp1 = floor(w/2*m)+1; yp2 = floor(w/2*(2-m))+1; % xp1= floor(h/2*m)+1; xp2 = floor(h/2*(2-m))+1; yp1 = floor(w/2*m)+1; yp2 = floor(w/2*(2-m))+1;
Expand Down Expand Up @@ -74,7 +76,7 @@
Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian


%% %%
for e= 1:Es for e= 2:Es
%% %%
tic tic
disp('loading data...'); disp('loading data...');
Expand Down Expand Up @@ -113,7 +115,7 @@
if mRNAchn == 1; if mRNAchn == 1;
min_int = 0.05; % just for speed min_int = 0.05; % just for speed
else else
min_int = 0.02; % min_int = 0.01; %
end end


DotLabels= cell(1,Zs); DotLabels= cell(1,Zs);
Expand All @@ -125,12 +127,24 @@
tic; disp('finding dots...'); tic; disp('finding dots...');
for z = 1:Zs % z = 11 for z = 1:Zs % z = 11
im_folder{z} = [rawfolder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif']; im_folder{z} = [rawfolder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif'];
try
Iin_z = imreadfast(im_folder{z}); Iin_z = imreadfast(im_folder{z});
[DotLabels{z},DotData{z},Inds{z},Ints{z}] = dotfinder(Iin_z(xp1:xp2,yp1:yp2,mRNAchn),Ex,Ix,min_int,min_size); [DotLabels{z},DotData{z},Inds{z},Ints{z}] = dotfinder(Iin_z(xp1:xp2,yp1:yp2,mRNAchn),Ex,Ix,min_int,min_size);
end catch err
disp(err.message);
Zs = z-1;
break
end
end
toc; toc;



% resize;
DotLabels= DotLabels(1:Zs);
DotData = DotData(1:Zs);
Inds = Inds(1:Zs);
Ints = Ints(1:Zs);


%% %%


intype = class(Iin_z); intype = class(Iin_z);
Expand Down
8 changes: 4 additions & 4 deletions Unsupervised_DotFinding2.m
Expand Up @@ -12,12 +12,12 @@
folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/'; folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% % rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %


stackfolder = 's01_MP09/';% 's02_MP01/';% 's06_MP10_sna18/'; % %'s10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; % stackfolder = 's05_MP06/';% 's01_MP09/';% 's02_MP01/';% 's06_MP10_sna18/'; % %'s10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
fname ='s01_MP09_Hz_22C_c'; % 's02_MP01_Hz_22C_b'; % 's06_MP10_sna18'; %'s10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; % fname ='s05_MP06Hz'; % 's01_MP09_Hz_22C_c'; % 's02_MP01_Hz_22C_b'; % 's06_MP10_sna18'; %'s10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels mRNA_channels = 2; % 3; % 1; % total mRNA channels


sver = '';% '_1'; % additional label on slide. sver = '';% '_1'; % additional label on slide.
ver = '_v2';% '_v2'; ver = '';% '_v2';


% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30 % MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
% MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30 % MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
Expand Down Expand Up @@ -113,7 +113,7 @@
if mRNAchn == 1; if mRNAchn == 1;
min_int = 0.05; % .05 just for speed min_int = 0.05; % .05 just for speed
else else
min_int = 0.05; % min_int = 0.01; %
end end


DotLabels= cell(1,Zs); DotLabels= cell(1,Zs);
Expand Down
44 changes: 29 additions & 15 deletions Unsupervised_DotFinding3.m
Expand Up @@ -8,28 +8,30 @@


tot_time = tic; tot_time = tic;
% Input options % Input options
old_lab = 0; old_lab = 0; Es = 0;
folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/'; folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/2011-05-22/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/';
rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% % rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %% %


stackfolder = 's03_MP02/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; % stackfolder = 's08_EsplN_vndN/';% 's03_MP02/';% 's10_bcd1x/';% 's11_bcd6x/'; %'s14_comp_cntrl/'; % 's12_cntrl_2label/'; %'MP02_22C/'; %'MP01_22C/'; % 'MGa1x/'; % 'MP10_22C/'; %'MP05_22C/'; %'YW_ths_sog/'; % 'MP10_22C/'; % % 'MP09_22C/'; % 'MGa2x/'; % 'MGa1x/'; % 'MGa2x/'; % 'MP10_22C_sna_y_c/'; %
fname = 's03_MP02_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; % fname = 's08_EsplN_vndN'; % 's03_MP02_Hz_22C'; % 's10_bcd1x';% 's11_bcd6x'; % 's14_comp_cntrl'; Es =1; % 's12_cntrl_2label'; Es = 1; % 'MP09_22C_hb_y_f'; Es = 7; % 'MP02_22C_hb_y'; Es = 9; % 'MP02_22C_hb_y_b'; Es = 10; % % 'MP01_22C_hb_y_f'; Es = 12; % 'MP01_22C_hb_y_c'; Es = 10; % 'MP01_22C_hb_y'; Es = 13; % 'MGa1x_LacZ_b'; Es = 12; % 'MP10_22C_sna_y_e'; Es = 12; % 'MP05_22C_sna_y_c'; Es =7; % 'MP10_22C_sna_y_d3'; Es = 1; %'YW_ths_sog'; Es = 12; % % 'MP09_22C_hb_y_e'; Es = 10; % 'MP09_22C_hb_y_d'; Es=11; % 'MGa2x_LacZ_sna_b'; Es = 10; % 'MP10_22C_sna_y_d'; % 'MGa_LacZ'; %'MGa2x_LacZ_sna'; %'MP10_22C_sna_y_c'; old_lab = 1; % 'MP05_22C_sna_y'; old_lab = 1; %
mRNA_channels = 2; % 3; % 1; % total mRNA channels mRNA_channels = 2; % 3; % 1; % total mRNA channels



sname = 's08_EsplN_vndN_01'; Es=4; Zs = 50; % fname;
ver = '';% '_v2'; ver = '';% '_v2';


% MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30 % MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
% MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30 % MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30




filename = [rawfolder,'/',fname]; filename = [rawfolder,'/',fname];
load([filename,ver,'.mat']) load([rawfolder,'/',sname,'.mat'])
Zs = Datas.LSM_info.DimensionZ;
w = Datas.Stack1.Image1.IMG.width; w = Datas.Stack1.Image1.IMG.width;
h = Datas.Stack1.Image1.IMG.height; h = Datas.Stack1.Image1.IMG.height;
Es = length(fields(Datas)) - 3; % Number of Stacks if Es==0

Zs = Datas.LSM_info.DimensionZ;
Es = length(fields(Datas)) - 3; % Number of Stacks
end
% ------- Option: Focus on subset of image: ------------------- % % ------- Option: Focus on subset of image: ------------------- %
% m = 1/2048; % .9;% .7; % .5; .7; % 1/2048; % % m = 1/2048; % .9;% .7; % .5; .7; % 1/2048; %
% xp1= floor(h/2*m)+1; xp2 = floor(h/2*(2-m))+1; yp1 = floor(w/2*m)+1; yp2 = floor(w/2*(2-m))+1; % xp1= floor(h/2*m)+1; xp2 = floor(h/2*(2-m))+1; yp1 = floor(w/2*m)+1; yp2 = floor(w/2*(2-m))+1;
Expand Down Expand Up @@ -63,7 +65,7 @@


% sphere finding parameters % sphere finding parameters
getpreciseZ = 0; getpreciseZ = 0;
consec_layers = 2; consec_layers = 3;
ovlap = 4; ovlap = 4;
%---------------------------------% %---------------------------------%


Expand All @@ -74,7 +76,7 @@
Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian


%% %%
for e= 1:Es for e= 3:Es
%% %%
tic tic
disp('loading data...'); disp('loading data...');
Expand Down Expand Up @@ -111,9 +113,9 @@
for mRNAchn = 1:mRNA_channels % mRNAchn =2 for mRNAchn = 1:mRNA_channels % mRNAchn =2


if mRNAchn == 1; if mRNAchn == 1;
min_int = 0.05; % just for speed min_int = 0.05; % just for speed
else else
min_int = 0.02; % min_int = 0.01; %
end end


DotLabels= cell(1,Zs); DotLabels= cell(1,Zs);
Expand All @@ -125,12 +127,24 @@
tic; disp('finding dots...'); tic; disp('finding dots...');
for z = 1:Zs % z = 11 for z = 1:Zs % z = 11
im_folder{z} = [rawfolder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif']; im_folder{z} = [rawfolder,stackfolder,fname,'_',emb,'_z',num2str(z),'.tif'];
try
Iin_z = imreadfast(im_folder{z}); Iin_z = imreadfast(im_folder{z});
[DotLabels{z},DotData{z},Inds{z},Ints{z}] = dotfinder(Iin_z(xp1:xp2,yp1:yp2,mRNAchn),Ex,Ix,min_int,min_size); [DotLabels{z},DotData{z},Inds{z},Ints{z}] = dotfinder(Iin_z(xp1:xp2,yp1:yp2,mRNAchn),Ex,Ix,min_int,min_size);
end catch err
disp(err.message);
Zs = z-1;
break
end
end
toc; toc;



% resize;
DotLabels= DotLabels(1:Zs);
DotData = DotData(1:Zs);
Inds = Inds(1:Zs);
Ints = Ints(1:Zs);


%% %%


intype = class(Iin_z); intype = class(Iin_z);
Expand Down

0 comments on commit 1d43931

Please sign in to comment.