% generate a simple dataset for the cell images %clear all; load cells_gabor; function [a,b] = gencellsimple(x,z,dtype) if nargin<3 dtype = 'max'; end N = size(x,1); if ndims(x{1,1})<3 dim = size(x{1,1},2); else dim = size(x{1,1},3); end feat = zeros(N,dim); imlab = zeros(N,1); for i=1:N i if strcmp(dtype,'nothing') feat(i,:) = x{i,:}; else for j=1:dim gim = x{i,1}(:,:,j); gim = gim(find(x{i,2})); switch dtype case 'max' feat(i,j) = max(gim); case 'mean' feat(i,j) = mean(abs(gim)); case 'var' feat(i,j) = var(gim); end end end xlab(i,:) = x{i,4}; imlab(i,1) = x{i,3}; end a = dataset(feat,xlab); a = setident(a,imlab,'image'); M = size(z,1); feat = zeros(M,dim); imlab = zeros(M,1); for i=1:M i if strcmp(dtype,'nothing') feat(i,:) = z{i,:}; else for j=1:dim gim = z{i,1}(:,:,j); gim = gim(find(z{i,2})); switch dtype case 'max' feat(i,j) = max(gim); case 'mean' feat(i,j) = mean(abs(gim)); case 'var' feat(i,j) = var(gim); end end end zlab(i,:) = z{i,4}; imlab(i,1) = z{i,3}; end b = dataset(feat,zlab); b = setident(b,imlab,'image'); %switch dtype %case 'max' % save cellssimplemax a b; %case 'mean' % save cellssimplemean a b; %case 'var' % save cellssimplevar a b; %end