source: hep2cells/gencellsimple.m @ 44

Last change on this file since 44 was 40, checked in by dtax, 12 years ago

HEp 2 cell classification, ICPR 2012 competition

File size: 1.4 KB
Line 
1% generate a simple dataset for the cell images
2%clear all; load cells_gabor;
3
4%dtype = 'max';
5dtype = 'nothing';
6
7N = size(x,1);
8if ndims(x{1,1})<3
9   dim = size(x{1,1},2);
10else
11   dim = size(x{1,1},3);
12end
13feat = zeros(N,dim);
14imlab = zeros(N,1);
15for i=1:N
16   i
17   if strcmp(dtype,'nothing')
18      feat(i,:) = x{i,:};
19   else
20      for j=1:dim
21         gim = x{i,1}(:,:,j);
22         gim = gim(find(x{i,2}));
23         switch dtype
24         case 'max'
25            feat(i,j) = max(gim);
26         case 'mean'
27            feat(i,j) = mean(abs(gim));
28         case 'var'
29            feat(i,j) = var(gim);
30         end
31      end
32   end
33   xlab(i,:) = x{i,4};
34   imlab(i,1) = x{i,3};
35end
36a = dataset(feat,xlab);
37a = setident(a,imlab,'image');
38M = size(z,1);
39feat = zeros(M,dim);
40imlab = zeros(M,1);
41for i=1:M
42   i
43   if strcmp(dtype,'nothing')
44      feat(i,:) = z{i,:};
45   else
46      for j=1:dim
47         gim = z{i,1}(:,:,j);
48         gim = gim(find(z{i,2}));
49         switch dtype
50         case 'max'
51            feat(i,j) = max(gim);
52         case 'mean'
53            feat(i,j) = mean(abs(gim));
54         case 'var'
55            feat(i,j) = var(gim);
56         end
57      end
58   end
59   zlab(i,:) = z{i,4};
60   imlab(i,1) = z{i,3};
61end
62b = dataset(feat,zlab);
63b = setident(b,imlab,'image');
64
65switch dtype
66case 'max'
67   save cellssimplemax a b;
68case 'mean'
69   save cellssimplemean a b;
70case 'var'
71   save cellssimplevar a b;
72end
Note: See TracBrowser for help on using the repository browser.