function [ data,h,w,d ] = makenmfbil( bil ,k)
global nrows
nrows=size(bil,1);
ncols=size(bil,2);
images=size(bil,3);
if images < 7
    rows=2;
    columns=3;
else rows=3;
    columns=3;
end
if images > 9
    rows=3;
    columns=4;
else rows=rows;
    columns=columns;
end
if images > 12
    rows=4;
    columns=4;
else rows=rows;
    columns=columns;
end
[data]=reshape(bil,nrows*ncols,images);
[w,h,d]=nnmf(data,k);
figure
plotmatrix(w(1:500:end,:));
title('Factors Plot Matrix')
makescoremaps(w,rows,columns);
end