Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 7 files changed
  • 0 comments
  • 1 contributor
Jun 07, 2011
fixed bug in uint8-data read which affects large images. Some uint16s…
… are used for compression not as an image data format.
e7eaaa0
Faster implimentation of finding indices for dots in other z-planes o…
…verlapping the plane in question.
2493c8a
new faster imread for single layer tifs only 3bc70ce
30  CheckDotUpDown.m
@@ -47,7 +47,7 @@
47 47
 
48 48
 
49 49
 NDots = length(dotC); % total number of dots;
50  
-maxdots = eval([intype,'(max(dotsinlayer) +100)']);
  50
+maxdots = cast(max(dotsinlayer) +100, 'uint16');
51 51
 disp(['Max dots per layer = ',num2str(maxdots)]); 
52 52
 disp(['Total dots = ',num2str(NDots)]); 
53 53
 
@@ -94,40 +94,20 @@
94 94
 % pre-calc
95 95
 Rs = cell(Zs,1);
96 96
 for z=1:Zs
97  
-         Rz = zeros(hs,ws,intype);   
  97
+         Rz = zeros(hs,ws,'uint16'); % this is uint16 just for data size maintance.    
98 98
          Rz(Inds{z}) = DotLabels{z}; % convert indices to raster map 
99 99
          Rs{z} = imdilate(Rz,strel('disk',ovlap));
100 100
 end
101 101
 
102 102
 
103  
-
104 103
 for Z = 1:Zs % The primary layer Z = 16
105  
-         inds1 = Inds{Z};
106  
-         R1 = zeros(hs,ws,intype);   
107  
-         R1(inds1) = maxdots; % convert indices to raster map   
108  
-        % figure(3); clf; imagesc(R1);  colorbar; colormap jet;
109  
-        
  104
+         inds1 = Inds{Z};      
110 105
          st1_dot_num = sum(dotsinlayer(1:Z-1)); % starting dot number for the layer under study     
111  
-      
112  
-        % figure(3); clf; imagesc(Iw);
113  
-         
  106
+               
114 107
     for z=1:Zs % compare primary layer to all other layers  z = Z+1 
115  
-        clear Loz;
116  
-         Loz = R1 + Rs{z}; 
117  
-         % figure(3); clf; imagesc(Rs{z});  colorbar; colormap jet;
118  
-         
119  
-%           figure(3); clf; imagesc(Loz);  colorbar; colormap jet;
120  
-%          hold on; plot(DotData{Z}(:,1),DotData{Z}(:,2),'w.');
121  
-%          hold on; plot(DotData{z}(:,1),DotData{z}(:,2),'c.');
122  
-        
123  
-        % figure(3); clf; imagesc(DotMasks{z}); 
124  
-         Loz(Loz<maxdots+1) = 0; % remove non-overlapping dots;
125  
-         Loz = Loz - maxdots; % LoZ is already positive, so we don't need to worry about negative values.  
126  
-        %  figure(2); clf;  imagesc(Loz); colorbar; colormap jet;
127  
-
128 108
       % Need to get linear index to stick correctly in array of all dots.  
129 109
          stz_dot_num = sum(dotsinlayer(1:z-1));  % starting dot number for the comparison layer     
130  
-         inds_zin1 = Loz(inds1); % dot-indicies of layer Z overlapping layer z.       
  110
+         inds_zin1 = Rs{z}(inds1);% dot-indicies of layer Z overlapping layer z.       
131 111
          indsT = single(inds_zin1) + stz_dot_num; % convert layer specific dot-indices to total overall dot-indices 
132 112
          indsT(indsT == stz_dot_num) = 0; % makes sure missing indices are still 'missing' and not last of previous layer.   
133 113
          
33  CheckDotUpDown.m~
@@ -47,7 +47,7 @@ clear DotData;
47 47
 
48 48
 
49 49
 NDots = length(dotC); % total number of dots;
50  
-maxdots = eval([intype,'(max(dotsinlayer) +100)']);
  50
+maxdots = cast(max(dotsinlayer) +100, 'uint16');
51 51
 disp(['Max dots per layer = ',num2str(maxdots)]); 
52 52
 disp(['Total dots = ',num2str(NDots)]); 
53 53
 
