Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Image


Files

file  psImageGeomManip.h
 Contains basic image geometry manipulation operations, as specified in the PSLIB SDRS sections "Image Geometry Manipulations".
file  psImagePixelExtract.h
 Contains basic image extraction operations, as specified in the PSLIB SDRS sections "Image Pixel Extractions".
file  psImagePixelManip.h
 Contains basic image pixel manipulation operations, as specified in the PSLIB SDRS sections "Image Pixel Manipulations".
file  psImageStructManip.h
 Contains basic image structure manipulation operations, as specified in the PSLIB SDRS sections "Image Structure Manipulation".
file  psImage.h
 Contains basic image definitions and operations.
file  psPixels.h
 Contains psPixel related functions.

Data Structures

struct  psImage
 Basic image data structure. More...
struct  psRegion
 Basic image region structure. More...
struct  psPixelCoord
 Data structure for storing psPixel coordinates. More...
struct  psPixels
 list of pixel coordinates More...

Defines

#define PIXEL_INTERPOLATE_FCN_PROTOTYPE(SUFFIX, RETURNTYPE)
#define PIXEL_INTERPOLATE_FCNS(MODE)

Typedefs

typedef psImage psImage
 Basic image data structure.

Enumerations

enum  psImageCutDirection { PS_CUT_X_POS, PS_CUT_X_NEG, PS_CUT_Y_POS, PS_CUT_Y_NEG }
enum  psImageInterpolateMode { PS_INTERPOLATE_FLAT, PS_INTERPOLATE_BILINEAR, PS_INTERPOLATE_LANCZOS2, PS_INTERPOLATE_LANCZOS3, PS_INTERPOLATE_LANCZOS4, PS_INTERPOLATE_BILINEAR_VARIANCE, PS_INTERPOLATE_LANCZOS2_VARIANCE, PS_INTERPOLATE_LANCZOS3_VARIANCE, PS_INTERPOLATE_LANCZOS4_VARIANCE }
 enumeration of options in interpolation More...

Functions

psImagepsImageRebin (psImage *out, const psImage *in, const psImage *mask, psMaskType maskVal, int scale, const psStats *stats)
 Rebin image to new scale.
psImagepsImageResample (psImage *out, const psImage *in, int scale, psImageInterpolateMode mode)
 Resample image to new scale.
psImagepsImageRotate (psImage *out, const psImage *input, float angle, complex exposed, psImageInterpolateMode mode)
 Rotate the input image by given angle, specified in degrees.
psImagepsImageShift (psImage *out, const psImage *input, float dx, float dy, complex exposed, psImageInterpolateMode mode)
 Shift image by an arbitrary number of pixels (dx,dy) in either direction.
psImagepsImageRoll (psImage *out, const psImage *input, int dx, int dy)
 Roll image by an integer number of pixels in either direction.
psImagepsImageTransform (psImage *output, psArray *blankPixels, const psImage *input, const psImage *inputMask, psMaskType inputMaskVal, const psPlaneTransform *outToIn, psRegion region, const psPixels *pixels, psImageInterpolateMode mode, double exposedValue)
 Transform the input image according the supplied transformation.
psVectorpsImageSlice (psVector *out, psVector *coords, const psImage *input, const psImage *mask, psMaskType maskVal, psRegion region, psImageCutDirection direction, const psStats *stats)
 Extract pixels from rectlinear region to a vector (array of floats).
psVectorpsImageCut (psVector *out, psVector *cutCols, psVector *cutRows, const psImage *input, const psImage *mask, psMaskType maskVal, psRegion region, unsigned int nSamples, psImageInterpolateMode mode)
 Extract pixels from an image along a line to a vector (array of floats).
psVectorpsImageRadialCut (psVector *out, const psImage *input, const psImage *mask, psMaskType maskVal, float x, float y, const psVector *radii, const psStats *stats)
 Extract radial region data to a vector.
int psImageClip (psImage *input, double min, double vmin, double max, double vmax)
 Clip image values outside of range to given values.
int psImageClipComplexRegion (psImage *input, complex min, complex vmin, complex max, complex vmax)
 Clip image values outside of a specified complex region.
