function [ColorLatticeImage,Gsum,Rsum] = Fluorescence(Lattice) % ===================================== % David Liao % 2008 February 14 % Simulated two-strain fluorescence % ===================================== % % [ColorLatticeImage,Gsum,Rsum] = Fluorescence(Lattice) L = size(Lattice); % Identify cooperators and defectors C = max(Lattice,0); D = max(-Lattice,0); % Collapse data on z axis G = sum(C,3); R = sum(D,3); Gsum = sum(sum(G)); Rsum = sum(sum(R)); % Build a color image ColorLatticeImage = zeros(L(1),L(2),3); ColorLatticeImage(:,:,1) = R; ColorLatticeImage(:,:,2) = G; % Normalize ColorLatticeImage = ColorLatticeImage/L(3); % figure; % image(ColorLatticeImage);