NRAO Home > CASA > CASA Cookbook and User Reference Manual

7.6 Image Viewer (imview)

imview is currently mostly a close of the viewer. A significant improvement, however, is that imview adds scriptability from the usual task interface to the viewer. This will enable the production of plots without invoking the GUI. To date, the controls from the command interface are still limited but we will add the full functionality gradually.

imview has the following inputs:

#  imview :: View an image  
raster              =         {}        #  (Optional)  Raster filename (string)  
                                        #   or complete raster config  
                                        #   dictionary. The allowed dictionary  
                                        #   keys are file (string), scaling  
                                        #   (numeric), range (2 element numeric  
                                        #   vector), colormap (string), and  
                                        #   colorwedge (bool).  
contour             =         {}        #  (Optional)  Contour filename (string)  
                                        #   or complete contour config  
                                        #   dictionary. The allowed dictionary  
                                        #   keys are file (string), levels  
                                        #   (numeric vector), unit (float), and  
                                        #   base (float).  
zoom                =          1        #  (Optional)  zoom can specify  
                                        #   intermental zoom (integer), zoom  
                                        #   region read from a file (string) or  
                                        #   dictionary specifying the zoom  
                                        #   region. The dictionary can have two  
                                        #   forms. It can be either a simple  
                                        #   region specified with blc (2 element  
                                        #   vector) and trc (2 element vector)  
                                        #   [along with an optional coord key  
                                        #   ("pixel" or "world"; pixel is the  
                                        #   default) or a complete region  
                                        #   rectangle e.g. loaded with  
                                        #   "rg.fromfiletorecord( )". The  
                                        #   dictionary can also contain a  
                                        #   channel (integer) field which  
                                        #   indicates which channel should be  
                                        #   displayed.  
axes                =         -1        #  (Optional)  this can either be a  
                                        #   three element vector (string) where  
                                        #   each element describes what should  
                                        #   be found on each of the x, y, and z  
                                        #   axes or a dictionary containing  
                                        #   fields "x", "y" and "z" (string).  
out                 =         ’’        #  (Optional)  Output filename or  
                                        #   complete output config dictionary.  
                                        #   If a string is passed, the file  
                                        #   extension is used to determine the  
                                        #   output type (jpg, pdf, eps, ps, png,  
                                        #   xbm, xpm, or ppm). If a dictionary  
                                        #   is passed, it can contain the  
                                        #   fields, file (string), scale  
                                        #   (float), dpi (int), or orient  
                                        #   (landscape or portrait). The scale  
                                        #   field is used for the bitmap formats  
                                        #   (i.e. not ps or pdf) and the dpi  
                                        #   parameter is used for scalable  
                                        #   formats (pdf or ps).  
async               =      False        #  If true the taskname must be started  
                                        #   using imview(...)  
 
 

The raster and contour parameters control how images are loaded. They take python dictionaries as inputs. This may be an easier solution than a complicated matrix of input parameters. The structure looks like:

imview(raster={’file’: ’ngc5921.clean.image’,  
                       ’range’: [-0.01,0.03],  
                       ’colormap’: ’Hot Metal 2’,  
                       ’scaling’: -1},  
               contour={’file’: ’ngc5921.clean.image’},  
               axes={’x’:’Declination’} ,  
               zoom={’channel’: 7, ’blc’: [75,75], ’trc’: [175,175],  
                     ’coord’: ’pixel’},  
               out=’myout.png’)

Let’s go through the structure:

The parameter that can be found in the GUI is listed here as ’key’:’value’ pair. E.g. ’file’:’ngc5921.clean.image’ sets the file name of the raster image, ’range’: [-0.01,0.03] sets the scaling.

contour can take more than a single file at a time to allow multiple contour overlays. This can be achieved by specifying two dictionaries in brackets

 contour={’file’: ’file1.image’, ’levels’: [1,2,3] },  
         {’file’: ’file2.image’, ’levels’: [0.006, 0.008, 0.010] }

zoom is a parameter to specify the part of the image that is shown, axes defines what axes are shown (most obviously ’x’:’Right Ascension’, ’y’:’Declination’ are the default and most useful, but one axis could also be frequency), and out defines the filename of the output in various graphic formats.

Currently, the following parameters are supported:

raster  -- (string) image file to open  
           (dict)   file (string)     => image file to open  
                    scaling (float)   => scaling power cycles  
                    range (float*2)   => data range  
                    colormap (string) => name of colormap  
                    colorwedge (bool) => show color wedge?  
contour -- (string) file to load as a contour  
           (dict)   file (string)     => file to load  
                    levels (float*N)  => relative levels  
                    base (numeric)    => zero in relative levels  
                    unit (numeric)    => one in the relative levels  
zoom    -- (int)    integral zoom level  
           (string) region file to load as the zoom region  
           (dict)   blc (numeric*2)   => bottom left corner  
                    trc (numeric*2)   => top right corner  
                    coord (string)    => pixel or world  
                    channel (int)     => chanel to display  
           (dict)   <region record>   => record loaded  
                                         e.g. rg.fromfiletorecord( )  
axes    -- (string*3) demension to display on the x, y, and z axes  
           (dict)     x               => dimension for x-axes  
                      y               => dimension for y-axes  
                      z               => dimension for z-axes  
out     -- (string) file with a supported extension  
                    [jpg, pdf, eps, ps, png, xbm, xpm, ppm]  
            (dict)    file (string)   => filename  
                      format (string) => valid ext (filename ext overrides)  
                      scale (numeric) => scale for non-eps, non-ps output  
                      dpi (numeric)   => dpi for eps or ps output  
                      orient (string) => portrait or landscape

Examples are also found in help imview.


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

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