Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: imageconcat - Constructor Up: image - Tool Previous: image - Constructor


imagecalc - Constructor



Package general
Module images
Tool image


Construct an AIPS++ image via the image calculator


Synopsis
imagecalc(outfile, pixels, overwrite)


Arguments

outfile in Output image file name
    Allowed: String
    Default: unset
pixels in LEL expression
    Allowed: String
overwrite in Overwrite (unprompted) pre-existing output file ?
    Allowed: T or F
    Default: F


Returns
Image tool



Description

This constructor is used to evaluate a mathematical expression involving existing image files, assigning the result to the newly created output image. The syntax of the expression supplied via the pixels argument (in what is called the Lattice Expression Language, or LEL) is explained in detail in note 223.

Any image files embedded in the expression may be native AIPS++ or FITS (but not yet Miriad) image files. Look here for more information on foreign images.

If outfile is given, the image is written to the specified disk file. If outfile is unset, the Image tool actually references all of the input files in the expression. So if you deleted any of the input image disk files, it would render this tool useless. When you destroy this tool (with the done function), the reference connections are broken.

If you make a reference tool, the expression is re-evaluated every time you use it. So it takes no extra storage, but takes longer to access the pixel values (they must be recomputed).



Example
im:= imagecalc(outfile='cF', pixels='aF + min(float(pi()), mean(bF))')

Suppose aF and bF are image files with single precision data. They do not need to have conforming shapes and coordinates, because only the mean of bF is used. Note that pi is explicitly converted to single precision, because pi() results in a Double. If that was not done, the expression result would be a Double with the effect that all data of aF had to be converted to Double. So this expression first computes a scalar, the minimum of $ \pi$ and the mean of the image file bF. That scalar is then added to the value of each pixel in the image file aF. The resultant is put in the image file called cF to which access is provided via the image tool called im.

If the expression is masked, that mask will be copied to the new image.



Example
- im:=imagecalc('cF', 'min(aF, (min(aF)+max(aF))/2)')

This example shows that there are 2 min functions. One with a single argument returning the minimum value of that image. The other with 2 arguments returning an image containing aF data clipped at the value of the 2nd argument.



Example
- im := imagecalc('eF', 'sin(aD)+(aF*2)+min(bF)+real(aC)')
This shows a mixed type expression. The real part of the Complex image aC is used in an expression that otherwise uses Float type. The result of the expression is written out to the disk file called eF.



Example
- im := imagecalc(pixels='sin(aD)+(aF*2)+min(bF)+real(aC)')
This shows a mixed type expression. The real part of the Complex image aC is used in an expression that otherwise uses Float type. The result of the expression is not written out to disk in this case. It is evaluated each time it is needed.





next up previous contents index
Next: imageconcat - Constructor Up: image - Tool Previous: image - Constructor   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01