int psImageClipNaN (psImage *input, float value)
 Clip NaN image pixels to given value.
int psImageOverlaySection (psImage *image, const psImage *overlay, int x0, int y0, const char *op)
 Overlay subregion of image with another image.
void psImageMaskRegion (psImage *image, psRegion *region, const char *op, psMaskType maskValue)
 Sets the bits inside the region, ignoring pixels outside.
void psImageKeepRegion (psImage *image, psRegion *region, const char *op, psMaskType maskValue)
 Sets the bits outside the region, ignoring pixels inside.
void psImageMaskCircle (psImage *image, double x, double y, double radius, const char *op, psMaskType maskValue)
 Sets the bits inside the circle, ignoring the pixels outside.
void psImageKeepCircle (psImage *image, double x, double y, double radius, const char *op, psMaskType maskValue)
 Sets the bits outside the circle, ignoring the pixels inside.
psImagepsImageSubset (psImage *image, psRegion region)
 Create a subimage of the specified area.
psImagepsImageCopy (psImage *output, const psImage *input, psElemType type)
 Makes a copy of a psImage.
psImagepsImageTrim (psImage *image, psRegion region)
 Trim an image.
psImagepsImageAlloc (int numCols, int numRows, psElemType type)
 Create an image of the specified size and type.
bool psMemCheckImage (psPtr ptr)
 Checks the type of a particular pointer.
psRegion psRegionSet (float x0, float x1, float y0, float y1)
 Create a psRegion with the specified attributes.
psRegion psRegionFromString (const char *region)
 Create a psRegion with the attribute values given as a string.
psString psRegionToString (const psRegion region)
 Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.
psRegion psRegionForImage (psImage *image, psRegion *in)
 Sets an actual region based on image parameters.
psRegion psRegionForSquare (double x, double y, double radius)
 Defines a region corresponding to the square with center at coordinate x,y and with coderadius.
bool psImageInit (psImage *image,...)
 Initializes the image with the given value.
psImagepsImageRecycle (psImage *old, int numCols, int numRows, const psElemType type)
 Resize a given image to the given size/type.
bool p_psImageCopyToRawBuffer (void *buffer, const psImage *input, psElemType type)
 Copy an image to a new buffer.
int psImageFreeChildren (psImage *image)
 Frees all children of a psImage.
psF64 p_psImageGetElementF64 (psImage *image, int col, int row)
 get an element of an image as a psF64.
bool p_psImagePrint (int fd, psImage *a, char *name)
 print image pixel values.
complex psImagePixelInterpolate (const psImage *input, float x, float y, const psImage *mask, psMaskType maskVal, complex unexposedValue, psImageInterpolateMode mode)
 Interpolate image pixel value given floating point coordinates.
psPixelspsPixelsAlloc (long nalloc)
 Allocates a new psPixels structure.
bool psMemCheckPixels (psPtr ptr)
 Checks the type of a particular pointer.
psPixelspsPixelsRealloc (psPixels *pixels, long nalloc)
 resizes a psPixels structure
psPixelsp_psPixelsAppend (psPixels *pixels, long growth, int x, int y)
 Add a pixel location to a psPixels.
psPixelspsPixelsCopy (psPixels *out, const psPixels *pixels)
 Copies a psPixels object.
psImagepsPixelsToMask (psImage *out, const psPixels *pixels, psRegion region, psMaskType maskVal)
 Generate a psImage from a psPixels.
psPixelspsPixelsFromMask (psPixels *out, const psImage *mask, psMaskType maskVal)
 Generate a psPixels from a mask psImage.
psPixelspsPixelsConcatenate (psPixels *out, const psPixels *pixels)
 Concatenates two psPixels.
bool p_psPixelsPrint (FILE *fd, psPixels *pixels, const char *name)
 Prints a psPixels to specified destination.


Define Documentation

#define PIXEL_INTERPOLATE_FCN_PROTOTYPE SUFFIX,
RETURNTYPE   ) 
 

Value:

