NRAO Home > CASA > CASA Toolkit Reference Manual

1.1 images - Module

Access and analysis of images

Description

This module contains functionality to access, create, and analyze CASA images. It offers both basic services and higher-level packaged tools.

The available tools in this module are

Images

We refer to a CASA image file when we are referring to the actual data stored on disk. The name that you give a CASA image file is actually the name of a directory containing a collection of CASA tables which together constitute the image file. But you only need to refer to the directory name and you can think of it as one logical file. Some images don’t have an associated disk file. These are called “virtual” images (e.g. an image that is temporary and entirely in memory). Whenever we use the word “image”, we are just using it in a generic sense.

Images are manipulated with an Image tool.

Pixel mask

A pixel mask specifies which pixels are to be considered good (mask value T) or bad (mask value F). For example, you may have imported a FITS file which has blanked pixels in it. These will be converted into pixel mask elements whose values are bad (F). Or you may have made an error analysis of an image and computed via a statistical test that certain pixels should be masked out for future analysis.

An image file may contain zero, one, or more pixel masks. However, only one mask will be designated as the default mask and be applied to the data.

For more details, see the Image tool.

Region-of-interest

A region-of-interest or simply, region, designates which pixels of the image you are interested in for some (generally) astrophysical reason. This complements the pixel mask which specifies which pixels are good or bad (for statistical reasons). Regions-of-interest are generated and manipulated with the Regionmanager tool.

Briefly, a region-of-interest may be either a simple shape such as a multi-dimensional box, or a 2-D polygon, or some compound combination of regions-of-interest. For example, a 2-D polygon defined in the X and Y axes extended along the Z axis, or perhaps a union or intersection of regions.

See the Regionmanager documentation for more details on regions.

Coordinates

We will often refer to (absolute) pixel coordinates. Consider a 2-D image with shape [10,20]. Then our model is that the centre of the bottom-left corner pixel has pixel coordinate [X,Y] = [0,0]. The centre of the top-right corner pixel has pixel coordinate [X,Y] = [9,19].

When a physical Coordinate System (e.g. an RA/DEC direction coordinate) is attached to an image, then we can convert pixel coordinates to a world (or physical) coordinate.

The Coordsys tool is available for manipulating Coordinate Systems. You can recover the Coordinate System from an image into a Coordsys tool via the Image function coordsys.

For more details, see the Image and Coordsys tools.

Lattice Expression Language (LEL)

This allows you to manipulate expressions involving images. For example, add this image to that image, or multiply the miniumum value of that image by the square root of this image. The LEL syntax is quite rich and is described in detail in note 223.

