function show_n_brains(n)
% Imported from Kate

home_dir = cd;

image_dir = 'E:\Brain\images';
points_dir = 'E:\Brain\points';
pos = [ 23   138   568   644];

% Get the list of image files
cd(image_dir);
rawlist = dir('*.pnm');
index = randperm(length(rawlist));
rawlist = rawlist(index);
for i=1:n
	imagefile = rawlist(i).name;
	[dummy1,head,dummy2,dummy3] = fileparts(imagefile);
 	pointsfile = [points_dir,'\',head,'.pts'];
	if(~isempty(dir(pointsfile)))
		[im, map] = pnmread(imagefile);
		[x,y] = read_brain_points(pointsfile);
		imfig = figure;, imshow(im);, hold on, plot(x(1:3:length(x)),y(1:3:length(x)),'go','MarkerSize',3), xlabel(['No of points: ',num2str(length(x(:)))]);
		set(imfig,'Name',imagefile,'Position',pos);
		% Write bmp and copy points files for ASM
		imfile = ['H:\nrr\brain\images\',head,'.png'];
		pfile = ['H:\nrr\brain\points\',head,'.pts'];
        imfile
		imwrite(im,imfile,'png');
		copyfile(pointsfile,pfile);
	end
end

cd(home_dir);