inline RETURNTYPE p_psImagePixelInterpolate##SUFFIX( \
        const psImage* input,          /**< input image for interpolation */ \
        float x,                       /**< column location to derive value of */ \
        float y,                       /**< row location ot derive value of */ \
        const psImage* mask,           /**< if not NULL, the mask of the input image */ \
        psU32 maskVal,                 /**< the mask value */ \
        RETURNTYPE unexposedValue      /**< return value if x,y location is not in image. */ \
                                                   );

Definition at line 261 of file psImage.h.

#define PIXEL_INTERPOLATE_FCNS MODE   ) 
 

Value:

Definition at line 271 of file psImage.h.


Typedef Documentation

typedef struct psImage psImage
 

Basic image data structure.

Struct for maintaining image data of varying types. It also contains information about image size, parent images and children images.


Enumeration Type Documentation

enum psImageCutDirection
 

Enumeration values:
PS_CUT_X_POS  Cut in the x dimension from left to right.
PS_CUT_X_NEG  Cut in the x dimension from rigth to left.
PS_CUT_Y_POS  Cut in the y dimension from bottom up.
PS_CUT_Y_NEG  Cut in the y dimension from top down.

Definition at line 28 of file psImagePixelExtract.h.

enum psImageInterpolateMode
 

enumeration of options in interpolation

Enumeration values:
PS_INTERPOLATE_FLAT  'flat' interpolation (nearest pixel)
PS_INTERPOLATE_BILINEAR  bi-linear interpolation
PS_INTERPOLATE_LANCZOS2  Sinc interpolation with 4x4 pixel kernel.
PS_INTERPOLATE_LANCZOS3  Sinc interpolation with 6x6 pixel kernel.
PS_INTERPOLATE_LANCZOS4  Sinc interpolation with 8x8 pixel kernel.
PS_INTERPOLATE_BILINEAR_VARIANCE  Variance version of PS_INTERPOLATE_BILINEAR.
PS_INTERPOLATE_LANCZOS2_VARIANCE  Variance version of PS_INTERPOLATE_LANCZOS2.
PS_INTERPOLATE_LANCZOS3_VARIANCE  Variance version of PS_INTERPOLATE_LANCZOS3.
PS_INTERPOLATE_LANCZOS4_VARIANCE  Variance version of PS_INTERPOLATE_LANCZOS4.

Definition at line 33 of file psImage.h.


Function Documentation

bool p_psImageCopyToRawBuffer void *  buffer,
const psImage input,
psElemType  type
 

Copy an image to a new buffer.

Returns:
True if image copied or false if error
Parameters:
buffer  the buffer used to copy the image
input  the input image to be copied
type  the datatype of the image to be copied

psF64 p_psImageGetElementF64 psImage image,
int  col,
int  row
 

get an element of an image as a psF64.

Returns:
psF64 pixel value at specified location
Parameters:
image  input image
col  pixel column
row  pixel row

bool p_psImagePrint int  fd,
psImage a,
char *  name
 

print image pixel values.

Returns:
bool TRUE is successful, otherwise FALSE.
Parameters:
fd  Destination file descriptor
a  image to print
name  name of the image (for title)

psPixels* p_psPixelsAppend psPixels pixels,
long  growth,
int  x,
int  y
 

Add a pixel location to a psPixels.

Returns:
psPixels* psPixels with the value appended.
Parameters:
pixels  psPixels to append new coordinate to. NULL creates a new one.
growth  number of elements to grow the psPixels list, if necessary. if growth < 1, 10 is used.
x  x coordinate to append
y  y coordinate to append

bool p_psPixelsPrint FILE *  fd,
psPixels pixels,
const char *  name
 

Prints a psPixels to specified destination.

Returns:
bool: True if successful.
Parameters:
fd  destination file descriptor
pixels  psPixels to print
name  printf-style format of header line

psImage* psImageAlloc int  numCols,
int  numRows,
psElemType  type
 

Create an image of the specified size and type.

Uses psLib memory allocation functions to create an image struct of the specified size and type.

Returns:
psImage* : Pointer to psImage.
Parameters:
numCols  Number of rows in image.
numRows  Number of columns in image.
type  Type of data for image.

int psImageClip psImage input,
double  min,
double  vmin,
double  max,
double  vmax
 

Clip image values outside of range to given values.