@@ -94,7 +94,7 @@ LayerJoin = false(2*NDots,Zs);
94 94
 % pre-calc
95 95
 Rs = cell(Zs,1);
96 96
 for z=1:Zs
97  
-         Rz = zeros(hs,ws,intype);   
  97
+         Rz = zeros(hs,ws,'uint16'); % this is uint16 just for data size maintance.    
98 98
          Rz(Inds{z}) = DotLabels{z}; % convert indices to raster map 
99 99
          Rs{z} = imdilate(Rz,strel('disk',ovlap));
100 100
 end
@@ -103,8 +103,8 @@ end
103 103
 
104 104
 for Z = 1:Zs % The primary layer Z = 16
105 105
          inds1 = Inds{Z};
106  
-         R1 = zeros(hs,ws,intype);   
107  
-         R1(inds1) = maxdots; % convert indices to raster map   
  106
+         R1 = zeros(hs,ws,'uint16');   
  107
+        %  R1(inds1) = maxdots; % convert indices to raster map   
108 108
         % figure(3); clf; imagesc(R1);  colorbar; colormap jet;
109 109
         
110 110
          st1_dot_num = sum(dotsinlayer(1:Z-1)); % starting dot number for the layer under study     
@@ -112,8 +112,9 @@ for Z = 1:Zs % The primary layer Z = 16
112 112
         % figure(3); clf; imagesc(Iw);
113 113
          
114 114
     for z=1:Zs % compare primary layer to all other layers  z = Z+1 
115  
-        clear Loz;
116  
-         Loz = R1 + Rs{z}; 
  115
+%          Loz = R1;
  116
+%          Loz(inds1) = Rs{z}(inds1); 
  117
+         % Loz = R1 + Rs{z}(inds); 
117 118
          % figure(3); clf; imagesc(Rs{z});  colorbar; colormap jet;
118 119
          
119 120
 %           figure(3); clf; imagesc(Loz);  colorbar; colormap jet;
@@ -121,13 +122,13 @@ for Z = 1:Zs % The primary layer Z = 16
121 122
 %          hold on; plot(DotData{z}(:,1),DotData{z}(:,2),'c.');
122 123
         
123 124
         % figure(3); clf; imagesc(DotMasks{z}); 
124  
-         Loz(Loz<maxdots+1) = 0; % remove non-overlapping dots;
125  
-         Loz = Loz - maxdots; % LoZ is already positive, so we don't need to worry about negative values.  
  125
+       %  Loz(Loz<maxdots+1) = 0; % remove non-overlapping dots;
  126
+        % Loz = Loz - maxdots; % LoZ is already positive, so we don't need to worry about negative values.  
126 127
         %  figure(2); clf;  imagesc(Loz); colorbar; colormap jet;
127 128
 
128 129
       % Need to get linear index to stick correctly in array of all dots.  
129 130
          stz_dot_num = sum(dotsinlayer(1:z-1));  % starting dot number for the comparison layer     
130  
-         inds_zin1 = Loz(inds1); % dot-indicies of layer Z overlapping layer z.       
  131
+         inds_zin1 = Rs{z}(inds1);% dot-indicies of layer Z overlapping layer z.       
131 132
          indsT = single(inds_zin1) + stz_dot_num; % convert layer specific dot-indices to total overall dot-indices 
132 133
          indsT(indsT == stz_dot_num) = 0; % makes sure missing indices are still 'missing' and not last of previous layer.   
133 134
          
@@ -332,9 +333,10 @@ for i = 1:2:2*NDots-1 % i =5
332 333
         if stacked_dots == 0  && getpreciseZ == 1
333 334
              ii = find(cent(:,2)==i,1);
334 335
              dotC((i+1)/2,3) = cent(ii(1),1);
335  
-             ii = (cent(ii(1),2)+1)/2;
336  
-             dotC(masked_inds(i,j(1)),1) = dotC(ii,1); 
337  
-             dotC(counted,2) = dotC(ii,2); 
  336
+             i_self = masked_inds(i,j(1));
  337
+             i_max = (cent(ii(1),2)+1)/2;
  338
+             dotC(i_self,1) = dotC(i_max,1); 
  339
+             dotC(i_self,2) = dotC(i_max,2); 
338 340
         end
339 341
     else
