function [a, c] = genlanes(nsets)
% Generate a gene lane image with nsets lane sets with random sized bands
m = 25*7 + 10;
n = 100*nsets + 10;
for i = 1:5
	for j = 1:n
		a(i,j) = 0.0;
	end
end
for j = 1:5
	for i = 6:m
		a(i,j) = 0.0;
	end
end
for i = m-4:m
	for j = 6:n
		a(i,j) = 0.0;
	end
end
for j = n-4:n
	for i = 6:m
		a(i,j) = 0.0;
	end
end
for n = 1:nsets
	starti = 6 + 3;
	startj = 6 + (nsets-1)*100 + 12;
	for band = 1:25
		lane = 1 + round(rand*(4-1));
		currentj = startj + (lane-1)*25;
		currenti = starti + (band-1)*7;
		height = 5 + round(rand*(50-5));
		width = 3 + round(rand*(7-3));
		breadth = 15 + round(rand*(25-15));
		b = ellipsem(breadth/2, width/2, height/2, 1.0);
		c((n-1)*25 + band,1) = currenti;
		c((n-1)*25 + band,2) = currentj;
		c((n-1)*25 + band,3) = breadth/2;
		c((n-1)*25 + band,4) = width/2;
		c((n-1)*25 + band,5) = height/2;
		[bm bn] = size(b);
		bmmid = ((bm-rem(bm,2))/2) + 1;
		bmmin = bmmid - 3;
		bmmax = bmmid + 3;
		basej = currentj - bmmid - 1;
		for ii = -3:3
			for jj = 1:bn
				a(currenti+ii,basej+jj) = ...
                           max(a(currenti+ii,basej+jj),b(bmmid+ii,jj));
			end
		end
	end
end
