Permalink
Browse files

minor changes

  • Loading branch information...
AlistairMobile committed Nov 22, 2011
1 parent 7cfa0ce commit 9c1b878596d36d365da28160c53db03661ae5cdd
Showing with 9 additions and 39 deletions.
  1. +9 −39 CheckDotUpDown.m~
View
@@ -1,6 +1,6 @@
%% CheckDotUpDown
% Alistair Boettiger Date Begun: 01/30/11
-% Levine Lab Last Modified: 06/06/11
+% Levine Lab Last Modified: 11/22/11
%% Description
@@ -274,7 +274,7 @@ disp('Building unique-spheres from cross-section disks...');
Linx = cell(NDots,1); Liny = cell(NDots,1); Lind = cell(NDots,1);
for n=1:2:2*NDots
- Linx{(n+1)/2} = [dotC(nonzeros(masked_inds(n,:)),1)',0];
+ Linx{(n+1)/2} = [dotC(nonzeros(masked_inds(n,:)),1)',0]; % trailing zero prevents cellfun error
Liny{(n+1)/2} = [dotC(nonzeros(masked_inds(n,:)),2)',0];
Lind{(n+1)/2} = (n+1)/2; % must be a non-loop way to do this
% % troubleshooting
@@ -283,43 +283,13 @@ for n=1:2:2*NDots
end
%%
- UL = cellfun(@(x,y) [x(1),y],Linx,Lind,'UniformOutput',0);
- UL = cell2mat(UL); has_data = UL(:,1)>0;
- UL = UL(has_data,:);
- unique
-
-
-cellfun('unique',Linx)
-
-for j=1:length(Linx); % j =1
- if isempty(Linx{j})==1;
- continue;
- end
- for k=1:length(Linx) % k =3
- if isempty(Linx{k})==1;
- continue;
- end
- if j~=k
- if (Linx{k}(1) - Linx{j}(1) + Liny{k}(1) - Liny{j}(1))^2 < .01
- % length(intersect(Linx{k}, Linx{j})) > 1 % this is the slow step
- Linx{k} = [];
- % disp('duplicate removed');
- end
- end
- end
-end
-
-% Convert string of dots to x-y-z of center dot.
-
-% The median x,y position is taken as the true center since true 3D Gaussian
-% fitting is too slow.
-% the z position is either determined from the precise center of mass
-% fitting of the trace if get-preciseZ is active, otherwise it is chosen as
-% the middle of the stack (position where dot is first detected + half).
-
-unique_inds = find(~cellfun('isempty',Linx));
-unique_dotX = [Linx(~cellfun('isempty',Linx))];
-unique_dotY = [Liny( ~cellfun('isempty',Linx))];
+ UL = cellfun(@(x,y) [x(1),y],Linx,Lind,'UniformOutput',0); % Add index to
+ UL = cell2mat(UL); % this is infact uniform output, not sure why matlab insists we do it this way
+ UL = UL(UL(:,1)>0,:); % remove all empty values
+ [~,unique_inds] = unique(UL(:,1));
+
+unique_dotX = Linx(unique_inds);
+unique_dotY = Liny(unique_inds);
Ndots = length(unique_dotX);
New_dotC = zeros(Ndots,3);

0 comments on commit 9c1b878

Please sign in to comment.