function RESULT=cellsizer(MATRIX) % Enters a serie of procedures to process % the cellular pattern analysis. % % You can display the cellular pattern, visualize the PSD, % launch an averaged angular scanning, which will help you % defining the angle of the PSD legs, and use it in an % averaged radial scanning to extract the spatial wave length % of the cellular pattern. % % This programs returns an array: % 1st column: cell size harmonics % 2nd column: relative energy of each harmonic % % The picture must be Black & White. % % IT IS ALSO STRONGLY RECOMMENDED, IF NOT REQUIRED, TO USE SQUARE IMAGES. % NOT DOING SO CAN LEAD TO FALSE RESULTS... % % If possible, use an image whose dimensions in pixels are % a power of 2. % % EXAMPLES: % % >> cellsizer('cell.jpg'); % where cell.jpg is the cellular pattern image % OR % >> cellsizer(MATRIX); % where MATRIX is the double-type matrix of % the cellular pattern image, i.e. MATRIX=double(imread('cell.jpg')). % % To keep the harmonics & associated energies in the variable ARRAY, type % >> ARRAY=cellsizer(...); if isstr(MATRIX) MATRIX=double(imread(MATRIX)); % Turns the image into a matrix end pi=3.14159265; [HEIGHT WIDTH]=size(MATRIX); if HEIGHT~=WIDTH disp(' ') disp(' WARNING: Your image isn''t square.'); disp(' You may love taking risks, or just getting wrong results...'); end FINAL=calcpsd(MATRIX,HEIGHT,WIDTH); % DSP calculation [Xc Yc]=center(FINAL); m=0; % Default value for the main menu while m~=7 % If m==7 : QUIT m=menu('WHAT WOULD YOU LIKE TO DO?','DISPLAY CELLULAR PATTERN AND PSD REPRESENTATION','FILTERING','EDGE ENHANCEMENT','ANGULAR SCANNING','RADIAL SCANNING','CELL WIDTH','QUIT and learn why I wrote this program...'); if m==1 disppsd(MATRIX,FINAL); % DSP visualization end if m==2 FILTERED=filtr(MATRIX,HEIGHT,WIDTH,Xc,Yc); % Image filtering sm=menu('Would you like to work on the filtered image as of now?','Yes','No'); if sm==1 MATRIX=double(FILTERED); FINAL=calcpsd(MATRIX,HEIGHT,WIDTH); % DSP calculation for the filtered image end end if m==3 % Edge enhancement sm=menu('Which program do you wish to use?','Matlab program','Home-made program'); if sm==1, EDGED=matlabsobel(MATRIX); else, EDGED=persobel(MATRIX); end ssm=menu('Would you like to work on the edge enhanced image as of now?','Yes','No'); if ssm==1 MATRIX=double(EDGED); FINAL=calcpsd(MATRIX,HEIGHT,WIDTH); % DSP calculation for the filtered image end end if m==4 angplot(FINAL,HEIGHT,WIDTH,Xc,Yc); % Angular scanning end if m==5 ANGL=radplot(FINAL,HEIGHT,WIDTH,Xc,Yc); % Radial scanning. Returns the angle of the scanned leg, to use it in peak. end if m==6 if HEIGHT==WIDTH RESULT=peak(HEIGHT,ANGL); % Cell width calculation else disp(' Impossible to measure the cell size of a non-square image') end end end disp(' ') disp(' Thanks for running me!') disp(' Hope to see you again soon...') disp(' ') disp('In fact, the reason why I wrote this program is') why disp(' ')