All pixels with values less than min are set to the value vmin. all pixels with values greater than max are set to the value vmax. This function is defined for psU8, psU16, psS8, psS16, psF32, psF64, psC32, and psC64.

Returns:
int The number of clipped pixels
Parameters:
input  the image to clip
min  the minimum image value allowed
vmin  the value pixels < min are set to
max  the maximum image value allowed
vmax  the value pixels > max are set to

int psImageClipComplexRegion psImage input,
complex  min,
complex  vmin,
complex  max,
complex  vmax
 

Clip image values outside of a specified complex region.

All pixels outside of the rectangular region in complex space formed by the min and max input parameters are set to the value vmax (if either the real or imaginary portion exceeds the respective max values), or vmin. This function is defined for psC32, and psC64 imagery only.

Returns:
int The number of clipped pixels
Parameters:
input  the image to clip
min  the minimum image value allowed
vmin  the value pixels < min are set to
max  the maximum image value allowed
vmax  the value pixels > max are set to

int psImageClipNaN psImage input,
float  value
 

Clip NaN image pixels to given value.

Pixels with NaN, +Inf, or -Inf values are set to the specified value. This function is defined for psF32, psF64, psC32, and psC64.

Returns:
int The number of clipped pixels
Parameters:
input  the image to clip
value  the value to set all NaN/Inf values to

psImage* psImageCopy psImage output,
const psImage input,
psElemType  type
 

Makes a copy of a psImage.

Returns:
psImage* Copy of the input psImage. This may not be equal to the output parameter
Parameters:
output  if not NULL, a psImage that could be recycled.
input  the psImage to copy
type  the desired datatype of the returned copy

psVector* psImageCut psVector out,
psVector cutCols,
psVector cutRows,
const psImage input,
const psImage mask,
psMaskType  maskVal,
psRegion  region,
unsigned int  nSamples,
psImageInterpolateMode  mode
 

Extract pixels from an image along a line to a vector (array of floats).

The vector (xs,ys) - (xe,ye) forms the basis of the output vector. Pixels are considered in a rectangular region of width dw about this vector. The input region is collapsed in the perpendicular direction, and each element of the output vector represents pixel-sized boxes, where the value is derived from the statistics of the pixels interpolated along the perpendicular direction. The specific algorithm which must be used is described in the PSLib ADD (PSDC-430-006). The statistic used to derive the output vector value is specified by stats. Only one of the statistics choices may be specified, otherwise the function must return an error. This function must be defined for the following types: psS8, psU16, psF32, psF64.

Returns:
psVector* resulting vector
Parameters:
out  psVector to recycle, or NULL.
cutCols  if not NULL, the calculated column values along the slice (output)
cutRows  if not NULL, the calculated row values along the slice (output)
input  the input image in which to perform the cut
mask  the mask for the input image.
maskVal  the mask value to apply to the mask
region  the start and end points to cut along
nSamples  the number of samples along the cut
mode  the interpolation method to use

int psImageFreeChildren psImage image  ) 
 

Frees all children of a psImage.

Returns:
int Number of children freed.
Parameters:
image  psImage in which all children shall be deallocated

bool psImageInit psImage image,
  ...
 

Initializes the image with the given value.

The input data is cast to match the image datatype.

Returns:
bool: True on success, otherwise false.
Parameters:
image  the image to be initialized

void psImageKeepCircle psImage image,
double  x,
double  y,
double  radius,
const char *  op,
psMaskType  maskValue
 

Sets the bits outside the circle, ignoring the pixels inside.

The pixel values are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.

Parameters:
image  the image to set
x  the x coordinate of the circle's center
y  the y coordinate of the circle's center
radius  the radius of the specified circle
op  the logical operation
maskValue  the specified bits

void psImageKeepRegion psImage image,
psRegion region,
const char *  op,
psMaskType  maskValue
 

Sets the bits outside the region, ignoring pixels inside.

The pixels are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.

Parameters:
image  the image to set
region  the specified region
op  the logical operation
maskValue  the specified bits

void psImageMaskCircle psImage image,
double  x,
double  y,
double  radius,
const char *  op,
psMaskType  maskValue
 

Sets the bits inside the circle, ignoring the pixels outside.

The pixel values are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.