340 342
         remove_dot((i+1)/2) = 1;
@@ -352,9 +354,10 @@ for i = 1:2:2*NDots-1 % i =5
352 354
               ii = find(cent(:,2)==i);
353 355
               ii = ii( min(bi,length(ii)) );
354 356
               dotC((i+1)/2,3) = cent(ii,1);
355  
-              ii = (cent(ii,2)+1)/2;
356  
-              dotC(counted,1) = dotC(ii,1); 
357  
-              dotC(counted,2) = dotC(ii,2);               
  357
+              i_self = masked_inds(i,j(1));
  358
+              i_max = (cent(ii,2)+1)/2;
  359
+              dotC(i_self,1) = dotC(i_max,1); 
  360
+              dotC(i_self,2) = dotC(i_max,2);         
358 361
           end
359 362
     stacked_dots =0;      
360 363
     end
93  Unsupervised_DotFinding.m
... ...
@@ -1,7 +1,7 @@
1 1
 %%                      Unsupervised_DotFinding.m
2 2
 %
3 3
 % Alistair Boettiger                                   Date Begun: 03/10/11
4  
-% Levine Lab                                        Last Modified: 04/18/11
  4
+% Levine Lab                                        Last Modified: 06/07/11
5 5
 %
6 6
 
7 7
 clear all;
@@ -12,9 +12,9 @@
12 12
 folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/'; 
13 13
 rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %%   %
14 14
 
15  
-stackfolder = '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/'; %
16  
-fname ='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; % 
17  
-mRNA_channels =  3; %2; % 1; % total mRNA channels
  15
+stackfolder = '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/'; %
  16
+fname ='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; % 
  17
+mRNA_channels = 1; %  3; %  1; % total mRNA channels
18 18
 
19 19
 
20 20
 ver = '';% '_v2';
@@ -22,34 +22,26 @@
22 22
 % MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
23 23
 % MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
24 24
 
25  
-% Focus on subset of image: 
26  
-     m = 1/2048;  % .9;%    .7; % .5; .7; %   1/2048; % 
27  
-    Zs = 50; % Upper limit on number of Z sections   length(Im);
28  
-    h = 2048; w=2048;
29  
-    
30  
-%    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;
31  
-%    hs = yp2-yp1+1;     ws = xp2-xp1+1;
32 25
 
33  
-hs = 200; ws = 200; 
34  
-xp1 = 1801; yp1 = 1301; xp2 = xp1 + ws -1; yp2 = yp1 + hs - 1; 
  26
+filename = [rawfolder,'/',fname];     
  27
+load([filename,ver,'.mat'])  
  28
+Zs = Datas.LSM_info.DimensionZ; 
  29
+w = Datas.Stack1.Image1.IMG.width;
  30
+h = Datas.Stack1.Image1.IMG.height; 
  31
+Es = length(fields(Datas)) - 3;   % Number of Stacks
35 32
 
36  
-emb = '01';
37  
-Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
38  
-Imax_dots = Imax(xp1:xp2,yp1:yp2,1:3);  
39  
-figure(2); clf;  imagesc(Imax_dots);
40  
-    
41  
-    
  33
+% ------- Option: Focus on subset of image: ------------------- %
  34
+%      m = 1/2048;  % .9;%    .7; % .5; .7; %   1/2048; % 
  35
+%    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;
  36
+%    hs = yp2-yp1+1;     ws = xp2-xp1+1;
42 37
 
43  
-    disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
44  
-    
45  
-    
  38
+ws = 2044; hs = 2048; xp1 = 1; yp1 = 1;
  39
+xp2 = xp1 + ws -1; yp2 = yp1 + hs - 1; 
  40
+disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
  41
+% ------------------------------------------------------------- %     
46 42
     
47 43
 
48  
-   getpreciseZ = 0;
49  
-   consec_layers = 2;
50  
-   ovlap = 3; 
51  
-
52  
-
  44
+% -------------- Graphing and Display Options ------------------ %
53 45
    show_projected = 1; % show max-project with all dots and linked dots.  
54 46
    plotZdata = 0 ;% show z-map of data
55 47
    showhist = 1; % show histogram of mRNA counts per cell. 
@@ -57,22 +49,29 @@
57 49
    bins = 40; % bins for histograms of mRNA
