C PROGRAM SMOOTHISTOGRAM.FT C -------------------------- C C PETER LEMKIN C IMAGE PROCESSING UNIT, DCBD C NATIONAL CANCER INSTITUTE C NATIONAL INSTITUTES OF HEALTH C 9000 ROCKVILLE PIKE C BETHESDA, MD. 20014 C C JUNE 14, 1977 C MARCH 8, 1977 C FEB 28, 1977 C JAN 14, 1977 C JAN 13, 1977 C C INTRODUCTION C ------------ C SMOOTHISTOGRAM.FT IS A CHAINED PROGRAM USED WITH BMON2 C IT RECEIVES ITS ARGUMENTS FROM THE CD AREA AND THE IBM1,IHGH1 C IBM2,IHGH2, JBM, JHGH VARIABLES IN COMMON. COMMON IS RESTORED C FIRST BEFORE THE FUNCTION (TO BE INSERTED INTO THE BODY) IS C EVALUATED. AFTER THE FUNCTION IS PERFORMED, COMMON C IS SAVED AND BMON2 IS CHAINED BACK TO. C ANY COMPUTATIONS ARE DONE, THE ARGUMENTS ARE THEN CHECKED C C _SMOOTHISTOGRAM , C , <#smoothing iterations> C - smooth the histogram in memory using disaster C analysis discussed in [13]. The disaster analysis computes for C all x in [0:255] a noise figure N(x)=|H(x)-Havg(x,L)|. C Where: Havg(x,L)=(1/L)SUM[i=(x-L/2):(x+L/2) of H(i)]. C If N(x) > DELTA C Then H(x) <==Havg'(x,L); C Where: Havg'(x,L)=((L*Havg(x,L))-H(x))/(L-1). C The end points at [-L/2:-1] and [256:255+L/2] are duplications C of the end points 0 and 255 respectively. C The number of smoothing iterations (default 1) is the C number of times the algorithm is iterated. If is C specified, then the histogram is dumped ther at the end of C the processing. C OPDEFS C ------ S OPDEF TADI 1400 S OPDEF DCAI 3400 C S OPDEF MQA 7501 S OPDEF MQL 7421 S OPDEF KRS 6034 S OPDEF BSW 7002 C C S OPDEF HPL 6360 S OPDEF HSR 6321 S OPDEF VPL 6362 S OPDEF VSR 6323 C [1] INITIALIZATION WRITE(1,995) 995 FORMAT('SMOOTHISTOGRAM 6/14/77 - 4:01PM') C C RESTORE COMMON ET=TIMER(0) C C C [2] SETUP THE WINDOW WIDTH L AND THE DELTA PARAMETERS C IF NOT SPECIFIED IN THE ARGS. L=10 IF(ICNUM)200,201,200 200 L=ICNUM C C TEST DELTA 201 DELTA=5.0 IF(ICNUM(2))202,203,202 202 DELTA=ICNUM(2) C C C TEST NTIMES 203 NTIMES=1 IF(ICNUM(3))204,205,204 204 NTIMES=ICNUM(3) C C [3] GO DO IT C NOTE ISW(12)=/L SWITCH FOR DUMP C JSPOOL=ISW(12)+ISW(12)+IOUTSPOOL 205 DO 300 I=1,NTIMES CALL DISASTER(IH,DELTA,L,JSPOOL) 300 CONTINUE C C C C [4] IF OR /L THEN SHOWHIST. IZ=ISW(12) S TAD \IZ S SZA CLA S JMP \400 /PRINT IT C S TAD \KOUTFILE S CIA S TAD BMTEXT S SZA CLA S JMP \999 /NO C 400 IVAL=9 CALL BMAX3 C C [999] RETURN C SAVE COMMON 999 ET=TIMER(1) CALL BSCOMMON(1) CALL CHAIN('BMON2') C C C C ****PARAMETERS**** S BMTEXT, TEXT /BM/ END