00001 /** @file psImageGeomManip.h 00002 * 00003 * @brief Contains basic image geometry manipulation operations, as 00004 * specified in the PSLIB SDRS sections "Image Geometry Manipulations". 00005 * 00006 * @ingroup Image 00007 * 00008 * @author Robert DeSonia, MHPCC 00009 * 00010 * @version $Revision: 1.1.1.1 $ $Name: $ 00011 * @date $Date: 2005/09/14 20:42:48 $ 00012 * 00013 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00014 */ 00015 #ifndef PS_IMAGE_GEOM_MANIP_H 00016 #define PS_IMAGE_GEOM_MANIP_H 00017 00018 #include "psImage.h" 00019 #include "psCoord.h" 00020 #include "psStats.h" 00021 #include "psPixels.h" 00022 00023 /// @addtogroup Image 00024 /// @{ 00025 00026 /** Rebin image to new scale. 00027 * 00028 * A new image is constructed in which the dimensions are reduced by a factor of 00029 * 1/scale. The scale, always a positive number, is equal in each dimension and 00030 * specified the number of pixels used to define a new pixel in the output image. 00031 * The output image is generated from all input image pixels. This function is 00032 * defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 00033 * 00034 * @return psImage new image formed by rebinning input image. 00035 */ 00036 psImage* psImageRebin( 00037 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 00038 const psImage* in, ///< input image 00039 const psImage* mask, ///< mask for input image. If NULL, no masking is done. 00040 psMaskType maskVal, ///< the bits to check in mask. 00041 int scale, ///< the scale to rebin for each dimension 00042 const psStats* stats 00043 ///< the statistic to perform when rebinning. Only one method should be set. 00044 ); 00045 00046 /** Resample image to new scale. 00047 * 00048 * A new image is constructed in which the dimensions are increased by a 00049 * factor of scale. The scale, always a positive number, is equal in each 00050 * dimension. The output image is generated from all input image pixels. 00051 * Each pixel in the output image is derived by interpolating between 00052 * neighboring pixels using the specified interpolation method (mode). 00053 * 00054 * @return psImage* resampled image result 00055 */ 00056 psImage* psImageResample( 00057 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 00058 const psImage* in, ///< input image 00059 int scale, ///< resample scaling factor 00060 psImageInterpolateMode mode ///< the interpolation mode used in resampling 00061 ); 00062 00063 /** Rotate the input image by given angle, specified in degrees. 00064 * 00065 * The output image must contain all of the pixels from the input image in 00066 * their new frame. Pixels in the output image which do not map to input 00067 * pixels should be set to exposed. The center of rotation is always the 00068 * center pixel of the image. The rotation is specified in the sense that a 00069 * positive angle is an anti-clockwise rotation. This function must be 00070 * defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 00071 * psC32, psC64. 00072 * 00073 * @return psImage* the rotated image result. 00074 */ 00075 psImage* psImageRotate( 00076 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 00077 const psImage* input, ///< input image 00078 float angle, ///< the rotation angle in radians. 00079 complex exposed, ///< the output image pixel values for non-imagery areas 00080 psImageInterpolateMode mode ///< the interpolation mode used 00081 ); 00082 00083 /** Shift image by an arbitrary number of pixels (dx,dy) in either direction. 00084 * 00085 * If the shift values are fractional, the output pixel values should 00086 * interpolate between the input pixel values. The output image has the same 00087 * dimensions as the input image. Pixels which fall off the edge of the 00088 * output image are lost. Newly exposed pixels are set to the value given by 00089 * exposed. This function must be defined for the following types: psU8, 00090 * psU16, psS8, psS16, psF32, psF64, psC32, psC64. 00091 * 00092 * @return psImage* the shifted image result. 00093 */ 00094 psImage* psImageShift( 00095 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 00096 const psImage* input, ///< input image 00097 float dx, ///< the shift in x direction. 00098 float dy, ///< the shift in y direction. 00099 complex exposed, ///< the output image pixel values for non-imagery areas 00100 psImageInterpolateMode mode ///< the interpolation mode to use 00101 ); 00102 00103 /** Roll image by an integer number of pixels in either direction. 00104 * 00105 * The output image is the same dimensions as the input image. Edge pixels 00106 * wrap to the other side (no values are lost). This function is 00107 * defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64. 00108 * 00109 * @return psImage* the rolled version of the input image. 00110 */ 00111 psImage* psImageRoll( 00112 psImage* out, ///< an psImage to recycle. If NULL, a new image is created 00113 const psImage* input, ///< input image 00114 int dx, ///< number of pixels to roll in the x-dimension 00115 int dy ///< number of pixels to roll in the y-dimension 00116 ); 00117 00118 /** Transform the input image according the supplied transformation. 00119 * 00120 * Transform the input image according the supplied transformation. The size 00121 * of the transformed image is defined by the supplied output image, if 00122 * non-NULL, or the region otherwise (size region.x1 - region.x0 by region.y1 00123 * region.y0, with out->x0 = region.x0 and out->y0 = region.y0). If the 00124 * inputMask is non-NULL, those pixels in the inputMask matching inputMaskVal 00125 * are to be ignored in the transformation. The inputMask must be of type 00126 * psU8, and of the same size as the input, otherwise the function shall 00127 * generate an error and return NULL. The transformation outToIn specifies the 00128 * coordinates in the input image of a pixel in the output image — note that 00129 * this is the reverse of what might be naively expected, but it is what is 00130 * required in order to use psImagePixelInterpolate. If the pixels array is 00131 * non-NULL, it shall consist of psPixelCoords, and only those pixels in the 00132 * output image shall be transformed; otherwise, the entire image is 00133 * generated. The interpolation is performed using the specified interpolation 00134 * mode. Where a pixel in the output image does not correspond to a pixel in 00135 * the input image (or all appropriate pixels in the input image are 00136 * masked), the value shall be set to exposed, and the pixel added to the 00137 * appropriate list of pixels (psPixels) in the array of blankPixels for 00138 * return to the user. This function must be capable of handling the following 00139 * types for the input (with corresponding types for the output): psF32, psF64. 00140 00141 * 00142 * @return psImage* The transformed image. 00143 */ 00144 psImage* psImageTransform( 00145 psImage *output, ///< psImage to recycle, or NULL 00146 psArray* blankPixels, ///< list of pixels in output image not set, or NULL if no list is desired. 00147 const psImage *input, ///< psImage to apply transform to 00148 const psImage *inputMask, ///< if not NULL, mask of input psImage 00149 psMaskType inputMaskVal, ///< masking value for inputMask 00150 const psPlaneTransform *outToIn, ///< the transform to apply 00151 psRegion region, ///< the size of the transformed image 00152 const psPixels* pixels, /**< if not NULL, consists of psPixelCoords and specifies which pixels in 00153 * output image shall be transformed; otherwise, entire image generated*/ 00154 psImageInterpolateMode mode, ///< the interpolation scheme to be used 00155 double exposedValue ///< Exposed value to which non-corresponding pixels are set 00156 ); 00157 00158 #endif // #ifndef PS_IMAGE_GEOM_MANIP_H
1.4.2