Parameters:
image  the image to set
x  the x coordinate of the circle's center
y  the y coordinate of the circle's center
radius  the radius of the specified circle
op  the logical operation
maskValue  the specified bits

void psImageMaskRegion psImage image,
psRegion region,
const char *  op,
psMaskType  maskValue
 

Sets the bits inside the region, ignoring pixels outside.

The pixels are set by combining the existing pixel value and the given maskValue with a logical operation. The allowed operations are =, AND, OR, and XOR.

Parameters:
image  the image to set
region  the specified region
op  the logical operation
maskValue  the specified bits

int psImageOverlaySection psImage image,
const psImage overlay,
int  x0,
int  y0,
const char *  op
 

Overlay subregion of image with another image.

Replace the pixels in the image which correspond to the pixels in OVERLAY with values derived from the IMAGE and OVERLAY based on the given operator OP. Valid operators are "=" (set image value to OVERLAY value), "+" (add OVERLAY value to image value), "-" (subtract OVERLAY from image), "*" (multiply OVERLAY times image), "/" (divide image by OVERLAY). This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.

Returns:
int 0 if success, non-zero if failed.
Parameters:
image  target image
overlay  the overlay image
x0  the column to start overlay
y0  the row to start overlay
op  the operation to perform for overlay

complex psImagePixelInterpolate const psImage input,
float  x,
float  y,
const psImage mask,
psMaskType  maskVal,
complex  unexposedValue,
psImageInterpolateMode  mode
 

Interpolate image pixel value given floating point coordinates.

Returns:
psF32 Pixel value interpolated from image or unexposedValue if given x,y doesn't coorespond to a valid image location
Parameters:
input  input image for interpolation
x  column location to derive value of
y  row location ot derive value of
mask  if not NULL, the mask of the input image
maskVal  the mask value
unexposedValue  return value if x,y location is not in image.
mode  interpolation mode

psVector* psImageRadialCut psVector out,
const psImage input,
const psImage mask,
psMaskType  maskVal,
float  x,
float  y,
const psVector radii,
const psStats stats
 

Extract radial region data to a vector.

A vector is constructed where each vector elements is derived from the statistics of the pixels which land within one of a sequence of radii. The radii are centered on the image pixel coordinate x,y, and are defined by the sequence of values in the vector radii. The specific algorithm which must be used is described in the PSLib ADD (PSDC-430-006). The statistic used to derive the output vector value is specified by stats. Only one of the statistics choices may be specified, otherwise the function must return an error. This function must be defined for the following types: psS8, psU16, psF32, psF64.

Returns:
psVector resulting vector
Parameters:
out  psVector to recycle, or NULL.
input  the input image in which to perform the cut
mask  the mask for the input image.
maskVal  the mask value to apply to the mask
x  the column of the center of the cut circle
y  the row of the center of the cut circle
radii  the radii of the cut circle
stats  the statistic to perform in operation

psImage* psImageRebin psImage out,
const psImage in,
const psImage mask,
psMaskType  maskVal,
int  scale,
const psStats stats
 

Rebin image to new scale.

A new image is constructed in which the dimensions are reduced by a factor of 1/scale. The scale, always a positive number, is equal in each dimension and specified the number of pixels used to define a new pixel in the output image. The output image is generated from all input image pixels. This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.

Returns:
psImage new image formed by rebinning input image.
Parameters:
out  an psImage to recycle. If NULL, a new image is created
in  input image
mask  mask for input image. If NULL, no masking is done.
maskVal  the bits to check in mask.
scale  the scale to rebin for each dimension
stats  the statistic to perform when rebinning. Only one method should be set.

psImage* psImageRecycle psImage old,
int  numCols,
int  numRows,
const psElemType  type
 

Resize a given image to the given size/type.

Returns:
psImage* Resized psImage.
Parameters:
old  the psImage to recycle by resizing image buffer
numCols  the desired number of columns in image
numRows  the desired number of rows in image
type  the desired datatype of the image

psImage* psImageResample psImage out,
const psImage in,
int  scale,
psImageInterpolateMode  mode
 

Resample image to new scale.

