; ---------------------------------------------------------------------- ; Fractional pixel summation with real row boundaries (fixed column). ; Sums up counts within boundaries. ; rb1,rb2 = row boundaries 1 and 2 (lower and upper). ; NOTE: You must check before calling that boundaries are within image[]. ; NOTE: You must check before calling that boundaries are within image[]. ; NOTE: You must check before calling that boundaries are within image[]. ; NOTE: You must check before calling that boundaries are within image[]. ; function nsxng_fractional_pixel_rb, nc, nr, image, rb1, rb2, icol ; Look at all relevant pixels. */ imgsum=0. ; for jj = round(rb1), round(rb2) do begin ;> check boundaries for jj = (round(rb1) > 0), (round(rb2) < (nr - 1)) do begin ; Edges of pixel. pi1=jj - 0.5 pi2=jj + 0.5 ; Column enclosure. if (pi1 gt rb1) then begin if (pi2 lt rb2) then begin rowfrac = 1.0 ; Fully enclosed. */ endif else begin rowfrac = (rb2 - pi1) ; Upper boundary in pixel. */ endelse endif else begin if (pi2 lt rb2) then begin rowfrac = (pi2 - rb1) ; /* Lower boundary in pixel. */ endif else begin rowfrac = (rb2 - rb1) ; /* Both boundaries within pixel. */ endelse endelse pixno = icol + (jj*long(nc)) imgsum = imgsum + (rowfrac * (*image)[pixno]) endfor return, imgsum end