PRO strousisol,movin,movout,sh,msk ; Procedure to isolate penumbral grains in a 3-D sunspot movie. ; "Everything" except PGs is set to zero. ;Segmentation is done by Strous' algorithm (STROAL.PRO) ;General mask is set individually for each frame, trying to outline ;the actual umbra or penumbra boundary. ;Then a mask to remove too dark BFs (i.e. UDs) could be applied. ;Moreover, an external mask MSK can be used. ; MOVIN - input movie ; MOVOUT- output movie with isolated bright features ; SH - distance (pix) between investigated points for STROAL (optional) ; MSK - external mask (optional) ; Adapted from UDISOL2 and PGISOL2, 28 March 2000, Michal on_error,1 ;*************** PARAMETERS ********************************** ; SMO - smoothing parameter before applying Strous' algorithm ; PETHR - intensity below which the bright BFs are removed ; GMSMO - smoothing parameter to define general mask (pix) ; GMTHO - threshold to define outer general mask smo=3 ; 3 ; smoothing before segmentation (pix) pethr=8000 ; minimum allowed intensity gmsmo=9 ; to smooth the borders for mask gmtho=18000 ; max. intensity in smoothed frame ;************************************************************* if n_params() lt 3 then begin sh =1 ; STROAL parameter, default msk=1 ; external mask, default endif if n_params() lt 4 then msk=1 smov=size(movin) if smov(0) ne 3 then message,'Input must be a 3-D array!' movout=movin for i=0,smov(3)-1 do begin oima=movin(*,*,i) ;original image ima=SMOOTH(oima,smo) ;smoothing ima=STROAL(ima,sh) gt 0 ;segmentation mask ima=ima*oima ;segmented original image ; mge=SMOOTH(oima,gmsmo) lt gmtho ;outer general mask ; ima=ima*mge ;masked image mpe=ima gt pethr ; mask to remove too faint BFs ima=ima*mpe ; too faint features eliminated movout(0,0,i)=ima*msk ;compose resulting movie, ; applying external mask endfor END