pro destre_main,wid,nref,reb ; ; DESTRETCHING of a series of frames. ; Main for DEFORMO (procedures called by DEFORMO are SMOOTHE, DISTORTI, ; MEAN, SCONVOL, ODD, (KCONVOL) (Oslo)). ; ; WID - FWHM of Gaussian correlation window - in pixels ; (reasonable value: no. of pixels corresponding approx. to 2"). ; ; 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). ; ; NOTE: This program might be run recurrently 2 - 3 times. In the ; first run, REB is usually 2 and WID is large. In the last run, ; REB = 1 and WID is small. ; ; Version 25.5.2001, Michal ; ; ---------- UNSHARP MASKING PARAMETERS (for DEFORMO) ------------- smo = 20 ; U.M. SMOOTHING PARAMETER in pixels (about 2") umq = 0.5 ; U.M. COEFFICIENT (0: no masking, 1: total difference) ; --------------------- INPUT PARAMETERS --------------------- ; ---------------------- (to be edited) ---------------------- ; Input and output filenames, number of frames etc.: ; Filenames are expected to be in the form 'name_root.seq', ; where name_root can include a path and seq is the sequential ; number of frame. sti='name1.' ; sti - input name_root + '.' sto='name2.' ; sto - output name root + '.' ;Optional definition of the subfield (here e.g. 640x640 in ; a 1024x1024 image). sx=640 ; x-size of the subfield sy=640 ; y-size of the subfield x1=191 ; limits of the subfield x2=830 y1=211 y2=850 nima=132 ;number of frames beg =119 ;seq. of the first frame im=intarr(1024,1024) ;original image size ------------------- END OF PARAMETERS ------------------------- 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 seq=strtrim(ul+beg,2) print,'reading '+seq openr,1,sti+seq ; new frame on stack top readu,1,im close,1 im1=im(x1:x2,y1:y2) ; destretched subfield 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 5.*, otherwise interp=1 war=NINT(war) ; conversion to integer seq=strtrim(i+beg,2) openw,1,sto+seq writeu,1,war close,1 endfor ;-----end of loop------------------------ print,'End of program' end