STScI Logo

xtsums xtools


NAME · SYNOPSIS · DESCRIPTION · RETURN_VALUE · EXAMPLES · SEE_ALSO

NAME

xt_lsum  -- Sum image lines
xt_csum  -- Sum image columns
xt_lsumb -- Sum image lines with buffering
xt_csumb -- Sum image columns with buffering

SYNOPSIS

pointer	im		# IMIO pointer
pointer	co		# COGETR pointer
int	col1, col2	# Column limits of the sum
int	line1, line2	# Line limits
pointer	data		# Data pointer returned

	call xt_lsum (im, col1, col2, line1, line2, data)
	call xt_csum (co, col1, col2, line1, line2, data)
	call xt_lsumb (im, col1, col2, line1, line2, data)
	call xt_csumb (co, col1, col2, line1, line2, data)

DESCRIPTION

The specified lines or columns in a 2D images are summed and a pointer to the real sum vector is returned. For xt_lsum and xt_lsumb the lines between line1 and line2 are summed and a pointer to the summed vector between col1 and col2 is returned. Similarly, for xt_csum and xt_csumb the columns between col1 and col2 are summed and a pointer to the summed vector between line1 and line2 is returned. The data pointer is to a real vector. The column sums use the efficient column access procedures described in cogetr .

The procedures without the b suffix read the set of lines or columns in the sum from the image every time. The b suffix procedures buffer the lines or columns such that if only a few lines or columns are different from the preceding sum then only those lines or columns are read. Thus the "buffered" sums are used for moving sums while the unbuffered procedures are used when there is no overlap between the sums.

RETURN VALUE

The returned pointer data is to a vector of type real.

EXAMPLES

Suppose a sum of "nsum" lines or columns is required through the image in steps of "nstep". The following code fragment illustrates the usage.

	im = immap (image, READ_ONLY, 0)
	switch (axis) {
	case 1:
	    col1 = 1
	    col2 = IM_LEN(im, 1)
	    for i = 1, IM_LEN(im, 2), nstep {
	        if (nstep < nsum)
		    call xt_lsumb (co, col1, col2, i, i+nsum-1, data)
	        else
		    call xt_lsum (co, i, i+nsum-1, line1, line2, data)

	        # Do operations on vector Memr[data]
	    }
	case 2:
	    co = comap (im, maxbuf)

	    line1 = 1
	    line2 = IM_LEN(im, 2)
	    for i = 1, IM_LEN(im, 1), nstep {
	        if (nstep < nsum)
		    call xt_csumb (co, i, i+nsum-1, line1, line2, data)
	        else
		    call xt_csum (co, i, i+nsum-1, line1, line2, data)

	        # Do operations on vector Memr[data]
	    }
	    call counmap (co)
	}
	call imunmap (im)

SEE ALSO

cogetr


Source Code · Search Form · STSDAS