ImageSum


Image manipulation program. The program can be used for: 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

Actions Image Manipulations Constants Input/Output Misc
add
dezinger
div
left
low
monitor
right
sub
adczero
dark
nodark
zinger
abs
addsave
clear
covar
norm
posrescale
rescale
restore
save
setcolumn
setrow
sigma
subbg
zero
alert
logfile
monitorfile
poissonfile
scale
sigfac
fix
monitorclose
next
nofix
read
rotoffset
wait
write
cc
display
header
help
list
monitorinit
output
poisson
status

abs

Syntax: abs
Changes al the stored values by their absolute value.

adczero

Syntax: adczero state
If set to on, an ADCZERO value will be subtracted from each image.

add

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

addsave

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

alert

Syntax: alert n
Syntax: alert 10
Sets the maximum number of alert messages to n. Alert messages can be given in dezinger mode.

cc

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.

clear

Syntax: clear
Sets the current image to all zero

covar

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) )

dark

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

dezinger

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: 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.

display

Syntax: display h v
Prints the (accumulated) value at pixel position h v

div

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

header

Syntax: header
Print the header of the last image.

help

Syntax: help
Start (this) help

fix

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)

left

Syntax: left
Add the left part of the new image to the current image.

list

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.

logfile

Syntax: logfile filename
Default: logfile imagesum
Specifies the logfile name. Errors will be written to the logfile.

low

Syntax: low
Store the minimum value of the current and new images.
mapi,j = MIN( mapi,j, scale*newi,j)

monitor

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.

monitorclose

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.

monitorfile

Syntax: monitorfile filename
Default:monitorfile monitor.lis
Sets the name of the monitorfile. Use monitor to define pixels to be monitored.

monitorinit

Syntax: monitorinit
Sets the number of monitors to zero.

next

Syntax: next
Reads next image and apply manipulation (ADD,SUB...)

nodark

Syntax: nodark
Disable dark image subtraction. Enable subtration with the dark command.

norm

Syntax: norm
Normalise map after processing N images See also scale, rescale and posrescale for different scaling procedures.

output

Syntax: output none/normal/full/debug
Syntax: output normal
Controls the amount of output while reading images.

poisson

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.

poissonfile

Syntax: poissonfile filename
Default:poissonfile poisson.lis
Sets the name of the poissonfile. Use poisson to start/stop writing data to this file.

posrescale

Syntax: posrescale n
Default: posrescale 25000
Scale all values between 0 and n. See also scale, rescale and norm for different scaling procedures.

read

Syntax: read filename(s)
Read filename(s) and apply manipulation (ADD,SUB...) Wildcharacters are allowed.

rescale

Syntax: rescale n
Default: rescale 25000
Scale all values between -n and +n. See also scale, posrescale and norm for different scaling procedures.

restore

Syntax: restore
Restore the values from a previous save. The current values are lost.

right

Syntax: right
Add the right part of the new image to the current image

rotoffset

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).

save

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.

scale

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.

setcolumn

Syntax: setcolumn x v
Sets the values of the pixels in column x to v.

setrow

Syntax: setrow y v
Sets the values of the pixels in row y to v.

sigfac

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.

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)

status

Syntax: status
Show information

sub

Syntax: sub
mapi,j = mapi,j - scale*newi,j

Sets also NFILES to NFILES - 1 See subbg for the use of NFILES

subbg

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.

unfix

Syntax: unfix lambda/rot/target
Disable the effects of the fix command.

wait

Syntax: wait filename
Wait for filename, read the images file and apply manipulation (ADD,SUB...).

write

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:

zero

Syntax: zero
if mapi,j < 0 then mapi,j = 0

zinger

Syntax: zinger n
Sets dezinger option while reading an image.
n description
0 use dezingered value.
-1 use mean value
-2 use minimum value
n use frame number n

Input/Output files

Input Files

Output files

written images
EVPY Suite Overview