source: hep2cells/readcells.m @ 101

Last change on this file since 101 was 45, checked in by dtax, 12 years ago

All useful files for processing of cells.

File size: 1.3 KB
RevLine 
[45]1% read the raw images, their masks and their labels:
2dpath='/Volumes/mm/PRLab/Data/icpr2012_continued/data/Main_Dataset/';
3N = 28;
4
5X = cell(1,1);
6k=0;
7for i=1:N
8   i
9   % first read the label file
10   dinfo = importdata(sprintf('%s/Images/%02d/%02d.csv',dpath,i,i));
11   dat = dinfo.textdata(2:end,:);
12   %cellid = str2num(cell2mat(dat(:,2)));
13   cellid = str2num(strvcat(dat(:,2)));
14   pattlab = dat(:,6);
15   % then read the images
16   fnames = dir(sprintf('%s/Cells/Cell_Images/%02d/*.png',dpath,i));
17   M = size(fnames,1);
18   for j=1:M
19      k = k+1;
20      nr = str2num(fnames(j).name(1:3));
21      fullfname = sprintf('%s/Cells/Cell_Images/%02d/%s',dpath,i,fnames(j).name);
22      X{k,1} = importdata(fullfname);
23      fullfname = sprintf('%s/Cells/Cell_Masks/%02d/%s',dpath,i,fnames(j).name);
24      bigmask = importdata(fullfname);
25      X{k,2} = (bigmask(dinfo.data(nr,2):dinfo.data(nr,4)-1,...
26                       dinfo.data(nr,1):dinfo.data(nr,3)-1) > 0);
27      X{k,3} = i;
28      X{k,4} = pattlab(nr,:);
29      X{k,5} = nr;
30
31   end
32end
33
34
35Itrain = [ 1 2 3 5 6 7 8 9 11 14 18 20 25 26];
36Itest = [ 4 10 12 13 15 16 17 19 21 22 23 24 27 28];
37I = cell2mat(X(:,3));
38j = [];
39for i=1:length(Itrain)
40   j = [j; find(I==Itrain(i))];
41end
42x = X(j,:);
43j = [];
44for i=1:length(Itest)
45   j = [j; find(I==Itest(i))];
46end
47z = X(j,:);
48save cells x z;
49
Note: See TracBrowser for help on using the repository browser.