Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | image |
outfile | in | Output image file name | |
Allowed: | String | ||
Default: | unset | ||
pixels | in | Numeric Glish array | |
csys | in | Coordinate System | |
Allowed: | Coordsys tool | ||
Default: | unset | ||
linear | in | Make a linear Coordinate System if csys not given | |
Allowed: | T or F | ||
Default: | F | ||
overwrite | in | Overwrite (unprompted) pre-existing output file ? | |
Allowed: | T or F | ||
Default: | F | ||
log | in | Write image creation messages to logger | |
Allowed: | T or F | ||
Default: | T |
This constructor converts a Glish array of any size into an AIPS++ image file.
If outfile is given, the image is written to the specified disk file. If outfile is unset, the Image tool is associated with a temporary image. This temporary image may be in memory or on disk, depending on its size. When you destroy the Image tool (with the done function) this temporary image is deleted.
At present, no matter what type the pixels array is, a real-valued image will be written (the input pixels will be converted to Float with the Glish as_float function). In the future, Complex images will be supported.
The Coordinate System, provided as a Coordsys tool, is optional. If you provide it, it must be dimensionally consistent with the pixels array you give (see also coordsys).
If you don't provide the Coordinate System (unset), a default Coordinate System is made for you. If linear=F (the default) then it is a standard RA/DEC/Stokes/Spectral Coordinate System depending exactly upon the shape of the pixels array (Stokes axis must be no longer than 4 pixels and you may find the spectral axis coming out before the Stokes axis if say, shape=[64,64,32,4]). Extra dimensions are given linear coordinates. If linear=T then you get a linear Coordinate System.
- im := imagefromarray(outfile='test.data', pixels=array(0, 64, 64, 4, 128)) - cs := im.coordsys(axes=[1,2]) - im.done() - im2 := imagefromarray(pixels=array(1.0, 32, 64), csys=cs) - cs.done()
The first example creates a zero-filled image file named test.data which is of shape [128,256]. If you examine the header with im.summary() you will see the default RA/DEC/Stokes/Frequency coordinate information. In the second example, a Coordinate System describing the first two axes of the image test.data is created and used to create a 2D image temporary image.