Main Page | Class List | Directories | File List | Class Members | File Members

ObitImageUtil.c File Reference

ObitImageUtil module function definitions for ObitImage class. More...

#include <sys/types.h>
#include <time.h>
#include "ObitImageUtil.h"
#include "ObitUVWeight.h"
#include "ObitSkyGeom.h"
#include "ObitFInterpolate.h"
#include "ObitPBUtil.h"
#include "ObitIOImageFITS.h"
#include "ObitFArrayUtil.h"

Functions

ObitImageObitImageUtilCreateImage (ObitUV *inUV, glong fieldNo, gboolean doBeam, ObitErr *err)
 Public: Create an ObitImage from uv data.
void ObitImageUtilMakeImage (ObitUV *inUV, ObitImage *outImage, glong channel, gboolean doBeam, gboolean doWeight, ObitErr *err)
 Public: Fill an image with an image made from from uv data.
void ObitImageUtilInterpolateImage (ObitImage *inImage, ObitImage *outImage, gint *inPlane, gint *outPlane, glong hwidth, ObitErr *err)
 Public: Interpolate pixels in one image to another.
void ObitImageUtilInterpolateImageZern (ObitImage *inImage, ObitImage *outImage, gint *inPlane, gint *outPlane, glong hwidth, gint nZern, gfloat *ZCoef, ObitErr *err)
 Public: Interpolate pixels in one image to another with Zernike corrections.
void ObitImageUtilInterpolateWeight (ObitImage *inImage, ObitImage *outImage, ObitImage *outWeight, gboolean memOnly, gint radius, gint *inPlane, gint *outPlane, glong hwidth, ObitErr *err)
 Public: Interpolate pixels in one image to another giving output weighting.
void ObitImageUtilPBCorr (ObitImage *inImage, ObitImage *pntImage, ObitImage *outImage, gint *inPlane, gint *outPlane, gfloat antSize, ObitErr *err)
 Public: Correct (divide) an image by the primary beam pattern of another.
void ObitImageUtilPBApply (ObitImage *inImage, ObitImage *pntImage, ObitImage *outImage, gint *inPlane, gint *outPlane, gfloat antSize, ObitErr *err)
 Public: Multiply an image by the primary beam pattern of another.
void ObitImageUtilPBImage (ObitImage *pntImage, ObitImage *outImage, gint *outPlane, gfloat antSize, gfloat minGain, ObitErr *err)
 Public: Fill image with the primary beam pattern.
void ObitImageUtilImagParm (gfloat MaxBL, gfloat MaxW, gfloat *Cells, gfloat *Radius)
 Public: determine imaging parameters from UVW Extrema.
ObitImageObitImageUtilArray2Image (gchar *fileName, gint disk, ObitFArray *inArray, ObitErr *err)
 Public: Create a FITS image from an ObitFArray.
ObitImageObitImageUtilQuanFITS (ObitImage *inImage, gchar *fileName, gint disk, ObitErr *err)
 Public: Quantize an ObitImage and write to a FITS image.
void ObitImageUtilMakeCube (ObitImageDesc *inDesc, ObitUVDesc *UVDesc, ObitImageDesc *outDesc, gchar *Stokes, gint bchan, gint echan, gint incr, ObitErr *err)
 Public: Define an Image freq cube descriptor from a single plane and uv Descriptors.
void ObitImageUtilInsertPlane (ObitImage *in, ObitImage *out, glong *plane, ObitErr *err)
 Public: Insert a plane from an image into a cube.
void ObitImageUtilUV2ImageDesc (ObitUVDesc *UVDesc, ObitImageDesc *imageDesc, gint nchavg)
 Public: Convert an ObitUVDesc to an ObitImageDesc.
void ObitImageUtilVel (ObitImage *inImage, ObitImage *outImage, ObitErr *err)
 Public: Flux weighted velocity image from Cube.
void ObitImageUtilSelCopy (ObitImage *inImage, ObitImage *outImage, ObitErr *err)
 Public: Copy with selection by pixel increment.


Detailed Description

ObitImageUtil module function definitions for ObitImage class.


Function Documentation

ObitImage* ObitImageUtilArray2Image gchar *  fileName,
gint  disk,
ObitFArray inArray,
ObitErr err
 

Public: Create a FITS image from an ObitFArray.

Currently only does two to four dimensions.

Parameters:
fileName output FITS image file name
disk output FITS disk number
inArray Data array to be written
err Error stack, returns if not empty.
Returns:
pointer to the new object.

