nraonrao
 
 NRAO Home > CASA > CasaDocument
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

The region of interest. Default is whole image.

allowed:

any

Default:

record

mask

OTF mask, Boolean LEL expression or mask region. 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----"  
# Unfortunately, rg.quarter() wasn’t implemented when this example was written.  
#ia.fromimage(outfile=’image.small’, infile=’image.large’, region=rg.quarter())  
ia.open(infile=’test.data’)  # needs to be open for ia.setboxregion()  
innerquarter=ia.setboxregion([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-of-interest takes a quarter by area of the first two axes of the image, and all pixels of other axes.

Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu

Copyright © 2007 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

Updated daily during alpha development.