58 50
    t = 0; %.45; % threshold for region definition plotting
59 51
    spread = 1.3; % over/under
  52
+% ------------------------------------------------------------- % 
  53
+
60 54
 
61 55
 %---- Dot Finding Parameters ----- %
  56
+   % dotfinder's parameters 
62 57
     sigmaE = 3;%  IMPORTANT
63 58
     sigmaI = 4; % IMPORTANT
64 59
   %  min_int  = 0.04;    %  5    ;% .05 % not necessary Fix at Zero
65 60
     FiltSize = 30;% 
66 61
     min_size = 30;% 
67 62
    
  63
+  % sphere finding parameters
  64
+   getpreciseZ = 0;
  65
+   consec_layers = 2;
  66
+   ovlap = 4; 
  67
+%---------------------------------%
  68
+
  69
+
  70
+
68 71
     % Build the Gaussian Filter   
69 72
     Ex = fspecial('gaussian',FiltSize,sigmaE); % excitatory gaussian
70 73
     Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian
71  
-    Filt = Ex -Ix;
72  
-%---------------------------------%
73 74
 
74  
-
75  
-%Data = cell(10,mRNA_channels); 
76 75
 %%
77 76
 for e= 1:Es
78 77
 %%
@@ -104,17 +103,9 @@
104 103
              continue
105 104
         end
106 105
     end
107  
-       
108  
-%     filename = [rawfolder,'/',fname];
109  
-%     Im = lsm_read_mod([filename,'.mat'],str2double(emb),1.5E4);    
110  
-    
111  
-
112  
-
113  
-
114 106
    
115 107
     toc
116 108
     
117  
-    % thresh = .1; 
118 109
     
119 110
     for mRNAchn = 1:mRNA_channels % mRNAchn =2
120 111
         
@@ -174,7 +165,7 @@
174 165
         end
175 166
         %%
176 167
         
177  
-    clear Imax Cents DotData DotMasks Iin_z 
  168
+    clear Imax Cents DotData DotLabels Inds Ints Iin_z 
178 169
         
179 170
         %%
180 171
         
@@ -270,18 +261,18 @@
270 261
      clear imdata M C W  mRNA_map Fig_regvar histfig Iout  
271 262
         %
272 263
      %% Export data
273  
-%      Data{e,mRNAchn}.nucarea = nuc_area;
274  
-%      Data{e,mRNAchn}.dotC = dotC;
275  
-%      Data{e,mRNAchn}.mRNAcnt = mRNA_cnt;
276  
-%      Data{e,mRNAchn}.Plot_mRNA = Plot_mRNA;
277  
-%      Data{e,mRNAchn}.mRNAsadj = mRNA_sadj;
278  
-%     % Data{e,mRNAchn}.DotData = DotData; % break the camel; 
279  
-%     % Data{e,mRNAchn}.DotMasks = DotMasks;
280  
-%     % Data{e,mRNAchn}.imdata = imdata;
281  
-%      % Data{e,mRNAchn}.mRNAden = mRNA_den;
  264
+
  265
+Rpars.sigmaE = sigmaE;
  266
+Rpars.sigmaI = sigmaI;
  267
+Rpars.min_int = min_int;
  268
+Rpars.FiltSize = FiltSize;
  269
+Rpars.min_size = min_size;
  270
+Rpars.getpreciseZ = getpreciseZ;
  271
+Rpars.consec_layers = consec_layers;
  272
+Rpars.ovlap = ovlap; 
282 273
      
283  
-       save([folder,fname,'_',emb,'_',num2str(mRNAchn),'_data',ver],...
284  
-           'nuc_area','dotC','mRNA_cnt','Plot_mRNA','mRNA_sadj'); 
  274
+       save([folder,fname,'_',emb,'_chn',num2str(mRNAchn),'_data',ver],...
  275
+           'nuc_area','dotC','mRNA_cnt','Plot_mRNA','mRNA_sadj','Rpars'); 
285 276
      
286 277
      clear nuc_area dotC mRNA_cnt mRNA_sadj Plot_mRNA 
287 278
     
77  Unsupervised_DotFinding.m~
... ...
@@ -1,7 +1,7 @@
1 1
 %%                      Unsupervised_DotFinding.m
