ImageSum
Image manipulation program. The program can be used for:
- Adding images
- Subtracting images
- Determining minimum/maximum values
- etc.....
Use read to read images.
With various manipulation commands images can be modified, added,
subtracted, divided.
Use write to write output files.
Different formats are available.
Commands
Syntax: abs
Changes al the stored values by their absolute value.
Syntax: adczero state
If set to on, an ADCZERO value will be
subtracted from each image.
Syntax: add
New images will be added.
mapi,j = mapi,j + scale*newmapi,j
sets also NFILES to NFILES + 1
See subbg and
addsave to make use of nfiles
Syntax: addsave
This commands adds the saved values (see save) to the
current results.
If the total exposure time in the saved array is different from the total
exposure time in the current result, a scale factor will be applied to
correct for this difference.
Example
Suppose you have 10 background images d*.bg with exposure time 30 and
100 'normal' images d*.kbd with exposure time 60
Use the following sequence to subtract all background images:
clear clear result array
sub start subtracting
d*.bg subtract all (10) images. (resulting values are negative!!!)
save save the subtracted sum
clear clear result array
add start adding
d*.kcd add all (100) images
addsave multiply the save array with 20 [ (100*60)/(10*30) ] and add to the current result array
Syntax: alert n
Syntax: alert 10
Sets the maximum number of alert messages to n.
Alert messages can be given in dezinger mode.
Syntax: cc h v
Default:cc Nx/2 Ny/2
Sets the central pixelcoordinates for mean intensity calculations.
Sum1 is a 11*11 box around this centre. sum2 is a 301*301 box
around this centre. The defaults are the centre of the image.
Used by poisson.
Syntax: clear
Sets the current image to all zero
Syntax: covar dx dy
mapi,j = Σ (newi,j-savei,j)*(newi+dx,j+dy-savei+dx,j+dy)
You should store the mean image in save. The whole procedure is:
add (start adding)
read all images (add all the images)
norm (divide sumvalues by nImages)
save (store it)
clear (fresh start)
covar 1 0 (start calculations of covariance, pixel i,j times i+1,j)
read all images (sum the covariances)
norm (divide by (nImages-1) )
Syntax: dark imagename
Default: nodark
Specify a dark image. This image will be subtracted from all
new images.
Use nodark to disable the dark subtraction
Syntax: dezinger
Sets dezinger mode. In this mode, zingers are detected using all the
images. You should read the images frame by frame. The dezinger procedure
is:
- zinger 1
- Read and store first frame
- Read second frame. Then for each pixel:
- Calculate the mean value (m) until now.
- Determine the minimum of this mean value and the current value (c). If we
interpret this value as counts, then sigma(min) = sqrt(min).
- Set delta (d) to abs(c-m) and compare this with the sigma(min).
- If d is greater than sigfac*sqrt(min) there is
a zinger detected.
- If this is the second frame, store 2 * min
- If c > m ignore c
- If c < m use c as the mean value until now
- Repeat for all remaining frames.
- zinger 2
- Repeat for all frames again
If a zinger is detected in multiple frames, an alert message will
be given. The maximum number of alert messages can be set by
alert.
Syntax: display h v
Prints the (accumulated) value at pixel position h v
Syntax: div
The current image will be divided by next image
if mapi,j > 0 and newi,j > 0 then
mapi,j = 1000.0*mapi,j / newi,j
else
mapi,j = 0
Syntax: header
Print the header of the last image.
Syntax: help
Start (this) help
Syntax: fix lambda/rot/target
Changes header values. Use this command to change some header
values.
Use unfix to disable.
(Use rotoffset to change the values of rotstart
and rotend in the image header)
Syntax: left
Add the left part of the new image to the current image.
Syntax: list h v
Shows part of the data.
A box of 11*11 pixels is printed on the screen. h v
are the horizontal and vertical pixel coordinate of the lower left
of the displayed box.
Syntax: logfile filename
Default: logfile imagesum
Specifies the logfile name.
Errors will be written to the logfile.
Syntax: low
Store the minimum value of the current and new images.
mapi,j = MIN( mapi,j, scale*newi,j)
Syntax: monitor x y
Adds the pixel coordinate x y to the list of
monitored pixels.
For each frame the value of the pixel [x y]
will be written to a monitorfile. The name of the file can be
set with monitorfile.
This allows you to analyse the change of one or more pixels over a set
of frames.
The maximum number of monitors is 10.
Remove the monitors with monitorinit.
Syntax: monitorclose
Closes the monitor file. If you leave the monitors intact, a new
file will be created after reading the next image. Disable the
monitors with monitorinit.
Syntax: monitorfile filename
Default:monitorfile monitor.lis
Sets the name of the monitorfile. Use monitor
to define pixels to be monitored.
Syntax: monitorinit
Sets the number of monitors to zero.
Syntax: next
Reads next image and apply manipulation (ADD,SUB...)
Syntax: nodark
Disable dark image subtraction. Enable subtration with the
dark command.
Syntax: norm
Normalise map after processing N images
- If sigma is active: divide by
(N-1) and take the squareroot,
- If covar is active: divide by
(N-1)
- Otherwise: divide by N
See also scale, rescale and
posrescale for different scaling procedures.
Syntax: output none/normal/full/debug
Syntax: output normal
Controls the amount of output while reading images.
Syntax: poisson
A file poisson.lis is created.
For each image file read, a line is written
to this file containing:sum1 sum2 sum3.
sum1 = sum of all pixels.
sum2 = sum of the central 11*11 pixels.
sum3 = sum of central 301*301 box pixels.
A second call to poisson will close the file.
The pixel coordinates of the used centre can be changed with
cc. Specify the filename with with
poissonfile.
The file will be closed if you invoke poisson a
second time.
Syntax: poissonfile filename
Default:poissonfile poisson.lis
Sets the name of the poissonfile. Use poisson to
start/stop writing data to this file.
Syntax: posrescale n
Default: posrescale 25000
Scale all values between 0 and n.
See also scale, rescale
and norm for different scaling procedures.
Syntax: read filename(s)
Read filename(s) and apply manipulation (ADD,SUB...)
Wildcharacters are allowed.
Syntax: rescale n
Default: rescale 25000
Scale all values between -n and +n.
See also scale, posrescale
and norm for different scaling procedures.
Syntax: restore
Restore the values from a previous save.
The current values are lost.
Syntax: right
Add the right part of the new image to the current image
Syntax: rotoffset a
Change the rotstart and rotend value in the imageheader. The value
of a will be added to the current rotstart and
rotend values. This offset is only used when you
write a new image.
(See also fix).
Syntax: save
Save the current results into a different array.
You may use these saved values with the commands
restore and addsave.
The saved data are implicitly used by
sigma and covar.
Syntax: scale f
Default: scale 1.0
Set scale factor to f. This scale factor is applied
to each image when it is read.
See also rescale, posrescale
and norm for different scaling procedures.
Syntax: setcolumn x v
Sets the values of the pixels in column x to
v.
Syntax: setrow y v
Sets the values of the pixels in row y to
v.
Syntax: sigfac f
Default: sigfac 3.0
In the dezinger procedure a difference is
compared with the sigma of a value.
A difference will be too large if it is greater than
f*sigma.
Syntax: sigma
mapi,j = (newi,j-savei,j)²
You should store the mean image with save.
The whole procedure is:
add (start adding)
read all images (add all the images)
norm (divide sumvalues by nImages)
save (store it)
clear (fresh start)
sigma (start determining sigma)
read all images (add squares of differences)
norm (divide by (nImages-1) and take square root)
Syntax: status
Show information
Syntax: sub
mapi,j = mapi,j - scale*newi,j
Sets also NFILES to NFILES - 1
See subbg for the use of NFILES
Syntax: subbg
mapi,j = mapi,j - scale*newi,j
Sets also NFILES to NFILES - 1.
The program will continue to read maps until NFILES=0
See also addsave for a different approach.
Example
You have created 5 background files (d1.dark, d2.dark ... d5.dark)
and 12 data files (d01.kcd, d02.kcd, .... d12.kcd)
To add up all data files and subtract the same number of background
files use the command sequence:
add d*.kcd subbg d*.dark rescale write kcd output.kcd
A different approach is:
clear sub d*.dark save clear add d*.kcd addsave write kcd output.kcd
Here the dark images are accumulated in SAVE. After reading the kcd images,
the command addsave will add the save array with a correction for
the (different) exposure times.
Syntax: unfix lambda/rot/target
Disable the effects of the fix command.
Syntax: wait filename
Wait for filename, read the images file
and apply manipulation (ADD,SUB...).
Syntax: write format name
format is one of
cnt,
list, pgm
or the current image format (which is the default).
name is the new filename. Default is the concatenation
of sum and the last
(wildcharactered) filename read.
The following formats can be written:
- cnt
Syntax: write cnt filename
Contour file
Record1: Nx,Ny,title
Record2: (float(map(1,j)),j=1,nx)
Record3: (float(map(2,j)),j=1,nx)
etc....
- .....
Syntax: write . filename
Writes according the the current input format.
If the absolute value of the minimum or the maximum is greater than
rescale (default=25000) the image is rescaled
before writing to disk. See posrescale to
limit the result to 0-RESCALE.
- list
Syntax: write list filename
A Runtime format is constructed. File is ASCII.
- pgm
Syntax: write pgm filename
Use rescale first.
Format = i3 (hexadecimal) 26 items on one row
Line 1: P2
Line 2: 512 512
line 3: 99
line 4: (map(j,0), j= 0, 25)
line 5: (map(j,0), j= 26, 51)
etc
Syntax: zero
if mapi,j < 0 then mapi,j = 0
Syntax: zinger n
Sets dezinger option while reading an image.
0 |
use dezingered value. |
-1 |
use mean value |
-2 |
use minimum value |
n |
use frame number n |
Input Files
Output files
written images
EVPY Suite Overview