;astrometry keyword for image input use to convert ra,dec mask ;coordinates into pixel using the image WCS function mask_poly, line, sx, sy, ra_min, dec_min, spix, $ astrometry = astrometry, radec_cent = radec_cent line_tab = strsplit(line, /extract) ;print, line n = n_elements(line_tab) - 1 mask_poly = double(line_tab[1 : n]) mask_ra = dblarr(n/2) mask_dec = dblarr(n/2) j = 0 while (j LT n-1) do begin mask_ra[j/2] = mask_poly[j] j++ mask_dec[(j-1)/2] = mask_poly[j] j++ endwhile ;convert in pixels if (not keyword_set(astrometry)) then begin mask_radec = radec2deg(radec_cent[0], radec_cent[1], mask_ra, mask_dec) mask_xpix = long((mask_radec[0,*] - ra_min)/spix) mask_ypix = long((mask_radec[1,*] - dec_min)/spix) endif else begin ad2xy, mask_ra, mask_dec, astrometry, mask_xpix, mask_ypix endelse inside_poly = polyfillv(mask_xpix, mask_ypix, sx, sy) testx = where(mask_xpix GT sx or mask_xpix LT 0, countx) testy = where(mask_ypix GT sy or mask_ypix LT 0, county) ;stop if (countx or county ne 0) then begin ;print, 'outta range' ;print, line ;stop endif return, inside_poly end