LEL is used in several of the Image tool functions.

  1.1.1 image - Tool
    image.newimage - Function
    image.newimagefromfile - Function
    image.imagecalc - Function
    image.collapse - Function
    image.decimate - Function
    image.imageconcat - Function
    image.fromarray - Function
    image.fromascii - Function
    image.fromfits - Function
    image.fromimage - Function
    image.fromshape - Function
    image.maketestimage - Function
    image.adddegaxes - Function
    image.addnoise - Function
    image.convolve - Function
    image.boundingbox - Function
    image.boxcar - Function
    image.brightnessunit - Function
    image.calc - Function
    image.calcmask - Function
    image.close - Function
    image.continuumsub - Function
    image.convertflux - Function
    image.convolve2d - Function
    image.coordsys - Function
    image.coordmeasures - Function
    image.decompose - Function
    image.deconvolvecomponentlist - Function
    image.deconvolvefrombeam - Function
    image.beamforconvolvedsize - Function
    image.commonbeam - Function
    image.remove - Function
    image.removefile - Function
    image.done - Function
    image.fft - Function
    image.findsources - Function
    image.fitprofile - Function
    image.fitcomponents - Function
    image.fromrecord - Function
    image.getchunk - Function
    image.getregion - Function
    image.getprofile - Function
    image.getslice - Function
    image.hanning - Function
    image.haslock - Function
    image.histograms - Function
    image.history - Function
    image.insert - Function
    image.isopen - Function
    image.ispersistent - Function
    image.lock - Function
    image.makecomplex - Function
    image.maskhandler - Function
    image.miscinfo - Function
    image.modify - Function
    image.maxfit - Function
    image.moments - Function
    image.name - Function
    image.open - Function
    image.pad - Function
    image.crop - Function
    image.pixelvalue - Function
    image.putchunk - Function
    image.putregion - Function
    image.rebin - Function
    image.regrid - Function
    image.transpose - Function
    image.rotate - Function
    image.rotatebeam - Function
    image.rename - Function
    image.replacemaskedpixels - Function
    image.beamarea - Function
    image.restoringbeam - Function
    image.sepconvolve - Function
    image.set - Function
    image.setbrightnessunit - Function
    image.setcoordsys - Function
    image.sethistory - Function
    image.setmiscinfo - Function
    image.shape - Function
    image.setrestoringbeam - Function
    image.statistics - Function
    image.twopointcorrelation - Function
    image.subimage - Function
    image.summary - Function
    image.tofits - Function
    image.toASCII - Function
    image.torecord - Function
    image.type - Function
    image.topixel - Function
    image.toworld - Function
    image.unlock - Function
    image.newimagefromarray - Function
    image.newimagefromfits - Function
    image.newimagefromimage - Function
    image.newimagefromshape - Function
    image.pbcor - Function
    image.pv - Function
    image.makearray - Function
    image.isconform - Function
  1.1.2 regionmanager - Tool
    regionmanager.regionmanager - Function
    regionmanager.absreltype - Function
    regionmanager.box - Function
    regionmanager.frombcs - Function
    regionmanager.complement - Function
    regionmanager.concatenation - Function
    regionmanager.deletefromtable - Function
    regionmanager.difference - Function
    regionmanager.done - Function
    regionmanager.selectedchannels - Function
    regionmanager.fromtextfile - Function
    regionmanager.fromtext - Function
    regionmanager.fromfiletorecord - Function
    regionmanager.tofile - Function
    regionmanager.fromrecordtotable - Function
    regionmanager.fromtabletorecord - Function
    regionmanager.intersection - Function
    regionmanager.ispixelregion - Function
    regionmanager.isworldregion - Function
    regionmanager.namesintable - Function
    regionmanager.setcoordinates - Function
    regionmanager.makeunion - Function
    regionmanager.wbox - Function
    regionmanager.wpolygon - Function
  1.1.3 coordsys - Tool
    coordsys.newcoordsys - Function
    coordsys.addcoordinate - Function
    coordsys.axesmap - Function
    coordsys.axiscoordinatetypes - Function
    coordsys.conversiontype - Function
    coordsys.convert - Function
    coordsys.convertdirection - Function
    coordsys.convertmany - Function
    coordsys.coordinatetype - Function
    coordsys.copy - Function
    coordsys.done - Function
    coordsys.epoch - Function
    coordsys.findaxis - Function
    coordsys.findaxisbyname - Function
    coordsys.findcoordinate - Function
    coordsys.frequencytofrequency - Function
    coordsys.frequencytovelocity - Function
    coordsys.fromrecord - Function
    coordsys.increment - Function
    coordsys.lineartransform - Function
    coordsys.names - Function
    coordsys.naxes - Function
    coordsys.ncoordinates - Function
    coordsys.observer - Function
    coordsys.projection - Function
    coordsys.referencecode - Function
    coordsys.referencepixel - Function
    coordsys.referencevalue - Function
    coordsys.reorder - Function
    coordsys.transpose - Function
    coordsys.replace - Function
    coordsys.restfrequency - Function
    coordsys.setconversiontype - Function
    coordsys.getconversiontype - Function
    coordsys.setdirection - Function
    coordsys.setepoch - Function
    coordsys.setincrement - Function
    coordsys.setlineartransform - Function
    coordsys.setnames - Function
    coordsys.setobserver - Function
    coordsys.setprojection - Function
    coordsys.setreferencecode - Function
    coordsys.setreferencelocation - Function
    coordsys.setreferencepixel - Function
    coordsys.setreferencevalue - Function
    coordsys.setrestfrequency - Function
    coordsys.setspectral - Function
    coordsys.setstokes - Function
    coordsys.settabular - Function
    coordsys.settelescope - Function
    coordsys.setunits - Function
    coordsys.stokes - Function
    coordsys.summary - Function
    coordsys.telescope - Function
    coordsys.toabs - Function
    coordsys.toabsmany - Function
    coordsys.topixel - Function
    coordsys.topixelmany - Function
    coordsys.torecord - Function
    coordsys.subimage - Function
    coordsys.torel - Function
    coordsys.torelmany - Function
    coordsys.toworld - Function
    coordsys.toworldmany - Function
    coordsys.type - Function
    coordsys.units - Function
    coordsys.velocitytofrequency - Function
    coordsys.parentname - Function
    coordsys.setparentname - Function
  1.1.4 imagepol - Tool
    imagepol.imagepoltestimage - Function
    imagepol.complexlinpol - Function
    imagepol.complexfraclinpol - Function
    imagepol.depolratio - Function
    imagepol.close - Function
    imagepol.done - Function
    imagepol.fourierrotationmeasure - Function
    imagepol.fraclinpol - Function
    imagepol.fractotpol - Function
    imagepol.linpolint - Function
    imagepol.linpolposang - Function
    imagepol.makecomplex - Function
    imagepol.open - Function
    imagepol.pol - Function
    imagepol.rotationmeasure - Function
    imagepol.sigma - Function
    imagepol.sigmadepolratio - Function
    imagepol.sigmafraclinpol - Function
    imagepol.sigmafractotpol - Function
    imagepol.sigmalinpolint - Function
    imagepol.sigmalinpolposang - Function
    imagepol.sigmastokes - Function
    imagepol.sigmastokesi - Function
    imagepol.sigmastokesq - Function
    imagepol.sigmastokesu - Function
    imagepol.sigmastokesv - Function
    imagepol.sigmatotpolint - Function
    imagepol.stokes - Function
    imagepol.stokesi - Function
    imagepol.stokesq - Function
    imagepol.stokesu - Function
    imagepol.stokesv - Function
    imagepol.summary - Function
    imagepol.totpolint - Function

Example Here is a simple example to give you the flavour of using the image module. Suppose we have an image FITS disk file; we would like to convert it to a CASA image file (store the image in a CASA table), look at the header information and store it in a record for future use, work out some statistics and then close the image.

"""  
#  
print "\t----\t Module Ex 1 \t----"  
pathname=os.environ.get("CASAPATH")  
pathname=pathname.split()[0]  
datapath=pathname+"/data/demo/Images/imagetestimage.fits"  
ia.fromfits(outfile=’testimage.im’, infile=datapath, overwrite=T) # 1  
hdr = ia.summary()                                                # 2  
ia.statistics()                                                   # 3  
ia.close()                                                        # 4  
print "Last example!  Exiting..."  
exit()  
#  
"""

  1. Convert (using fromfits) an image FITS disk file called ‘imagetestimage.fits’ in the directory specified by the environment variable $CASAPATH’ to a CASA image file called ‘testimage.im’. The CASA image file is now associated with the default image tool ia.
  2. This summarises (to the Logger) the basic header information in the image (name, masks, regions, brightness units, coordinates etc) and also stores it in a record named hdr.
  3. This tool function evaluates basic statistics from the entire image.
  4. This closes the Image tool, but does not delete its associated disk image file.


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