%Generates Bacteria Shape and Color Intensity function [bactshape,bactinten]=shape(nframes,dframe,L, W, SigSize, I, SigInt) %Where L and W are the length and width of bacteria and I is the intensity. %SigSize and SigInt are standard deviation in cell dimensions and intensity. %nframes is the total number of frames and dframe is the frame step for which %cell transition takse place. Total number of frames must be a multiple of frame step %Determines Size of Array i=1:dframe:nframes; ShpSize=max(i)+dframe; %Initialising Parameters bactshape=zeros(ShpSize,3); bactinten=zeros(ShpSize,1); %Generate step characteristics for n=1:dframe:ShpSize bactshape(n,1)=abs(normrnd(L,SigSize)); bactshape(n,2)=abs(normrnd(W,SigSize)); bactshape(n,3)=randraw('vonmises',[0,5]); bactinten(n,1)=abs(normrnd(I,SigInt)); if bactinten(n)>64 bactinten(n)=I; end; bactinten(n,2)=1.2*bactinten(n,1); end; %Generating Bacteria Size and Color Intensity for n=1:dframe:nframes for i=(n+1):(n+dframe-1) bactshape(i,:)=bactshape(i-1,:)+(bactshape(n+dframe,:)-bactshape(n,:))/dframe; bactinten(i,:)=bactinten(i-1,:)+(bactinten(n+dframe,:)-bactinten(n,:))/dframe; end; end; %Returns Bacinten in the form of ColorSpec bactinten=bactinten/64;