source: hep2cells/gencellsimple.m @ 142

Last change on this file since 142 was 46, checked in by dtax, 12 years ago

Changes....

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