A new image is constructed in which the dimensions are increased by a factor of scale. The scale, always a positive number, is equal in each dimension. The output image is generated from all input image pixels. Each pixel in the output image is derived by interpolating between neighboring pixels using the specified interpolation method (mode).

Returns:
psImage* resampled image result
Parameters:
out  an psImage to recycle. If NULL, a new image is created
in  input image
scale  resample scaling factor
mode  the interpolation mode used in resampling

psImage* psImageRoll psImage out,
const psImage input,
int  dx,
int  dy
 

Roll image by an integer number of pixels in either direction.

The output image is the same dimensions as the input image. Edge pixels wrap to the other side (no values are lost). This function is defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.

Returns:
psImage* the rolled version of the input image.
Parameters:
out  an psImage to recycle. If NULL, a new image is created
input  input image
dx  number of pixels to roll in the x-dimension
dy  number of pixels to roll in the y-dimension

psImage* psImageRotate psImage out,
const psImage input,
float  angle,
complex  exposed,
psImageInterpolateMode  mode
 

Rotate the input image by given angle, specified in degrees.

The output image must contain all of the pixels from the input image in their new frame. Pixels in the output image which do not map to input pixels should be set to exposed. The center of rotation is always the center pixel of the image. The rotation is specified in the sense that a positive angle is an anti-clockwise rotation. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.

Returns:
psImage* the rotated image result.
Parameters:
out  an psImage to recycle. If NULL, a new image is created
input  input image
angle  the rotation angle in radians.
exposed  the output image pixel values for non-imagery areas
mode  the interpolation mode used

psImage* psImageShift psImage out,
const psImage input,
float  dx,
float  dy,
complex  exposed,
psImageInterpolateMode  mode
 

Shift image by an arbitrary number of pixels (dx,dy) in either direction.

If the shift values are fractional, the output pixel values should interpolate between the input pixel values. The output image has the same dimensions as the input image. Pixels which fall off the edge of the output image are lost. Newly exposed pixels are set to the value given by exposed. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.

Returns:
psImage* the shifted image result.
Parameters:
out  an psImage to recycle. If NULL, a new image is created
input  input image
dx  the shift in x direction.
dy  the shift in y direction.
exposed  the output image pixel values for non-imagery areas
mode  the interpolation mode to use

psVector* psImageSlice psVector out,
psVector coords,
const psImage input,
const psImage mask,
psMaskType  maskVal,
psRegion  region,
psImageCutDirection  direction,
const psStats stats
 

Extract pixels from rectlinear region to a vector (array of floats).

The output vector contains either col1-col0 or row1-row0 elements, based on the value of the direction: e.g., if direction is PS_CUT_X_POS, there are col1-col0 elements. The region to be sliced is defined by the lower-left corner, (col0,row0), and the upper-right corner, (col1,row1). Note that the row and column of the upper right-hand corner are NOT included in the region. In the event that col1 or row1 are negative, they shall be interpreted as being relative to the size of the parent image in that dimension. The input region is collapsed in the direction perpendicular to that specified by direction, and each element of the output vectors is derived from the statistics of the pixels at that direction coordinate. The statistic used to derive the output vector value is specified by stats. If mask is non-NULL, pixels for which the corresponding mask pixel matches maskVal are excluded from operations. If coords is not NULL, the calculated coordinates along the slice are returned in this vector. Only one of the statistics choices may be specified, otherwise the function must return an error.

This function is defined for the following types: psS8, psU16, psF32, psF64.

Returns:
psVector the resulting vector
Parameters:
out  psVector to recycle, or NULL.
coords  If not NULL, it is populated with the coordinate in the slice dimension coorsponding to the output vector's value of the same position in the vector. This vector maybe resized and retyped as appropriate.
input  the input image in which to perform the slice
mask  the mask for the input image.
maskVal  the mask value to apply to the mask
region  the slice region
direction  the slice dimension and direction
stats  the statistic to perform in slice operation

psImage* psImageSubset psImage image,
psRegion  region
 

Create a subimage of the specified area.

