pro destre_fw,date,wid,nref,reb ; ; DESTRETCHING of a stabilized and restored WL movie stored ; in "wrXX.xxx" plain binary integer files. ; Main for DEFORMO (procedures called by DEFORMO are SMOOTHE, DISTORTI, ; MEAN, SCONVOL, ODD, (KCONVOL) (Oslo)). ; ; DATE - 23 or 25 ; ; WID - FWHM of Gaussian window in determination of displacement map. ; (reasonable value: should torrespond to ~ 2"-3"). ; ; Reference image: the floating average of movie frames. ; NREF gives the number of frames to be averaged ; (reasonable value: 5 - 7 frames). Better if NREF is an odd number. ; ; REB is down-rebining parameter for image correlation (1 or 2). ; ; Version 28.3.95 ; ; ---------- UNSHARP MASKING PARAMETERS (for DEFORMO) --------------- smo = 20 ; U.M. SMOOTHING PARAMETER (3.26") umq =0.5 ; U.M. COEFFICIENT (0: no masking, 1: total difference) ; ------------------------------------------------------------------- ; ARRAY PARAMETERS on_error,1 if (date ne 23) and (date ne 25) then $ message,'Sorry, I do not know how to handle this dataset' dat=strtrim(date,2) if date eq 23 then begin nima=321 sx=472 sy=400 x1=20 x2=491 y1=90 y2=489 endif else begin nima=324 sx=472 sy=400 x1=20 x2=491 y1=81 y2=480 endelse im=intarr(512,512) ; read-in array ; ------------------------------------------------------------------- print,'number of frames:',nima nref=nref>3 nref=nref0 ; lower limit ul=ll+nref-1 ; upper limit if ul gt (nima-1) then begin ; end-of-series case ul=nima-1 ll=ul-nref+1 endif ; Beginning-of-series if (ul le (nref-1)) then begin ref=total(stack,3)/nref ; reference image ; print,'begin ',ll,ul j=i ; live frame in the stack endif ; Add-and-shift procedure (middle part) if (ul gt (nref-1)) and (i le (nima-nref+fix(nref/2))) then begin stack=shift(stack,0,0,-1) ; shift to left print,'reading '+strtrim(ul,2) openr,1,dat+'jun/wr'+dat+'.'+strtrim(ul,2) ; new frame on stack top readu,1,im close,1 im1=im(x1:x2,y1:y2) ; working clear field stack(0,0,nref-1)=im1 ref=total(stack,3)/nref ; reference image ; print,'middle',ll,ul j=fix(nref/2) ; live frame in middle-of-stack endif ; End-of-series if i gt (nima+fix(nref/2)-nref) then begin ref=total(stack,3)/nref ; reference image ; print,'end...',ll,ul j=i-nima+nref ; live frame in the stack endif ; Destretching print,'processing frame no.',i,' stack',j DEFORMO,stack(*,*,j),ref,war,smo,umq,wid,reb,interp=(-0.5) ; interp=(-0.5) in IDL V.5, otherwise interp=1 war=NINT(war) ; conversion to integer openw,1,dat+'jun/wde'+dat+'.'+strtrim(i,2) writeu,1,war close,1 endfor ;-----end of loop------------------------ print,'End of program' end