FUNCTION lin_smooth,image,along_rows=along_rows,down_columns=down_columns IF NOT (KEYWORD_SET(along_rows) OR KEYWORD_SET(down_columns)) THEN BEGIN MESSAGE,'Select either /ALONG_ROWS or /DOWN_COLUMNS!',/INFORMATIONAL RETURN,image ENDIF tsize=SIZE(image) IF tsize(0) NE 2 THEN BEGIN MESSAGE,'IMAGE must be an array!',/INFORMATIONAL RETURN,image ENDIF @isitdos IF KEYWORD_SET(along_rows) THEN temp=TRANSPOSE(image) ELSE temp=image imsize=SIZE(temp) ncols=imsize(1) rn=INDGEN(imsize(2)) FOR ic=0,ncols-1 DO BEGIN ; main loop to fix up one column coli=REFORM(temp(ic,*)) res=ladfit(rn,coli,absdev=ad) minv=res(0)+res(1)*rn-ad maxv=minv+2.*ad ok=(minv LE coli) AND (coli LE maxv) bad=WHERE(ok EQ 0) alt=INTARR(imsize(2)) alt(bad)=round(res(0)+res(1)*bad) coli=ok*coli+(1-ok)*alt temp(ic,*)=TRANSPOSE(coli) ENDFOR IF KEYWORD_SET(along_rows) THEN temp=TRANSPOSE(temp) RETURN,temp END