2 2
 %
3 3
 % Alistair Boettiger                                   Date Begun: 03/10/11
4  
-% Levine Lab                                        Last Modified: 04/18/11
  4
+% Levine Lab                                        Last Modified: 06/07/11
5 5
 %
6 6
 
7 7
 clear all;
@@ -12,9 +12,9 @@ old_lab = 0;
12 12
 folder = '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/mRNA_counting/Data/'; % '/Users/alistair/Documents/Berkeley/Levine_Lab/Projects/Enhancer_Modeling/Data/'; 
13 13
 rawfolder = '/Volumes/Data/Lab Data/Raw_Data/2011-05-22/'; % '/Volumes/Data/Lab Data/Raw_Data/02-17-11/'; %%   %
14 14
 
15  
-stackfolder = '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/'; %
16  
-fname ='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; % 
17  
-mRNA_channels =  3; %2; % 1; % total mRNA channels
  15
+stackfolder = '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/'; %
  16
+fname ='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; % 
  17
+mRNA_channels = 1; %  3; %  1; % total mRNA channels
18 18
 
19 19
 
20 20
 ver = '';% '_v2';
@@ -22,34 +22,26 @@ ver = '';% '_v2';
22 22
 % MP10_22C_sna_y_c and MP05_22C all done at 3.5, 4, 0.03, 30, 30
23 23
 % MGa2x and MGa1x all done at 2.5, 3, 0.03, 30, 30
24 24
 
25  
-% Focus on subset of image: 
26  
-     m = 1/2048;  % .9;%    .7; % .5; .7; %   1/2048; % 
27  
-    Zs = 50; % Upper limit on number of Z sections   length(Im);
28  
-    h = 2048; w=2048;
29  
-    
30  
-%    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;
31  
-%    hs = yp2-yp1+1;     ws = xp2-xp1+1;
32 25
 
33  
-hs = 200; ws = 200; 
34  
-xp1 = 1801; yp1 = 1301; xp2 = xp1 + ws -1; yp2 = yp1 + hs - 1; 
  26
+filename = [rawfolder,'/',fname];     
  27
+load([filename,ver,'.mat'])  
  28
+Zs = Datas.LSM_info.DimensionZ; 
  29
+w = Datas.Stack1.Image1.IMG.width;
  30
+h = Datas.Stack1.Image1.IMG.height; 
  31
+Es = length(fields(Datas)) - 3;   % Number of Stacks
35 32
 
36  
-emb = '01';
37  
-Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
38  
-Imax_dots = Imax(xp1:xp2,yp1:yp2,1:3);  
39  
-figure(2); clf;  imagesc(Imax_dots);
40  
-    
41  
-    
  33
+% ------- Option: Focus on subset of image: ------------------- %
  34
+%      m = 1/2048;  % .9;%    .7; % .5; .7; %   1/2048; % 
  35
+%    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;
  36
+%    hs = yp2-yp1+1;     ws = xp2-xp1+1;
42 37
 
43  
-    disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
44  
-    
45  
-    
  38
+xp1 = 1; yp1 = 1;
  39
+xp2 = xp1 + ws -1; yp2 = yp1 + hs - 1; 
  40
+disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
  41
+% ------------------------------------------------------------- %     
46 42
     
47 43
 
48  
-   getpreciseZ = 0;
49  
-   consec_layers = 2;
50  
-   ovlap = 3; 
51  
-
52  
-
  44
+% -------------- Graphing and Display Options ------------------ %
53 45
    show_projected = 1; % show max-project with all dots and linked dots.  
54 46
    plotZdata = 0 ;% show z-map of data
55 47
    showhist = 1; % show histogram of mRNA counts per cell. 
@@ -57,22 +49,30 @@ figure(2); clf;  imagesc(Imax_dots);
57 49
    bins = 40; % bins for histograms of mRNA
58 50
    t = 0; %.45; % threshold for region definition plotting
59 51
    spread = 1.3; % over/under
  52
+% ------------------------------------------------------------- % 
  53
+
60 54
 
61 55
 %---- Dot Finding Parameters ----- %
  56
+   % dotfinder's parameters 
62 57
     sigmaE = 3;%  IMPORTANT
63 58
     sigmaI = 4; % IMPORTANT