Define a subimage of the specified area of the given image. This function must raise an error if the requested subset area lies outside of the parent image and return NULL. The argument image is the parent image, region.x0, region.y0 specify the starting pixel of the subraster, and region.x1,region.y1 specify the extent of the desired subraster. Note that the row and column of this “upper right-hand corner” are NOT included in the region. In the event that x1 or y1 are negative, they shall be interpreted as being relative to the size of the parent image in that dimension. The entire subraster must be contained within the raster of the parent image. Note that the refCounter for the parent should be incremented. This function must be defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, psC32, psC64.

Returns:
psImage* : Pointer to psImage.
Parameters:
image  Parent image.
region  region of subimage

psImage* psImageTransform psImage output,
psArray blankPixels,
const psImage input,
const psImage inputMask,
psMaskType  inputMaskVal,
const psPlaneTransform outToIn,
psRegion  region,
const psPixels pixels,
psImageInterpolateMode  mode,
double  exposedValue
 

Transform the input image according the supplied transformation.

Transform the input image according the supplied transformation. The size of the transformed image is defined by the supplied output image, if non-NULL, or the region otherwise (size region.x1 - region.x0 by region.y1 region.y0, with out->x0 = region.x0 and out->y0 = region.y0). If the inputMask is non-NULL, those pixels in the inputMask matching inputMaskVal are to be ignored in the transformation. The inputMask must be of type psU8, and of the same size as the input, otherwise the function shall generate an error and return NULL. The transformation outToIn specifies the coordinates in the input image of a pixel in the output image — note that this is the reverse of what might be naively expected, but it is what is required in order to use psImagePixelInterpolate. If the pixels array is non-NULL, it shall consist of psPixelCoords, and only those pixels in the output image shall be transformed; otherwise, the entire image is generated. The interpolation is performed using the specified interpolation mode. Where a pixel in the output image does not correspond to a pixel in the input image (or all appropriate pixels in the input image are masked), the value shall be set to exposed, and the pixel added to the appropriate list of pixels (psPixels) in the array of blankPixels for return to the user. This function must be capable of handling the following types for the input (with corresponding types for the output): psF32, psF64.

Returns:
psImage* The transformed image.
Parameters:
output  psImage to recycle, or NULL
blankPixels  list of pixels in output image not set, or NULL if no list is desired.
input  psImage to apply transform to
inputMask  if not NULL, mask of input psImage
inputMaskVal  masking value for inputMask
outToIn  the transform to apply
region  the size of the transformed image
pixels  if not NULL, consists of psPixelCoords and specifies which pixels in output image shall be transformed; otherwise, entire image generated
mode  the interpolation scheme to be used
exposedValue  Exposed value to which non-corresponding pixels are set

psImage* psImageTrim psImage image,
psRegion  region
 

Trim an image.

Trim the specified image in-place, which involves shuffling the pixels around in memory. The pixels in the region [col0:col1,row0:row1] shall consist the output image. The column col1 and row row1 are NOT included in the range. In the event that x1 or y1 are non-positive, they shall be interpreted as being relative to the size of the parent image in that dimension.

If the entire specified subimage is not contained within the parent image, an error results and the return value will be NULL.

N.B. If the input psImage is a child of another psImage, no pixel data will be trimmed, rather it equivalent to calling psImageSubset. If the input psImage is, however, a parent psImage, any children will be obliterated, i.e., freed from memory.

Returns:
psImage* trimmed image result
Parameters:
image  image to trim
region  trim region

bool psMemCheckImage psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psImage structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

bool psMemCheckPixels psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psPixels structure, false otherwise.
Parameters:
ptr  the pointer whose type to check

psPixels* psPixelsAlloc long  nalloc  ) 
 

Allocates a new psPixels structure.

Returns:
psPixels* new psPixels
Parameters:
nalloc  the size of the coordinate vectors

psPixels* psPixelsConcatenate psPixels out,
const psPixels pixels
 

Concatenates two psPixels.

psPixelsConcatenate shall concatenate pixels onto out. In the event that out is NULL, a new psPixels shall be allocated, and the contents of pixels simply copied in. If pixels is NULL, the function shall generate an error and return NULL. The function shall take care to ensure that there are no duplicate pixels in out.

Returns:
psPixels Concatenated psPixel list
Parameters:
out  psPixels to recycle, or NULL
pixels  psPixels to append to OUT

