VIMOS DRS Reference Manual  2.9.13
Functions
Images

Functions

VimosImage * imageArith (VimosImage *ima1, VimosImage *ima2, VimosOperator optype)
 
VimosImage * constArith (VimosImage *ima_in, double constant, VimosOperator optype)
 
int imageArithLocal (VimosImage *ima1, VimosImage *ima2, VimosOperator optype)
 
int constArithLocal (VimosImage *ima_in, double constant, VimosOperator optype)
 
VimosImage * VmFrAveFil (VimosImage *ima_in, int filtsizex, int filtsizey, int excludeCenter)
 
VimosImage * VmFrMedFil (VimosImage *ima_in, int filtsizex, int filtsizey, int excludeCenter)
 
VimosImage * VmFrFilter (VimosImage *image, int xSize, int ySize, FilterMethod method, int excludeCenter)
 
VimosImage * VmImNorm (VimosImage *ima_in, Method meth)
 
VimosImage * frComb (VimosImage **ima_list, int num, CombMethod combMethod, CombParameters *combParameter, int flag)
 
VimosImage * frCombSum (VimosImage **ima_list, int num)
 
VimosImage * frCombAverage (VimosImage **ima_list, int num)
 
VimosImage * frCombMedian (VimosImage **ima_list, int num, int flag)
 
VimosImage * frCombMinMaxReject (VimosImage **ima_list, int minrej, int maxrej, int num)
 
VimosImage * OLDfrCombMinMaxReject (VimosImage **ima_list, double minrej, double maxrej, int num)
 
VimosImage * frCombKSigma (VimosImage **ima_list, double dklow, double dkhigh, int num)
 
float imageMean (VimosImage *ima_in)
 
float imageMedian (VimosImage *ima_in)
 
float imageAverageDeviation (VimosImage *image, float level)
 
float imageSigma (VimosImage *image)
 
float imageMedSigma (VimosImage *image)
 
float imageMinimum (VimosImage *ima_in)
 
float imageMaximum (VimosImage *ima_in)
 
VimosDpoint * imageHistogram (VimosImage *ima_in, unsigned int nbins)
 
float imageMode (VimosImage *ima_in)
 
float sumPixelsInImage (VimosImage *ima_in, int x, int y, int nx, int ny)
 
float * collapse2Dto1D (VimosImage *ima_in, int x, int y, int nx, int ny, Direction collapse)
 
VimosPixel * finePosition (VimosImage *ima_in, VimosPixel *p_list, int npix, double r1, double r2, double r3)
 
VimosPixel * finePositionSimple (VimosImage *ima_in, VimosPixel *in_pixel, double r1)
 
VimosImage * imageShift (VimosImage *imageIn, float xshift, float yshift, int outXlen, int outYlen, float outVal)
 
char ** getFitsFileExtensionsNames (fitsfile *fptr, int *extNum)
 
VimosBool createFitsImage (char *filename, VimosImage *image, const char *category)
 

Detailed Description

The module provides the image datatype and the fundamental operations.

Function Documentation

float* collapse2Dto1D ( VimosImage *  ima_in,
int  x,
int  y,
int  nx,
int  ny,
Direction  collapse 
)

Collapse a rectangle inside an image into one column/row.

Returns
the collapsed array
Parameters
ima_ininput image
xx lower left corner of the rectangle
yy lower left corner of the rectangle
nxnumber of pixels in x
nynumber of pixels in y
collapsedirection of collape: ROW or COLUMNS

collapse a rectangle inside an image into one column. Compute the sum of the rows or of the columns of a rectangle. Input an Image, the lower left corner coordinates (x,y) of the rectangle; the number of pixels (nx, ny) from (x,y), and the collapsing direction: collapse ROW: sum of rows and collapse COLUMN: sum of columns.

Author
P. Sartoretti , C. Izzo
VimosImage* constArith ( VimosImage *  ima_in,
double  constant,
VimosOperator  optype 
)

Arithmetic operations between an image and a constant. Result is a new image.

Returns
Pointer to the resulting image
Parameters
ima_inpointer to image
constantconstant
optypeoperation type

Arithmetic operations between an image and a constant. The result is a new image. The aritmetic operations are VM_OPER_ADD, VM_OPER_SUB, VM_OPER_MUL, VM_OPER_DIV

Author
P. Sartoretti
int constArithLocal ( VimosImage *  ima_in,
double  constant,
VimosOperator  optype 
)

