FUNCTION outside,image,dil=dil,ero=ero,tri=tri,view=view ; Was an image passed? imsize=SIZE(image) ; IF not, return with error message. IF imsize(0) NE 2 THEN BEGIN MESSAGE,'parameter must be 2-d',/INFORMATIONAL RETURN,-1 ENDIF ELSE BEGIN ; Determine image size. xsize=imsize(1) ysize=imsize(2) ENDELSE ; Set up erosion operator. structure=REPLICATE(1,3,3) ; First 'close' the image to fill in small holes. IF N_ELEMENTS(dil) EQ 1 THEN BEGIN pedestal=image IF KEYWORD_SET(view) THEN BEGIN WINDOW,/FREE,XSIZE=xsize,YSIZE=ysize dwin=!D.WINDOW TVSCL,pedestal STOP ENDIF FOR i=0,dil-1 DO BEGIN pedestal=DILATE(pedestal,structure,/GRAY) IF KEYWORD_SET(view) THEN BEGIN TVSCL,pedestal STOP ENDIF ENDFOR pedestal=(pedestal GT 0) ENDIF ELSE pedestal=image-image temp=BYTE((FIX(image)+pedestal)