PRO ar2i,ima,date,ob,x1,x2,y1,y2 ;Measurement of size and brightness of objects in the frame IMA. ;DATE = 23 or 25 (IR observations of 1997) ;X1,...,Y2 - limits of the subimage of interest (OPTIONAL); ; if missing, whole image is processed ;Output 2D array OB ([Area, Deff, Imin, Imean],[objects]) ;PARAMETERS ******** scale=0.1658 ;arcsec/pix minarea=16 ;25 ;minimum size of object (pixels), IR minarew=9 ;16 ; WL limsig=220 ;limit of rms gran.contrast to distinguish ; between IR and WL frames if date eq 23 then begin qx1=246 ; subfield of quiet region (QR) qx2=379 qy1=182 qy2=291 endif else begin qx1=304 ; subfield of quiet region qx2=363 qy1=135 qy2=274 endelse ;******************* ;Renormalization rima=float(ima) rima=rima/mean(rima(qx1:qx2,qy1:qy2)) rima=fix(round(rima*10000)) sigma=fix(round(stdev(rima(qx1:qx2,qy1:qy2)))) if sigma gt limsig then minarea=minarew ;for WL frames ;Threshold determination: ;Intensity of object is be below the 'mean-3*sigma(QR)' level. thr=10000-3*sigma print,'stdev =',sigma,', threshold =',thr print,'Minimum area (pix):',minarea ;Segmentation mask=rima le thr rima=rima*mask if n_params() eq 7 then rima=rima(x1:x2,y1:y2) ;extract subfield ;Object identification ;see IDL manual (help) for LABEL_REGION.PRO bb=label_region(rima) ;labelling objects hh=histogram(bb,reverse_indices=rr) ;counting objects & their pixels ob=fltarr(4,n_elements(hh)-1) ;output array ;Object analysis ;0-th object contains background (zero) pixels and is skipped for i=1,n_elements(hh)-1 do begin pp=rr(rr(i):rr(i+1)-1) ;subscripts of pixels of object i qq=rima(pp) ;pixels of object i ob(0,i-1)=hh(i) ;area in pixels ob(1,i-1)=scale*sqrt(4*hh(i)/!pi) ;eff. diameter ob(2,i-1)=min(qq)/10000. ;minimum intensity if n_elements(qq) eq 1 then ob(3,i-1)=qq(0) $ else ob(3,i-1)=mean(qq)/10000. ;mean intensity endfor ;Elimination of objects smaller than 'minarea' w=where(ob(0,*) ge minarea, c) print,'Number of objects:',c if c ne 0 then ob=ob(*,w) END