Arithmetic operations between an image and a constant. Result is stored in the input image.

Returns
0 on success 1 on failure
Parameters
ima_inpointer to image
constantconstant
optypeoperation type

Arithmetic operations between an image and a constant. The result is stored in the input image. The aritmetic operations are VM_OPER_ADD, VM_OPER_SUB, VM_OPER_MUL, VM_OPER_DIV

Author
P. Sartoretti
VimosBool createFitsImage ( char *  filename,
VimosImage *  image,
const char *  category 
)

Write a VimosImage into a disk FITS file

Returns
VM_TRUE or VM_FALSE.
Parameters
filenamename of the fitsfile
imageVimos Image to be written as a FITS file
categoryCategory of image to write

Create a disk image FITS file from structure VimosImage

Author
C. Izzo
VimosPixel* finePosition ( VimosImage *  ima_in,
VimosPixel *  p_list,
int  npix,
double  r1,
double  r2,
double  r3 
)

Refine the peak centers by computing the baricenter.

Returns
the list of corrected positions
Parameters
ima_ininput image
p_listlist of pixel position to refine
npixsize of p_list array
r1defines a disk in which the barycenter will be computed
r2inner radius of the ring where the background is computed
r3outer radius of the ring where the background is computed

Refine the peak centers, by computing a barycenter The 3 doubles (r1, r2, r3) define 3 circle radiuses: r2 and r3 define a ring centered on each pixel in the list, around which the background will be estimated. r1 defines a disk in which the barycenter will be computed, i.e. the centroid pixel, weighted by pixel values, from which the background value has been subtracted: x_center = (1/sum(pixel[i]-bg))*(sum(x[i] * (pixel[i]-bg))) y_center = (1/sum(pixel[i]-bg))*(sum(y[i] * (pixel[i]-bg)))

Author
P. Sartoretti. Algorithm (fine_position_centers) taken from Eclipse (N.Devillard)
VimosPixel* finePositionSimple ( VimosImage *  ima_in,
VimosPixel *  in_pixel,
double  r1 
)

Refine a peak center by computing the baricenter.

Returns
the peak corrected positions or NULL if the peak is not found.
Parameters
ima_ininput image
in_pixelexpected position of the peak
r1defines a square around expected position where to look for the peak

Refine a single peak centers, by computing a barycenter. Define a squared region of the image of dimension r1 around expected position and compute baricenter (for baricenter determination see doc of "findPeak2D")

Author
P. Sartoretti and C.Izzo
VimosImage* frComb ( VimosImage **  ima_list,
int  num,
CombMethod  combMethod,
CombParameters *  combParameter,
int  flag 
)

Combine a list of images.

Returns
Pointer to the resulting image
Parameters
ima_listPointer to the array of images to combine
numNumber of images to combine
combMethodCombination method
combParameterUsed just when combination the method requires extra parameters, as in COMB_REJECT or COMB_KSIGMA.
flagReject or not -32000 values in input

Combine a list of images according to the method. Possible methods are COMB_KSIGMA, COMB_MEDIAN, COMB_AVERAGE, COMB_SUM, COMB_REJECT, and AUTO. AUTO automatically selects the combination method based on the number of frames

Author
P. Sartoretti, C.Izzo
VimosImage* frCombAverage ( VimosImage **  ima_list,
int  num 
)

Compute average image of a list of images.

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
numnumber of images

Average a list of images. Result is a newly allocated image.

Author
P. Sartoretti
VimosImage* frCombKSigma ( VimosImage **  ima_list,
double  dklow,
double  dkhigh,
int  num 
)

Combine a list of images with rejection of pixels outside a K*sigma threshold (sigma-clipping)

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
klownumber of sigma for low values sigma-clipping
khighnumber of sigma for high values sigma-clipping
numnumber of images

Combine frame with rejection of pixels outside a k*sigma treshold. The threshold is calculated on the median value, and not on the average to limit the influence of bad pixels. Input a list of images; klow to set the low treshold (=median-klow*sigma), and khigh to set the high treshold (=median+khigh*sigma). Result is a newly allocated image.

Author
P. Sartoretti
VimosImage* frCombMedian ( VimosImage **  ima_list,
int  num,
int  flag 
)

Compute median image of a list of images.

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
numnumber of images

Compute median image of a list of images. Result is a newly allocated image.