psPixels* psPixelsCopy psPixels out,
const psPixels pixels
 

Copies a psPixels object.

Makes a deep copy of the data in a psPixels object. Any data in the OUT parameter will be destroyed and OUT will be resized, if necessary.

Returns:
psPixels* a new psPixels that is a duplicate to IN
Parameters:
out  psPixels struct to recycle, or NULL
pixels  psPixels struct to copy

psPixels* psPixelsFromMask psPixels out,
const psImage mask,
psMaskType  maskVal
 

Generate a psPixels from a mask psImage.

psMaskToPixels shall return a psPixels consisting of the coordinates in the mask that match the maskVal. The out pixel list shall be modified if supplied, or allocated and returned if NULL. In hte event that mask is NULL, the function shall generate an error and return NULL.

Returns:
psPixels* generated psPixels pixel list
Parameters:
out  psPixels to recycle, or NULL
mask  the input mask psImage
maskVal  the mask bit-values to act upon

psPixels* psPixelsRealloc psPixels pixels,
long  nalloc
 

resizes a psPixels structure

Returns:
psPixels* resized psPixels
Parameters:
pixels  psPixels to resize, or NULL to create new psPixels
nalloc  the size of the coordinate vectors

psImage* psPixelsToMask psImage out,
const psPixels pixels,
psRegion  region,
psMaskType  maskVal
 

Generate a psImage from a psPixels.

psPixelsToMask shall return an image of type U8 with the pixels lying within the specified region set to the maskVal. The out image shall be modified if supplied, or allocated and returned if NULL. The size of the output image shall be region->x1 - region->x0 by region->y1 - region->y0, with out->x0 = region->x0 and out->y0 = region->y0. In the event that either of pixels or region are NULL, the function shall generate an error and return NULL.

Returns:
psImage* generated mask image
Parameters:
out  psImage to recycle, or NULL
pixels  list of pixels to use
region  region to define the output mask image
maskVal  the mask bit-values to act upon

psRegion psRegionForImage psImage image,
psRegion in
 

Sets an actual region based on image parameters.

An image region defined with negative upper limits may be rationalized for the bounds of a specific image with psRegionForImage. The output of this function is a region with negative upper limits replaced by their corrected value appropriate to the given image. In addition, the lower and upper limits are foced to lie within the bounds of the image. If the lower- limit coordinates are lewss than the lower bound of the image, they are limited to the lower bound of the image. Conversely, if the upper-limit coordinates are greater than the upper bound of the image, they are truncated to define only valid pixels. If the lower-limit coordinates are greater than the upper bounds of the image, or the upper-limit coordinates are less than the lower bounds of the image, the coordinates should saturate on those limits.

Returns:
psRegion: A region with negative upper limits replaced by the corrected
Parameters:
image  the image for which the region is to be set
in  the image region limits

psRegion psRegionForSquare double  x,
double  y,
double  radius
 

Defines a region corresponding to the square with center at coordinate x,y and with coderadius.

The width of the square is 2radius + 1.

Returns:
psRegion: the newly defined psRegion.
Parameters:
x  x coordinate at square-center
y  y coordinate at square-center
radius  radius of square

psRegion psRegionFromString const char *  region  ) 
 

Create a psRegion with the attribute values given as a string.

Create a psRegion with the attribute values given as a string. The format shall be of the standard IRAF form '[x0:x1,y0:y1]'

Returns:
psRegion: A new psRegion struct, or NULL is not successful.
Parameters:
region  image rectangular region in the form '[x0:x1,y0:y1]'

psRegion psRegionSet float  x0,
float  x1,
float  y0,
float  y1
 

Create a psRegion with the specified attributes.

Returns:
psRegion : a cooresponding psRegion.
Parameters:
x0  the first column of the region.
x1  the last column of the region + 1.
y0  the first row of the region.
y1  the last row of the region + 1.

psString psRegionToString const psRegion  region  ) 
 

Create a string of the standard IRAF form '[x0:x1,y0:y1]' from a psRegion.

Returns:
psString: A new string representing the psRegion as text, or NULL is not successful.
Parameters:
region  the psRegion to convert to a string


Generated on Wed Sep 14 10:43:47 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2