64 59
   %  min_int  = 0.04;    %  5    ;% .05 % not necessary Fix at Zero
65 60
     FiltSize = 30;% 
66 61
     min_size = 30;% 
67 62
    
  63
+  % sphere finding parameters
  64
+   getpreciseZ = 0;
  65
+   consec_layers = 2;
  66
+   ovlap = 4; 
  67
+%---------------------------------%
  68
+
  69
+
  70
+Rparameters
  71
+
68 72
     % Build the Gaussian Filter   
69 73
     Ex = fspecial('gaussian',FiltSize,sigmaE); % excitatory gaussian
70 74
     Ix = fspecial('gaussian',FiltSize,sigmaI); % inhibitory gaussian
71  
-    Filt = Ex -Ix;
72  
-%---------------------------------%
73 75
 
74  
-
75  
-%Data = cell(10,mRNA_channels); 
76 76
 %%
77 77
 for e= 1:Es
78 78
 %%
@@ -104,17 +104,9 @@ for e= 1:Es
104 104
              continue
105 105
         end
106 106
     end
107  
-       
108  
-%     filename = [rawfolder,'/',fname];
109  
-%     Im = lsm_read_mod([filename,'.mat'],str2double(emb),1.5E4);    
110  
-    
111  
-
112  
-
113  
-
114 107
    
115 108
     toc
116 109
     
117  
-    % thresh = .1; 
118 110
     
119 111
     for mRNAchn = 1:mRNA_channels % mRNAchn =2
120 112
         
@@ -124,8 +116,10 @@ for e= 1:Es
124 116
                min_int  = 0.05; % 
125 117
          end
126 118
         
  119
+            DotLabels= cell(1,Zs); 
127 120
             DotData = cell(1,Zs);    
128  
-            DotMasks = cell(1,Zs); 
  121
+            Inds = cell(1,Zs); 
  122
+            Ints = cell(1,Zs); 
129 123
             im_folder = cell(1,Zs);
130 124
             tic; disp('finding dots...'); 
131 125
             for z = 1:Zs % z = 11 
@@ -149,8 +143,7 @@ for e= 1:Es
149 143
         %%
150 144
 
151 145
         intype = class(Iin_z);
152  
-         dotC = CheckDotUpDown(DotData,DotMasks,im_folder,mRNAchn,plotZdata,getpreciseZ,consec_layers,ovlap,xp1,xp2,yp1,yp2,intype);
153  
-         
  146
+         dotC =  CheckDotUpDown(DotLabels,DotData,Inds,Ints,plotdata,getpreciseZ,consec_layers,ovlap,xp1,xp2,yp1,yp2,intype);
154 147
 
155 148
         % Project all layers
156 149
          
18  imreadfast.m
... ...
@@ -0,0 +1,18 @@
  1
+
  2
+
  3
+%% imreadfast.m
  4
+%
  5
+%  Alistair Boettiger                                  Date Begun: 06/06/11
  6
+% Levine Lab                                        Last Modified: 06/07/11
  7
+%
  8
+% Fast reading for single-frame tifs
  9
+
  10
+
  11
+
  12
+function I = imreadfast(filename)
  13
+
  14
+tf = imformats('tif');
  15
+I = feval(tf.read, filename, 1);
  16
+ 
  17
+end
  18
+
20  optimizing_dotfinding.m
@@ -19,9 +19,6 @@
19 19
 
20 20
 
21 21
 
22  
-    
23  
-
24  
-
25 22
 tic; 
26 23
 disp('loading data...');
27 24
 
@@ -92,6 +89,7 @@
92 89
     Imax_dots = Imax(xp1:xp2,yp1:yp2,1:3);  
93 90
     figure(1); clf; imagesc(Imax(:,:,1:3));
94 91
     figure(2); clf; imagesc(Imax_dots);
  92
+   
95 93
     
96 94
 disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
97 95
 
