function alldata = process(path,go)

close all
conv = 0.13;

% directory to analyze
%path = 'bralaprosteadystate';

% go into directory and compile alldata
cd(path)
cd images
if go
  rename_mat('nd2');
  alldata = compile_data_all('cells',0,conv,0);
  alldata = screen_poles(alldata);
end
% make plot of contourlevel
figure;
%scatter(1:alldata.n,alldata.contourlevel);
title(['Contour levels for ',path]);
xlabel('File number');
ylabel('Contour level');
print('-dpdf',['../contourlevels-',path,'.pdf']);

% make histogram of lengths and widths
figure;
hist(alldata.midthickness*conv,40);
title(['Average widths for ',path,' (1px=',num2str(conv),' microns)']);
xlabel('Width (microns)');
ylabel('Number of cells');
print('-dpdf',['../widths-',path,'.pdf']);

figure;
hist(alldata.midlength*conv,40);
title(['Average lengths for ',path,' (1px=',num2str(conv),' microns)']);
xlabel('Width (microns)');
ylabel('Number of cells');
print('-dpdf',['../lengths-',path,'.pdf']);

cd ..

% output cells
if go==2
  output_images(alldata,0,48,3,1);
end

eval(['save ',path,' alldata']);
cd ..
