function [a, c] = ggenlanes(minb,maxb,minw,maxw,minh,maxh,nsets)
% [a, c] = ggenlanes(minb,maxb,minw,maxw,minh,maxh,nsets)
% Generate a gene lane image with nsets lane sets with same 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)*maxb;
		currenti = starti + (band-1)*maxw;
		height = minh + round(rand*(maxh-minh));
		width = minw + round(rand*(maxw-minw));
		breadth = minb + round(rand*(maxb-minb));
		b = ellipsem(breadth/2, width/2, height/2, 1.0);
		c((n-1)*maxb + band,1) = currenti;
		c((n-1)*maxb + band,2) = currentj;
		c((n-1)*maxb + band,3) = breadth/2;
		c((n-1)*maxb + band,4) = width/2;
		c((n-1)*maxb + band,5) = height/2;
		[bm bn] = size(b);
		wmid = ((maxw-rem(maxw,2))/2) + 1;
		bmmid = ((bm-rem(bm,2))/2) + 1;
		bmmin = bmmid - wmid;
		bmmax = bmmid + wmid;
		basej = currentj - bmmid;

		for ii = -wmid:wmid
			for jj = 1:bn
				a(currenti+ii,basej+jj) = ...
                          max(a(currenti+ii,basej+jj),b(bmmid+ii,jj));
			end
		end
	end
end
