function LEM_show_cells(cells,pt1,pt2)
%

x_min = cells.x_min;
x_max = cells.x_max;
x_spread = x_max - x_min;
y_min = cells.y_min;
y_max = cells.y_max;
y_spread = y_max - y_min;
del_x = cells.del_x;
del_y = cells.del_y;
M = cells.M;
N = cells.N;

subplot(2,1,1);
plot(x_min-del_x,y_min-del_y,'w.');
hold on
plot(x_max+del_x,y_max+del_y,'w.');

% Plot columns
for x = x_min:del_x:x_max
    plot([x,x],[y_min,y_max],'k');
end

% Plot rows
for y = y_min:del_y:y_max
    plot([x_min,x_max],[y,y],'k');
end
axis equal

if isempty(pt1)|isempty(pt2)
    return
end

% plot segment (pt1 to pt2)
im = zeros(M,N);
c1 = ceil(N*(pt1(1)-x_min)/x_spread);
r1 = M - ceil(M*(pt1(2)-y_min)/y_spread) + 1;
c2 = ceil(N*(pt2(1)-x_min)/x_spread);
r2 = M - ceil(M*(pt2(2)-y_min)/y_spread) + 1;

plot(pt1(1),pt1(2),'r*');
plot(pt2(1),pt2(2),'b*');

[rows,cols] = LEM_line_between([r1,c1],[r2,c2]);
for r = 1:length(rows)
    im(rows(r),cols(r)) = 1;
end
subplot(2,1,2);
imshow(im);
tch = 0;