ObitImage* ObitImageUtilCreateImage ObitUV inUV,
glong  fieldNo,
gboolean  doBeam,
ObitErr err
 

Public: Create an ObitImage from uv data.

Imaging parameters are on the inUV info member as arrays for a number of fields.

  • "nChAvg" OBIT_int (1,1,1) number of channels to average. This is for spectral line observations and is ignored if the IF axis on the uv data has more than one IF. Default is continuum = average all freq/IFs. 0=> all.
  • "rotate" OBIT_float (?,1,1) Desired rotation on sky (from N thru E) in deg. [0]
  • "nx" OBIT_int (?,1,1) Dimension of image in RA [no default]. This and the following are arrays with one entry per field.
  • "nxBeam" OBIT_int (?,1,1) Dimension of beam in RA, [def. nx]
  • "ny" OBIT_int (?,1,1) Dimension of image in declination[no default]
  • "nyBeam" OBIT_int (?,1,1) Dimension of beam in declination, [def. ny]
  • "xCells" OBIT_float (?,1,1) X (=RA) cell spacing in asec [no default]
  • "yCells" OBIT_float (?,1,1) Y (=dec) cell spacing in asec [no default]
  • "xShift" OBIT_float (?,1,1) Desired shift in X (=RA) in degrees. [0]
  • "yShift" OBIT_float (?,1,1) Desired shift in Y (=dec) in degrees. [0]
    Parameters:
    inUV Input uv data.
    fieldNo Which field (1-rel) in imaging parameter arrays.
    doBeam if TRUE also create beam as the myBeam member of returned image.
    err Error stack, returns if not empty.
    Returns:
    Pointer to the newly created ObitImage.

void ObitImageUtilImagParm gfloat  MaxBL,
gfloat  MaxW,
gfloat *  Cells,
gfloat *  Radius
 

Public: determine imaging parameters from UVW Extrema.

Otherwise, maximum field size from Lecture 2 (A. R. Thompson) in "Synthesis Imaging in Radio Astronomy II", PASP, vol. 180, 1999, p. 24 is used. A correction is applied for the actual range in W.

Parameters:
MaxBL maximum baseline length (sqrt(u*u+v*v))
MaxW Max abs(w) in data.
Cells Cell spacing in asec. If zero on input the value is set based on MaxBL (1/4 min fringe spacing)
Radius Maximum undistorted Field of view in cells (Cells). If zero on input, the value is set from MaxW.

void ObitImageUtilInsertPlane ObitImage in,
ObitImage out,
glong *  plane,
ObitErr err
 

Public: Insert a plane from an image into a cube.

Parameters:
in Input image with plane to copy
out Output cube to accept plane
plane (1-rel) pixel indices for planes 3-7 in out.

void ObitImageUtilInterpolateImage ObitImage inImage,
ObitImage outImage,
gint *  inPlane,
gint *  outPlane,
glong  hwidth,
ObitErr err
 

Public: Interpolate pixels in one image to another.

There is no interpolation between planes

Parameters:
inImage Image to be interpolated.
outImage Image to be written. Must be previously instantiated.
inPlane desired plane in inImage, 1-rel pixel numbers on planes 3-7
outPlane desired plane in outImage
hwidth interpolation halfwidth (1 or 2 usually OK, 4 max)
err Error stack, returns if not empty.

void ObitImageUtilInterpolateImageZern ObitImage inImage,
ObitImage outImage,
gint *  inPlane,
gint *  outPlane,
glong  hwidth,
gint  nZern,
gfloat *  ZCoef,
ObitErr err
 

Public: Interpolate pixels in one image to another with Zernike corrections.

There is no interpolation between planes

Parameters:
inImage Image to be interpolated.
outImage Image to be written. Must be previously instantiated.
inPlane desired plane in inImage, 1-rel pixel numbers on planes 3-7
outPlane desired plane in outImage
hwidth interpolation halfwidth (1 or 2 usually OK, 4 max)
nZern Number of Zernike terms, can handle up to 17
ZCoef Array of Zernike coefficients (piston ignored)
err Error stack, returns if not empty.

void ObitImageUtilInterpolateWeight ObitImage inImage,
ObitImage outImage,
ObitImage outWeight,
gboolean  memOnly,
gint  radius,
gint *  inPlane,
gint *  outPlane,
glong  hwidth,
ObitErr err
 

