NRAO Home > CASA > CASA Toolkit Reference Manual
image.fromimage - Function

1.1.1 Construct a (sub)image from a region of a CASA image


Description

This function applies a region-of-interest to an image file, creates a new image file containing the (sub)image, and associates the image tool with it.

The input image file may be in native CASA, FITS, or Miriad format. Look ?? for more information on foreign images.

If outfile is given, the (sub)image is written to the specified disk file.

If outfile is unset, the Image tool actually references the input image file. So if you deleted the input image disk file, it would render this tool useless. When you close this tool (with the close function) the reference connection is broken.

Sometimes it is useful to drop axes of length one (degenerate axes). Use the dropdeg argument if you want to do this.

The output mask is the combination (logical OR) of the default input pixel mask (if any) and the OTF mask. Any other input pixel masks will not be copied. Use function maskhandler if you need to copy other masks too.

See also the subimage function.

Arguments





Inputs

outfile

Output sub-image file name. Default is unset.

allowed:

string

Default:

infile

Input image file name. Must be specified.

allowed:

string

Default:

region

Region selection. See ”help par.region” for details. Default is to use the full image.

allowed:

any

Default:

variant

mask

Mask to use. See help par.mask. Default is none.

allowed:

any

Default:

variant

dropdeg

Drop degenerate axes

allowed:

bool

Default:

false

overwrite

Overwrite (unprompted) pre-existing output file?

allowed:

bool

Default:

false

Returns
bool

Example

 
 
"""  
#  
print "\t----\t fromimage Ex 1 \t----"  
innerquarter = rg.box([0.25,0.25],[0.75,0.75],frac=true)  
ia.close()  
ia.fromimage(outfile=’image.small’, infile=’test.data’, region=innerquarter, overwrite=true)  
ia.close()  
#  
"""  
 
The specified \region\ takes a quarter by area of the first two axes  
of the image, and all pixels of other axes.  

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search