Take inter-sum of images

Take inter-sum of images

TITLE		Take Summed or Differenced Images

PURPOSE 	To take sum or difference images from C2-EIT

DESCRIPTION	This Observation Program is used to take normal images,
		using shutters, from C2,C3 and EIT which are then summed
		or differenced according to the parameters in the
		image_control array.

		The operator schedules this LP with the parameters which
		include which of the 3 telescopes are to be used, as well
		as which parameter table, FW position, PW position, and
		the image processing table number to process the image data.
		The image processing parameters passed allow for different
		processing of the first image of the sequence as compared
		with later images.  One method of image processing for the
		first image might be to just send compress and send the
		header and image. Subsequent images will use the
		sum_image_proc table.  We will also require a NULL image
		processing table which contains all 0s.

		If a telescope is declared down (non-operational) this code
		would simply by-pass that particular telescope, and work at
		the others.

LP Number 	19

INPUT PARAMETERS
		   Parameter	Description
			#

   			1	Telescope ID (0-3)
   			2	Parameter Table
			3	Filter Wheel Position (0-4)
			4	Polarizer Wheel Position (0-4)
			5	Number of Images
			6	Image Processing Table for First Image
			7	Image Processing Table for Inter-sum Images
			8	Final Image Processing Table


EXAMPLE 1
                The image processing tables (IP tables) are set up as follows
                 0 = Transmit Header
                 1 = Inter Sum, Transmit Header
                 2 = Rice
                 
                The LP is then called with 
                 Parameter 1 = 2    (C3)
                 Parameter 2 = 1    (Primary)
                 Parameter 3 = 0    (Filter Wheel 0)
                 Parameter 4 = 0    (Polarizer Wheel 0)
                 Parameter 5 = 3    (3 Images)
                 Parameter 6 = 0    (see IP table 0 above)
                 Parameter 7 = 1    (see IP table 1 above)
                 Parameter 8 = 2    (see IP table 2 above)

                This will take 3 images from C3 and add them.  A header will be
                sent for each image. 

EXAMPLE 2
                The image processing tables (IP tables) are set up as follows
                 0 = Rice 
                 1 = Inter Diff (fixed), Rice
                 2 = Null
                 
                The LP is then called with 
                 Parameter 1 = 2    (C3)
                 Parameter 2 = 1    (Primary)
                 Parameter 3 = 0    (Filter Wheel 0)
                 Parameter 4 = 0    (Polarizer Wheel 0)
                 Parameter 5 = 3    (3 Images)
                 Parameter 6 = 0    (see IP table 0 above)
                 Parameter 7 = 1    (see IP table 1 above)
                 Parameter 8 = 2    (see IP table 2 above)

                This will take 3 images from C3.  The first image will be
                sent down using Rice compression.  The next two images will
                be subtracted from the first image and transmitted with
                Rice compression.

EXAMPLE 3
                The image processing tables (IP tables) are set up as follows
                 0 = Clear Sum Buff 1, Sum Buff 1 Plus, Transmit Header 
                 1 = Sum Buff 1 Plus. Transmit Header
                 2 = Use Sum Buff 1, Rice
                 
                The LP is then called with 
                 Parameter 1 = 2    (C3)
                 Parameter 2 = 1    (Primary)
                 Parameter 3 = 0    (Filter Wheel 0)
                 Parameter 4 = 0    (Polarizer Wheel 0)
                 Parameter 5 = 3    (3 Images)
                 Parameter 6 = 0    (see IP table 0 above)
                 Parameter 7 = 1    (see IP table 1 above)
                 Parameter 8 = 2    (see IP table 2 above)

                This will take 3 images from C3.  The first image will
                clear summing buffer 1 and store the image, sending only
                an header.  The next image will be added to summing 
                buffer 1 and a header sent.  The last image will be
                added to summing buffer 1 and then the contents of
                the summing buffer sent using Rice.  Note that summing buffer
                1 retains the sum until it is cleared so that a later LP
                could use the contents of the summing buffer.
 
EXAMPLE 4
                The image processing tables (IP tables) are set up as follows
                 0 = Clear Sum Buff 1, Rice
                 1 = Inter Diff, Sum Buff 1 Plus, Transmit Header
                 2 = Use Sum Buff 1, Rice
                 
                The LP is then called with 
                 Parameter 1 = 2    (C3)
                 Parameter 2 = 1    (Primary)
                 Parameter 3 = 0    (Filter Wheel 0)
                 Parameter 4 = 0    (Polarizer Wheel 0)
                 Parameter 5 = 3    (3 Images)
                 Parameter 6 = 0    (see IP table 0 above)
                 Parameter 7 = 1    (see IP table 1 above)
                 Parameter 8 = 2    (see IP table 2 above)

                This will send down a reference image and the sum of 
                2 differences.  A reference image is taken and transmitted.
                The second image is taken and the 1st image is subtracted
		from it and the result is stored in summing buffer 1.
		The third image is taken and the 1st image is subtracted
		from it and the result is added to the image already in
		summing buffer 1.  The contents of summing buffer 1 are
		then transmitted.
 

MODULE NAME	OP_TAKE_SUM.C

Revised - Scott Paswaters - Jan 30, 1997