@@ -228,9 +226,8 @@
228 226
         D2 = cell2mat(DotData2');
229 227
         
230 228
 
231  
-        if show_projected == 1
232  
-            Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
233  
-            Imax_dots = 3*Imax(xp1:xp2,yp1:yp2,1:3);  
  229
+               Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
  230
+            Imax_dots = 1.5*Imax(xp1:xp2,yp1:yp2,1:3);  
234 231
             Imax_dots(:,:,3) = .1*Imax_dots(:,:,3);
235 232
             figure(2);  clf;  imagesc(Imax_dots);
236 233
             colordef black; set(gcf,'color','k'); 
@@ -258,8 +255,7 @@
258 255
            imagesc(Imax_g); hold on;
259 256
             plot(  NewDotC2(:,1),NewDotC2(:,2),'go','MarkerSize',5 ); 
260 257
            
261  
-        end
262  
-        
  258
+
263 259
 %         figure(2); 
264 260
 %         for z=1:Zs
265 261
 %             text(DotData2{z}(:,1),DotData2{z}(:,2),[num2str(z)],'color','w','FontSize',8);
@@ -268,6 +264,14 @@
268 264
 %         
269 265
         
270 266
         
  267
+ 
  268
+           figure(2); clf; set(gcf,'color','k');
  269
+           Imax_r = Imax_dots; Imax_r(:,:,2) = 0*Imax_r(:,:,2);
  270
+           imagesc(Imax_r); 
  271
+           
  272
+            Imax_g = Imax_dots; Imax_g(:,:,1) = 0*Imax_g(:,:,1);
  273
+           imagesc(Imax_g); hold on;
  274
+
271 275
            minS = 8;
272 276
            
273 277
             d2 = 10*zeros(1,length(NewDotC2));
21  optimizing_dotfinding.m~
@@ -92,6 +92,7 @@ xp2 = xp1+200;
92 92
     Imax_dots = Imax(xp1:xp2,yp1:yp2,1:3);  
93 93
     figure(1); clf; imagesc(Imax(:,:,1:3));
94 94
     figure(2); clf; imagesc(Imax_dots);
  95
+   
95 96
     
96 97
 disp(['Coordinates:  ', num2str(xp1), ' : ', num2str(xp2), ',   ' num2str(yp1), ' : ', num2str(yp2) ] );
97 98
 
@@ -228,9 +229,8 @@ ck_dots = tic;
228 229
         D2 = cell2mat(DotData2');
229 230
         
230 231
 
231  
-        if show_projected == 1
232  
-            Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
233  
-            Imax_dots = 3*Imax(xp1:xp2,yp1:yp2,1:3);  
  232
+               Imax = imread([rawfolder,stackfolder,'max_',fname,'_',emb,'.tif']); 
  233
+            Imax_dots = 1.5*Imax(xp1:xp2,yp1:yp2,1:3);  
234 234
             Imax_dots(:,:,3) = .1*Imax_dots(:,:,3);
235 235
             figure(2);  clf;  imagesc(Imax_dots);
236 236
             colordef black; set(gcf,'color','k'); 
@@ -258,8 +258,7 @@ ck_dots = tic;
258 258
            imagesc(Imax_g); hold on;
259 259
             plot(  NewDotC2(:,1),NewDotC2(:,2),'go','MarkerSize',5 ); 
260 260
            
261  
-        end
262  
-        
  261
+
263 262
 %         figure(2); 
264 263
 %         for z=1:Zs
265 264
 %             text(DotData2{z}(:,1),DotData2{z}(:,2),[num2str(z)],'color','w','FontSize',8);
@@ -267,10 +266,16 @@ ck_dots = tic;
267 266
 %         end
268 267
 %         
269 268
         
270  
-                
271  
-           % plot(  NewDotC2(:,1),NewDotC2(:,2),'co','MarkerSize',14 ); 
272 269
         
273  
-           minS = 10;
  270
+ 
  271
+           figure(2); clf; set(gcf,'color','k');
  272
+           Imax_r = Imax_dots; Imax_r(:,:,2) = 0*Imax_r(:,:,2);
  273
+           imagesc(Imax_r); 
  274
+           
  275
+            Imax_g = Imax_dots; Imax_g(:,:,1) = 0*Imax_g(:,:,1);
  276
+           imagesc(Imax_g); hold on;
  277
+
  278
+           minS = 8;
274 279
            
275 280
             d2 = 10*zeros(1,length(NewDotC2));
276 281
             jn = zeros(1,length(NewDotC2));

No commit comments for this range

Something went wrong with that request. Please try again.