Author
P. Sartoretti
VimosImage* frCombMinMaxReject ( VimosImage **  ima_list,
int  minrej,
int  maxrej,
int  num 
)

Combine images with rejection of highest/lowest pixels values.

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
minrejnumber of pixels to min-reject
maxrejnumber of pixels to max-reject
numnumber of images

A zero value for both minrej and maxrej is illegal, and in that case a NULL pointer is returned. If the total number of pixels to be rejected is greater then or equal to the number of input images, nothing is done and a NULL pointer is returned.

Author
P.Sartoretti, C.Izzo
VimosImage* frCombSum ( VimosImage **  ima_list,
int  num 
)

Sum a list of images.

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
numnumber of images

Sum a list of images. Result is a newly allocated image.

Author
P. Sartoretti
char** getFitsFileExtensionsNames ( fitsfile *  fptr,
int *  extNum 
)

Get the list of

Returns
list of extension names.
Parameters
fptrpointer to fitsfile
extNumpointer to extension number

Create a list of extension names of a FITS file

Author
C. Izzo
VimosImage* imageArith ( VimosImage *  ima1,
VimosImage *  ima2,
VimosOperator  optype 
)

Arithmetic operations between 2 images. Result is a new image.

Returns
Pointer to the resulting image
Parameters
ima1pointer to first image
ima2pointer to second image
optypeoperation type

Arithmetic operations between 2 images. The 2 images must have the same dimensions. The output is 1 newly allocated image. The aritmetic operations are VM_OPER_ADD, VM_OPER_SUB, VM_OPER_MUL, VM_OPER_DIV

Author
P. Sartoretti
int imageArithLocal ( VimosImage *  ima1,
VimosImage *  ima2,
VimosOperator  optype 
)

Arithmetic operations between 2 images. Result is stored in the first image.

Returns
0 on success 1 on failure
Parameters
ima1pointer to first image
ima2pointer to second image
optypeoperation type

Arithmetic operations between 2 images. The 2 images must have the same dimensions. The output is stored in the first image. The aritmetic operations are VM_OPER_ADD, VM_OPER_SUB, VM_OPER_MUL, VM_OPER_DIV

Author
P. Sartoretti
float imageAverageDeviation ( VimosImage *  image,
float  level 
)

Compute average deviation from any given value

Returns
average deviation
Parameters
imageinput image
levelreference value

Compute average deviation from any given value

Author
C. Izzo
VimosDpoint* imageHistogram ( VimosImage *  ima_in,
unsigned int  nbins 
)

Compute image histogram

Returns
the histogram
Parameters
ima_ininput image
nbinsnumber of bins for the histogram

Compute an image histogram. Input one image and the number of bins for the histogram. Output a list of [nbins] VimosDpoints, where x contains the central pixelvalue for each bin, and y contains the number of pixels in this bin.

Author
P. Sartoretti. This algorithm is taken from Eclipse (N.Devillard)
float imageMaximum ( VimosImage *  ima_in)

Compute image maximum value of an image

Returns
the maximum value
Parameters
ima_ininput image

Compute the maximum value of an image

Author
P. Sartoretti
float imageMean ( VimosImage *  ima_in)

Compute the average value of an image

Returns
the average value, or 0 in case of failure
Parameters
ima_ininput image

Compute the average value of an image

Author
P. Sartoretti
float imageMedian ( VimosImage *  ima_in)

Compute the median value of an image

Returns
the median value, or 0 in case of failure
Parameters
ima_ininput image

Compute the median value of an image. Use median-wirth.

Author
P. Sartoretti
float imageMedSigma ( VimosImage *  image)

Compute image sigma using median value instead of mean estimate

Returns
the sigma value
Parameters
imageinput image

Compute the sigma value of an image using the median value instead of the mean

Author
P. Sartoretti
float imageMinimum ( VimosImage *  ima_in)

Compute image minimum value of an image

Returns
the maximum value
Parameters
ima_ininput image

Compute the minimum value of an image

Author
P. Sartoretti
float imageMode ( VimosImage *  ima_in)

Compute image mode value of an image

Returns
the mode, or -1 in case of failure
Parameters
ima_ininput image

Compute the mode value of an image (i.e. the histo peak position) It depends on the number of bins (binzise). Here take the bin size = 1 data unit (i.e. bin number =(int) max - min)

Author
P. Sartoretti
VimosImage* imageShift ( VimosImage *  imageIn,
float  xshift,
float  yshift,
int  outXlen,
int  outYlen,
float  outVal 
)