Public: Interpolate pixels in one image to another giving output weighting.

Also calculates a weight based on a circle defined by radius; this is 1.0 in the center and tapers with distance^2 to 0.0 outside. If memOnly then the input image plane is assumed in inImage and only memory resident parts of outImage and outWeight are modified. There is no interpolation between planes

Parameters:
inImage Image to be interpolated.
outImage Image to be written. Must be previously instantiated.
outWeight Weight image to be written. Must be previously instantiated and have same geometry as outImage.
memOnly if TRUE then work only in memory
radius Radius in pixels of weighting circle
inPlane Desired plane in inImage, 1-rel pixel numbers on planes 3-7; ignored if memOnly
outPlane Desired plane in outImage; ignored if memOnly
hwidth Interpolation halfwidth (1 or 2 usually OK, 4 max)
err Error stack, returns if not empty.

void ObitImageUtilMakeCube ObitImageDesc inDesc,
ObitUVDesc UVDesc,
ObitImageDesc outDesc,
gchar *  Stokes,
gint  bchan,
gint  echan,
gint  incr,
ObitErr err
 

Public: Define an Image freq cube descriptor from a single plane and uv Descriptors.

This should be called before the image is Opened or instantiated.

Parameters:
inDesc Input Image Descriptor.
UVDesc Input UV Descriptor.
outDesc Output Image Descriptor
Stokes Stokes parameter of image ' '=>'I', (I, Q, U, V, R, L)
bchan first (1-rel) channel in UVDesc
echan highest (1-rel) channel in UVDesc
incr channel increment in input
nchavg How many uv channels to average per image channel. Ignored if uv data has multiple IFs.

void ObitImageUtilMakeImage ObitUV inUV,
ObitImage outImage,
glong  channel,
gboolean  doBeam,
gboolean  doWeight,
ObitErr err
 

Public: Fill an image with an image made from from uv data.

Uses (creating if necessary) the myGrid member of out.

Parameters:
inUV Input uv data. Should be in form of stokes to be imaged will all calibration and selection applied and any weighting applied.
outImage Image to be written. Must be previously instantiated. Beam normalization factor is written to output Beam infoList as SUMWTS
doBeam if TRUE also make beam. Will make the myBeam member of outImage. If FALSE, and myGrid->BeamNorm 0.0 then reads SUMWTS value from beam infolist
doWeight if TRUE Apply uniform weighting corrections to uvdata before imaging. Weighting parameters on inUV:
  • "nuGrid" OBIT_int scalar = Number of "U" pixels in weighting grid. [defaults to "nx"]
  • "nvGrid" OBIT_int scalar = Number of "V" pixels in weighting grid.
  • "WtBox" OBIT_int scalar = Size of weighting box in cells [def 1]
  • "WtFunc" OBIT_int scalar = Weighting convolution function [def. 1] 1=Pill box, 2=linear, 3=exponential, 4=Gaussian if positive, function is of radius, negative in u and v.
  • "xCells" OBIT_float scalar = Image cell spacing in X in asec.
  • "yCells" OBIT_float scalar = Image cell spacing in Y in asec.
  • "UVTaper" OBIT_float scalar = UV taper width in kilowavelengths. [def. no taper]. NB: If the taper is applied her is should not also be applied in the imaging step as the taper will be applied to the output data.
  • "Robust" OBIT_float scalar = Briggs robust parameter. [def. 0.0] < -7 -> Pure Uniform weight, >7 -> Pure natural weight. Uses AIPS rather than Briggs definition of Robust.
  • "WtPower" OBIT_float scalar = Power to raise weights to. [def = 1.0] Note: a power of 0.0 sets all the output weights to 1 as modified by uniform/Tapering weighting. Applied in determinng weights as well as after.
channel Which frequency channel to image, 0->all.
err Error stack, returns if not empty.

void ObitImageUtilPBApply ObitImage inImage,
ObitImage pntImage,
ObitImage outImage,
gint *  inPlane,
gint *  outPlane,
gfloat  antSize,
ObitErr err
 

Public: Multiply an image by the primary beam pattern of another.

For frequencies < 1 GHz uses the VLA polynomial gain curves, for higher frequencies, it uses a jinc function based on the antenna size.

Parameters:
inImage Image to be corrected
pntImage Image with pointing position
outImage Image to be written. Must be previously instantiated.
inPlane Desired plane in inImage, 1-rel pixel numbers on planes 3-7; ignored if memOnly
outPlane Desired plane in outImage; ignored if memOnly
antSize Antenna size
err Error stack, returns if not empty.

