%Generates Bacteria Shape, Light Intensity and Background 
function bacshape(L, W, SigSize, I, SigInt, Bkg, N)

%Where L and W are the length and width of bacteria, I is the intensity and
%Bkg the background color. SigSize, SigInt and SigBkg are percentage
%changes in cell dimensions, intensity and N is the standard deviation of Rician Noise.

%Initialising Parameters

nframes=300;    %Total number of frames
drames=10;      %Frame step for change

shape=zeros(nframes,2);   
    
shape(1,1)=abs(normrnd(L,L*SigSize));
shape(1,2)=abs(normrnd(W,W*SigSize));

inten=zeros(301,1);
back=Bkg*ones(301,1);
noise=randraw('rice',[0,N],301);

%Generating Parameters
if SigSize<1 && SigInt<1 && N<1
    for i=2:301
        for j=1:2
            shape(i,j)=shape(i-1,j)+normrnd(0,2);
            if shape(i,j)<20
                shape(i,j)=shape(i-1,j)+normrnd(0,2);
            end;
            if shape(i,j)>60
                shape(i,j)=shape(i-1,j)-normrnd(0,2);
            end;
        end;
    end;
    inten=normrnd(I,I*SigInt,1,301);
    back=back+noise;
    Validation1(shape, inten, back)
else
    sprintf('%s','ERROR! SigSize, SigInt and N must be a fraction < 1')
end;