Shift an image in X and/or Y

Returns
Pointer to the resulting image
Parameters
imageInpointer to input image
xshiftshift in X coordinate
yshiftshift in Y coordinate
outValsubstitution value

Image shifting. The output is 1 newly allocated image.

Author
P. Franzetti
float imageSigma ( VimosImage *  image)

Compute image sigma

Returns
the sigma value,
Parameters
imageinput image

Compute the sigma value of an image

Author
P. Sartoretti
VimosImage* OLDfrCombMinMaxReject ( VimosImage **  ima_list,
double  minrej,
double  maxrej,
int  num 
)

Combine images with rejection of high/low pixels values.

Returns
Pointer to the resulting image
Parameters
ima_listpointer to the array of images to combine
minrejpercent of pixels to min-reject
maxrejpercent of pixels to max-reject
numnumber of images

Percentages are expressed with numbers from 0 to 100. If the percent of pixels to max or min reject is less then the min percentage step (i.e. 100/num), no image will be min or max rejected. Not more than 90 percent of pixel values can be rejected: if such threshold is trespassed, a NULL pointer is returned.

Author
P. Sartoretti
float sumPixelsInImage ( VimosImage *  ima_in,
int  x,
int  y,
int  nx,
int  ny 
)

Compute the sum of all pixelvalues in a rectangle.

Returns
the sum, or -1 in case of failure
Parameters
ima_ininput image
xx lower left corner of the rectangle
yy lower left corner of the rectangle
nxnumber of pixels in x
nynumber of pixels in y

Compute the sum of all pixelvalues in a rectangle. The rectangle is given by the lower left corner coordinates (x,y) and the number of pixels nx and ny.

Author
P. Sartoretti
VimosImage* VmFrAveFil ( VimosImage *  ima_in,
int  filtsizex,
int  filtsizey,
int  excludeCenter 
)

Apply a average filter to an image.

Returns
Pointer to the resulting image
Parameters
ima_inpointer to input image
filtsizexsize in x of the filter box
filtsizeysize in y of the filter box
excludeCenterflag to exclude the center of the box in the computation of the average

Apply an optimized average filter of sizes filtsizex, filtsixey to an image. The output is a newly allocated image. Set excludeCenter flag to 1 to exclude the center of the median kernel from the median computation. If the median kernel extends over the image edges, the boundary points are repeated such that the box has always the same size (this is a modification compared to the original algorithm).

Author
C.Izzo. The original algorithm is taken from Eclipse (N.Devillard)
VimosImage* VmFrFilter ( VimosImage *  image,
int  xSize,
int  ySize,
FilterMethod  method,
int  excludeCenter 
)

Filter an image.

Returns
Pointer to the resulting image
Parameters
imagepointer to input image
xSizesize in x of the filter box
ySizesize in y of the filter box
methodfilter method
excludecenterflag to exclude the center of the box in the computation of the median

Apply a filter of choice to an image. Available method are median, average, gaussian filter. An automatic method can be specified.

See Also
VmFrMedFil, VmFrAveFil
Author
C.Izzo and P.Sartoretti
VimosImage* VmFrMedFil ( VimosImage *  ima_in,
int  filtsizex,
int  filtsizey,
int  excludeCenter 
)

Apply a median filter to an image.

Returns
Pointer to the resulting image
Parameters
ima_inpointer to input image
filtsizexsize in x of the filter box
filtsizeysize in y of the filter box
excludecenterflag to exclude the center of the box in the computation of the median

Apply an optimized median filter of sizes filtsizex, filtsixey to an image. The output is a newly allocated image. Set excludeCenter flag to 1 to exclude the center of the median kernel from the median computation. If the median kernel extends over the image edges, the boundary points are repeated such that the box has always the same size (this is a modification compared to the original algorithm).

Author
P. Sartoretti, C.Izzo. Algorithm taken from Eclipse (N.Devillard)
VimosImage* VmImNorm ( VimosImage *  ima_in,
Method  meth 
)

Normalize an image.

Returns
Pointer to the resulting image
Parameters
ima_inpointer to input image
methnormalization method

Normalize an image. Possible normalization methods are: MEAN normalize image to its mean value, MEDIAN: normalize image to its median value, and MODE: normalize image to its mode. The output is a newly allocated image.

Author
P. Sartoretti