% showprogress - show batch processing progress in image window with text % program has 3 parts, % 1. initialisation before entering the for loop % 2. actual running in the for loop % 3. wrapping up after the for loop % % Usage: showprogress(part,range,current,figNo,imsize) % % Arguments: part - 1,2 or 3, to switch among 3 modes, % before, in or after for loop % range - the range of processing indeces % current - current position or index % (Optional) % figNo - figure number % imsize - image size [r,c] % % Return: Nil. % % Author: % Tzu Yen Wong % wongt AT csse DOT uwa DOT edu DOT au % Department of Computer Science & Software Engineering % The University of Western Australia % % Dec 2003 % June 2004 change email address to fight SPAM!!! function showprogress(part,range,current,figNo,imsize) eval('figNo;','figNo=1;'); eval('imsize;','imsize=[20,200];'); fst = min(range); lst = max(range); r = imsize(1); c = imsize(2); figure(figNo), switch part case 1 % insert before loop of fst:lst clf; imshow(ones(r,c)); set(gcf,'name','Progress'); text(c/10,r/2,sprintf('[%d,%d], now %d',fst,lst,fst-1),'EraseMode','xor'); case 2 % insert in loop of fst:lst text(c/10,r/2,sprintf('[%d,%d], now %d',fst,lst,current-1),'EraseMode','xor'); text(c/10,r/2,sprintf('[%d,%d], now %d',fst,lst,current),'EraseMode','xor'); drawnow case 3 % insert after loop of fst:lst imshow(ones(r,c)); text(c/10,r/2,sprintf('[%d,%d], now %d',fst,lst,current)); otherwise disp('Unknown selection for showprogress.m') end