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