% Author: Lauren Jansen % Name: ProPro.m % Code takes tiffs thresholds and counts particles % Data is exported into an excel file %Image type: 1 Channel, 8-bit, 20X objective % Updated 8/7/14 [filename, pathname] = uigetfile('*.*','MultiSelect','on'); m = cell(length(filename),2); for i=1:length(filename) filenametemp = filename{i}; B = imread(filenametemp); %reads the original files as images %convert the image to gray Image=rgb2gray(B); %Initially apply a Guassian filter to the image %# Create the gaussian filter with hsize = [5 5] and sigma = 2 G = fspecial('gaussian',[5 5],2); %# Filter it Ig = imfilter(Image,G,'same'); %Make image binary %The two different levels is another filter strategy BW2 = im2bw(Ig, 0.15); BW2_Opp=~BW2; %Apply another Gaussian Filter G2 = fspecial('gaussian',[7 7],3); Ig2 = imfilter(BW2_Opp,G2,'same'); %Counts the nuclei in the image Bound2 = bwboundaries(Ig2); C2= num2str(length(Bound2)); m(i,:)={filenametemp C2}; end Out = input('Output filename? Format: enclosed in apostrophes Name.csv'); cell2csv(Out,m);