0001 function show_n_brains(n)
0002
0003 home_dir = cd;
0004
0005 image_dir = 'E:\Brain\images';
0006 points_dir = 'E:\Brain\points';
0007 pos = [ 23 138 568 644];
0008
0009
0010 cd(image_dir);
0011 rawlist = dir('*.pnm');
0012 index = randperm(length(rawlist));
0013 rawlist = rawlist(index);
0014 for i=1:n
0015 imagefile = rawlist(i).name;
0016 [dummy1,head,dummy2,dummy3] = fileparts(imagefile);
0017 pointsfile = [points_dir,'\',head,'.pts'];
0018 if(~isempty(dir(pointsfile)))
0019 [im, map] = pnmread(imagefile);
0020 [x,y] = read_brain_points(pointsfile);
0021 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(:)))]);
0022 set(imfig,'Name',imagefile,'Position',pos);
0023
0024 imfile = ['H:\nrr\brain\images\',head,'.png'];
0025 pfile = ['H:\nrr\brain\points\',head,'.pts'];
0026 imfile
0027 imwrite(im,imfile,'png');
0028 copyfile(pointsfile,pfile);
0029 end
0030 end
0031
0032 cd(home_dir);