void ObitImageUtilPBCorr ObitImage inImage,
ObitImage pntImage,
ObitImage outImage,
gint *  inPlane,
gint *  outPlane,
gfloat  antSize,
ObitErr err
 

Public: Correct (divide) an image by the primary beam pattern of another.

For frequencies < 1 GHz uses the VLA polynomial gain curves, for higher frequencies, it uses a jinc function based on the antenna size.

Parameters:
inImage Image to be corrected
pntImage Image with pointing position
outImage Image to be written. Must be previously instantiated.
inPlane Desired plane in inImage, 1-rel pixel numbers on planes 3-7; ignored if memOnly
outPlane Desired plane in outImage; ignored if memOnly
antSize Antenna size, used to correct beam for freq>1 GHz, def. 25m.
err Error stack, returns if not empty.

void ObitImageUtilPBImage ObitImage pntImage,
ObitImage outImage,
gint *  outPlane,
gfloat  antSize,
gfloat  minGain,
ObitErr err
 

Public: Fill image with the primary beam pattern.

For frequencies < 1 GHz uses the VLA polynomial gain curves, for higher frequencies, it uses a jinc function based on the antenna size.

Parameters:
pntImage Image with pointing position
outImage Image to be written. Must be previously instantiated.
outPlane Desired plane in outImage on planes 3-5; ignored if memOnly
antSize Antenna size
minGain Min. allowed antenna gain, lower values are blanked
err Error stack, returns if not empty.

ObitImage* ObitImageUtilQuanFITS ObitImage inImage,
gchar *  fileName,
gint  disk,
ObitErr err
 

Public: Quantize an ObitImage and write to a FITS image.

Image RMS derived from histogram fitting and should be a reasonable estimate of the "noise". Selection by blc, trc in inImage is honored.

Parameters:
inImage Image to quantize, parameters in info:
  • "factor" OBIT_float (1,1,1) quantize at factor*RMS [def 0.2] RMS is the minimum rms in any selected plane.
  • "quant" OBIT_float (1,1,1) quantization level, has presidence over factor, def.(or <=0) use factor
fileName output FITS image file name
disk output FITS directory number
err Error stack, returns if not empty.
Returns:
pointer to the new object, may be NULL on failure.

void ObitImageUtilSelCopy ObitImage inImage,
ObitImage outImage,
ObitErr err
 

Public: Copy with selection by pixel increment.

Parameters:
inImage Input image Parameters in info:
  • "BLC" OBIT_int (7) Lowest x,y,v pixel number selected [def 1,1,1]
  • "TRC" OBIT_int (7) Highest x,y,v pixel number selected [def all]
  • "inc" OBIT_int (7) Pixel increment on each axis [def all 1]
outImage Image to be written. Must be previously instantiated.
err Error stack, returns if not empty.

void ObitImageUtilUV2ImageDesc ObitUVDesc UVDesc,
ObitImageDesc imageDesc,
gint  nchavg
 

Public: Convert an ObitUVDesc to an ObitImageDesc.

Needs any xshift an y shift filled into the image prior to call. Information about the first two axes other than the type an coordinate value need to be set separately. to get the final position correct.

Parameters:
UVDesc Input UV Descriptor.
imageDesc Output image Descriptor
nchavg How many uv channels to average per image channel. Ignored if uv data has multiple IFs.

void ObitImageUtilVel ObitImage inImage,
ObitImage outImage,
ObitErr err
 

Public: Flux weighted velocity image from Cube.

Input image is clipped to only significant pixels. Convolution of each plane by Parms[3] cells used to mask image

Parameters:
inImage Input velocity cube image Parameters in info:
  • "BLC" OBIT_int (7) Lowest x,y,v pixel number selected [def 1,1,1]
  • "TRC" OBIT_int (7) Highest x,y,v pixel number selected [def all] Note: the first two output axes will have an even number of pixels.
  • "Parms" OBIT_float (4) Parameters [0] min. RMS (convolved image) [1] min. fraction of peak [2] <0.5 => blank fill, else zero fill [3] Convolution size (0->5)
outImage Image to be written. Must be previously instantiated.
err Error stack, returns if not empty.


Generated on Fri Aug 31 22:13:06 2007 for Obit by  doxygen 1.3.9.1