Changeset 1426 for trunk/psLib/src/image
- Timestamp:
- Aug 9, 2004, 12:44:25 PM (22 years ago)
- Location:
- trunk/psLib/src/image
- Files:
-
- 4 edited
-
psImage.h (modified) (4 diffs)
-
psImageExtraction.h (modified) (3 diffs)
-
psImageManip.h (modified) (7 diffs)
-
psImageStats.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.h
r1407 r1426 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.2 8$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-08-0 7 00:06:06$14 * @version $Revision: 1.29 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-08-09 22:44:25 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 18 18 */ 19 19 #ifndef PS_IMAGE_H 20 # define PS_IMAGE_H20 #define PS_IMAGE_H 21 21 22 # include <complex.h>22 #include <complex.h> 23 23 24 # include "psType.h"24 #include "psType.h" 25 25 26 26 /// @addtogroup Image 27 27 /// @{ 28 28 29 /** enumeration of options in interpolation 30 * 31 */ 29 32 typedef enum { 30 PS_INTERPOLATE_FLAT, 31 PS_INTERPOLATE_BILINEAR 33 PS_INTERPOLATE_FLAT, ///< 'flat' interpolation (nearest pixel) 34 PS_INTERPOLATE_BILINEAR ///< bi-linear interpolation 32 35 } psImageInterpolateMode; 33 36 … … 40 43 typedef struct psImage 41 44 { 42 const psType type; // /< Image data type and dimension.43 const unsigned int numCols; // /< Number of columns in image44 const unsigned int numRows; // /< Number of rows in image.45 const int col0; // /< Column position relative to parent.46 const int row0; // /< Row position relative to parent.45 const psType type; ///< Image data type and dimension. 46 const unsigned int numCols; ///< Number of columns in image 47 const unsigned int numRows; ///< Number of rows in image. 48 const int col0; ///< Column position relative to parent. 49 const int row0; ///< Row position relative to parent. 47 50 48 51 union { 49 psU8 **U8; // /< Unsigned 8-bit integer data.50 psU16 **U16; // /< Unsigned 16-bit integer data.51 psU32 **U32; // /< Unsigned 32-bit integer data.52 psU64 **U64; // /< Unsigned 64-bit integer data.53 psS8 **S8; // /< Signed 8-bit integer data.54 psS16 **S16; // /< Signed 16-bit integer data.55 psS32 **S32; // /< Signed 32-bit integer data.56 psS64 **S64; // /< Signed 64-bit integer data.57 psF32 **F32; // /< Single-precision float data.58 psF64 **F64; // /< Double-precision float data.59 psC32 **C32; // /< Single-precision complex data.60 psC64 **C64; // /< Double-precision complex data.61 psPTR **PTR; // /< Void pointers.62 psPTR *V; // /< Pointer to data.63 } data; // /< Union for data types.64 const struct psImage *parent; // /< Parent, if a subimage.65 int nChildren; // /< Number of subimages.66 struct psImage **children; // /< Children of this region.52 psU8 **U8; ///< Unsigned 8-bit integer data. 53 psU16 **U16; ///< Unsigned 16-bit integer data. 54 psU32 **U32; ///< Unsigned 32-bit integer data. 55 psU64 **U64; ///< Unsigned 64-bit integer data. 56 psS8 **S8; ///< Signed 8-bit integer data. 57 psS16 **S16; ///< Signed 16-bit integer data. 58 psS32 **S32; ///< Signed 32-bit integer data. 59 psS64 **S64; ///< Signed 64-bit integer data. 60 psF32 **F32; ///< Single-precision float data. 61 psF64 **F64; ///< Double-precision float data. 62 psC32 **C32; ///< Single-precision complex data. 63 psC64 **C64; ///< Double-precision complex data. 64 psPTR **PTR; ///< Void pointers. 65 psPTR *V; ///< Pointer to data. 66 } data; ///< Union for data types. 67 const struct psImage *parent; ///< Parent, if a subimage. 68 int nChildren; ///< Number of subimages. 69 struct psImage **children; ///< Children of this region. 67 70 } 68 71 psImage; … … 82 85 * 83 86 */ 84 psImage *psImageAlloc(unsigned int numCols, // /< Number of rows in image.85 unsigned int numRows, // /< Number of columns in image.86 const psElemType type // /< Type of data for image.87 psImage *psImageAlloc(unsigned int numCols, ///< Number of rows in image. 88 unsigned int numRows, ///< Number of columns in image. 89 const psElemType type ///< Type of data for image. 87 90 ); 88 91 … … 92 95 * 93 96 */ 94 psImage *psImageRecycle(psImage * old, // /< the psImage to recycle by resizing image buffer95 unsigned int numCols, // /< the desired number of columns in image96 unsigned int numRows, // /< the desired number of rows in image97 const psElemType type // /< the desired datatype of the image97 psImage *psImageRecycle(psImage * old, ///< the psImage to recycle by resizing image buffer 98 unsigned int numCols, ///< the desired number of columns in image 99 unsigned int numRows, ///< the desired number of rows in image 100 const psElemType type ///< the desired datatype of the image 98 101 ); 99 102 -
trunk/psLib/src/image/psImageExtraction.h
r1407 r1426 10 10 * @author Robert DeSonia, MHPCC 11 11 * 12 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 22:44:25 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 /// @{ 27 27 28 /* Cut direction flag. Used with psImageCut function. 29 */ 28 30 typedef enum { 29 PS_CUT_X_POS, 30 PS_CUT_X_NEG, 31 PS_CUT_Y_POS, 32 PS_CUT_Y_NEG, 31 PS_CUT_X_POS, ///< Cut in the x dimension from left to right 32 PS_CUT_X_NEG, ///< Cut in the x dimension from rigth to left 33 PS_CUT_Y_POS, ///< Cut in the y dimension from bottom up 34 PS_CUT_Y_NEG, ///< Cut in the y dimension from top down. 33 35 } psImageCutDirection; 34 36 35 37 /** Create a subimage of the specified area. 36 * 37 * Uses psLib memory allocation functions to create an image based on a larger 38 * one. 39 * 40 * @return psImage*: Pointer to psImage. 41 * 42 */ 43 psImage *psImageSubset(psImage * out, // /< Subimage to return, or NULL. 44 psImage * image, // /< Parent image. 45 unsigned int numCols, // /< Subimage width (<= image.nCols - col0). 46 unsigned int numRows, // /< Subimage height (<= image.nRows - row0). 47 unsigned int col0, // /< Subimage col-offset (0 <= col0 < nCol). 48 unsigned int row0 // /< Subimage row-offset (0 <= row0 < nCol). 49 ); 38 * 39 * Uses psLib memory allocation functions to create an image based on a larger 40 * one. 41 * 42 * @return psImage*: Pointer to psImage. 43 * 44 */ 45 psImage* psImageSubset( 46 psImage* out, ///< image to recycle, or NULL. 47 psImage* image, ///< Parent image. 48 unsigned int numCols, ///< Subimage width (<= image.nCols - col0). 49 unsigned int numRows, ///< Subimage height (<= image.nRows - row0). 50 unsigned int col0, ///< Subimage col-offset (0 <= col0 < nCol). 51 unsigned int row0 ///< Subimage row-offset (0 <= row0 < nCol). 52 ); 50 53 51 54 /** Makes a copy of a psImage … … 55 58 * 56 59 */ 57 psImage *psImageCopy(psImage * restrict output, 60 psImage* psImageCopy( 61 psImage* restrict output, ///< if not NULL, a psImage that could be recycled. 62 const psImage* input, ///< the psImage to copy 63 psElemType type ///< the desired datatype of the returned copy 64 ); 58 65 59 /**< if not NULL, a psImage that could be recycled. If it can not be used,60 * it will be freed via psImageFree61 */62 const psImage * input,63 66 64 /**< the psImage to copy */ 65 psElemType type 67 /** Extract pixels from rectlinear region to a vector (array of floats). 68 * 69 * The output vector contains either nx or ny elements, based on the value of 70 * the direction: e.g., if direction is PS_CUT_X_POS, there are nx elements. 71 * The input region is collapsed in the perpendicular direction, and each 72 * element of the output vectors is derived from the statistics of the pixels 73 * at that direction coordinate. The statistic used to derive the output 74 * vector value is specified by stats. Only one of the statistics choices may 75 * be specified, otherwise the function must return an error. This function 76 * must be defined for the following types: psS8, psU16, psF32, psF64. 77 * 78 * @return psVector the resulting vector 79 */ 80 psVector *psImageSlice( 81 psVector* out, ///< psVector to recycle, or NULL. 82 psVector* slicePositions, 83 ///< If not NULL, it is populated with the coordinate in the slice dimension 84 ///< coorsponding to the output vector's value of the same position in the 85 ///< vector. This vector maybe resized and retyped as appropriate. 86 const psImage* restrict input, ///< the input image in which to perform the slice 87 const psImage* restrict mask, ///< the mask for the input image. 88 unsigned int maskVal, ///< the mask value to apply to the mask 89 unsigned int col, ///< the leftmost column of the slice region 90 unsigned int row, ///< the bottommost row of the slice region 91 unsigned int numCols, ///< the number of columns in the slice region 92 unsigned int numRows, ///< the number of rows in the slice region 93 psImageCutDirection direction, ///< the slice dimension and direction 94 const psStats* stats ///< the statistic to perform in slice operation 95 ); 66 96 67 /**< the desired datatype of the returned copy */ 68 ); 97 /** Extract pixels from an image along a line to a vector (array of floats). 98 * 99 * The vector (xs,ys) - (xe,ye) forms the basis of the output vector. Pixels 100 * are considered in a rectangular region of width dw about this vector. The 101 * input region is collapsed in the perpendicular direction, and each element 102 * of the output vector represents pixel-sized boxes, where the value is 103 * derived from the statistics of the pixels interpolated along the 104 * perpendicular direction. The specific algorithm which must be used is 105 * described in the PSLib ADD (PSDC-430-006). The statistic used to derive 106 * the output vector value is specified by stats. Only one of the statistics 107 * choices may be specified, otherwise the function must return an error. 108 * This function must be defined for the following types: psS8, psU16, psF32, 109 * psF64. 110 * 111 * @return psVector resulting vector 112 */ 113 psVector *psImageCut( 114 psVector* out, ///< psVector to recycle, or NULL. 115 const psImage* input, ///< the input image in which to perform the cut 116 const psImage* restrict mask, ///< the mask for the input image. 117 unsigned int maskVal, ///< the mask value to apply to the mask 118 float startCol, ///< the column of the start of the cut line 119 float startRow, ///< the row of the start of the cut line 120 float endCol, ///< the column of the end of the cut line 121 float endRow, ///< the row of the end of the cut line 122 float width, ///< the distance about the line to perform the statistics 123 const psStats* stats ///< the statistic to perform in operation 124 ); 69 125 70 psVector *psImageSlice(psVector * out, 71 psVector * slicePositions, 72 const psImage * restrict input, 73 const psImage * restrict mask, 74 unsigned int maskVal, 75 unsigned int col, 76 unsigned int row, 77 unsigned int numCols, 78 unsigned int numRows, psImageCutDirection direction, const psStats * stats); 79 80 psVector *psImageCut(psVector * out, 81 const psImage * input, 82 const psImage * restrict mask, 83 unsigned int maskVal, 84 float startCol, 85 float startRow, float endCol, float endRow, float width, const psStats * stats); 86 87 psVector *psImageRadialCut(psVector * out, 88 const psImage * input, 89 const psImage * restrict mask, 90 unsigned int maskVal, 91 float centerCol, float centerRow, const psVector * radii, const psStats * stats); 126 /** Extract radial region data to a vector. A vector is constructed where each 127 * vector elements is derived from the statistics of the pixels which land 128 * within one of a sequence of radii. The radii are centered on the image 129 * pixel coordinate x,y, and are defined by the sequence of values in the 130 * vector radii. The specific algorithm which must be used is described in 131 * the PSLib ADD (PSDC-430-006). The statistic used to derive the output 132 * vector value is specified by stats. Only one of the statistics choices 133 * may be specified, otherwise the function must return an error. This 134 * function must be defined for the following types: psS8, psU16, psF32, 135 * psF64. 136 * 137 * @return psVector resulting vector 138 */ 139 psVector* psImageRadialCut( 140 psVector* out, ///< psVector to recycle, or NULL. 141 const psImage* input, ///< the input image in which to perform the cut 142 const psImage* restrict mask, ///< the mask for the input image. 143 unsigned int maskVal, ///< the mask value to apply to the mask 144 float centerCol, ///< the column of the center of the cut circle 145 float centerRow, ///< the row of the center of the cut circle 146 const psVector* radii, ///< the radii of the cut circle 147 const psStats* stats ///< the statistic to perform in operation 148 ); 92 149 93 150 /// @} -
trunk/psLib/src/image/psImageManip.h
r1407 r1426 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-0 7 00:06:06$13 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-09 22:44:25 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 32 32 * @return int The number of clipped pixels 33 33 */ 34 int psImageClip(psImage * input, // /< the image to clip35 psF64 min, // /< the minimum image value allowed36 psF64 vmin, // /< the value pixels < min are set to37 psF64 max, // /< the maximum image value allowed38 psF64 vmax // /< the value pixels > max are set to34 int psImageClip(psImage * input, ///< the image to clip 35 psF64 min, ///< the minimum image value allowed 36 psF64 vmin, ///< the value pixels < min are set to 37 psF64 max, ///< the maximum image value allowed 38 psF64 vmax ///< the value pixels > max are set to 39 39 ); 40 40 … … 48 48 * @return int The number of clipped pixels 49 49 */ 50 int psImageClipComplexRegion(psImage * input, // /< the image to clip51 psC64 min, // /< the minimum image value allowed52 psC64 vmin, // /< the value pixels < min are set to53 psC64 max, // /< the maximum image value allowed54 psC64 vmax // /< the value pixels > max are set to50 int psImageClipComplexRegion(psImage * input, ///< the image to clip 51 psC64 min, ///< the minimum image value allowed 52 psC64 vmin, ///< the value pixels < min are set to 53 psC64 max, ///< the maximum image value allowed 54 psC64 vmax ///< the value pixels > max are set to 55 55 ); 56 56 … … 62 62 * @return int The number of clipped pixels 63 63 */ 64 int psImageClipNaN(psImage * input, // /< the image to clip65 psF64 value // /< the value to set all NaN/Inf values to64 int psImageClipNaN(psImage * input, ///< the image to clip 65 psF64 value ///< the value to set all NaN/Inf values to 66 66 ); 67 67 … … 77 77 * @return int 0 if success, non-zero if failed. 78 78 */ 79 int psImageOverlaySection(psImage * image, // /< target image80 const psImage * overlay, // /< the overlay image81 int col0, // /< the column to start overlay82 int row0, // /< the row to start overlay83 const char *op // /< the operation to perform for overlay79 int psImageOverlaySection(psImage * image, ///< target image 80 const psImage * overlay, ///< the overlay image 81 int col0, ///< the column to start overlay 82 int row0, ///< the row to start overlay 83 const char *op ///< the operation to perform for overlay 84 84 ); 85 85 … … 94 94 * @return psImage new image formed by rebinning input image. 95 95 */ 96 psImage *psImageRebin(psImage * out, // /< an psImage to recycle. If NULL, a new image is created97 const psImage * in, // /< input image98 unsigned int scale, // /< the scale to rebin for each dimension99 const psStats * stats // /< the statistic to perform when rebinning. Only one96 psImage *psImageRebin(psImage * out, ///< an psImage to recycle. If NULL, a new image is created 97 const psImage * in, ///< input image 98 unsigned int scale, ///< the scale to rebin for each dimension 99 const psStats * stats ///< the statistic to perform when rebinning. Only one 100 100 // method should be set. 101 101 ); 102 102 103 psImage *psImageResample(psImage * out, // /< an psImage to recycle. If NULL, a new image is created104 const psImage * in, // /< input image103 psImage *psImageResample(psImage * out, ///< an psImage to recycle. If NULL, a new image is created 104 const psImage * in, ///< input image 105 105 int scale, psImageInterpolateMode mode); 106 106 107 psImage *psImageRotate(psImage * out, // /< an psImage to recycle. If NULL, a new image is created108 const psImage * in, // /< input image107 psImage *psImageRotate(psImage * out, ///< an psImage to recycle. If NULL, a new image is created 108 const psImage * in, ///< input image 109 109 float angle, float unexposedValue, psImageInterpolateMode mode); 110 110 111 psImage *psImageShift(psImage * out, // /< an psImage to recycle. If NULL, a new image is created112 const psImage * in, // /< input image111 psImage *psImageShift(psImage * out, ///< an psImage to recycle. If NULL, a new image is created 112 const psImage * in, ///< input image 113 113 float dx, float dy, float unexposedValue, psImageInterpolateMode mode); 114 114 … … 121 121 * @return psImage* the rolled version of the input image. 122 122 */ 123 psImage *psImageRoll(psImage * out, // /< an psImage to recycle. If NULL, a new image is created124 const psImage * in, // /< input image125 int dx, // /< number of pixels to roll in the x-dimension126 int dy // /< number of pixels to roll in the y-dimension123 psImage *psImageRoll(psImage * out, ///< an psImage to recycle. If NULL, a new image is created 124 const psImage * in, ///< input image 125 int dx, ///< number of pixels to roll in the x-dimension 126 int dy ///< number of pixels to roll in the y-dimension 127 127 ); 128 128 -
trunk/psLib/src/image/psImageStats.h
r1407 r1426 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 7 00:06:06$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-09 22:44:25 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 /// This routine must determine the various statistics for the image. 30 psStats *psImageStats(psStats * stats, // /< defines statistics to be calculated31 psImage * in, // /< image (or subimage) to calculate stats32 psImage * mask, // /< mask data for image (NULL ok)33 int maskVal); // /< mask Mask for mask30 psStats *psImageStats(psStats * stats, ///< defines statistics to be calculated 31 psImage * in, ///< image (or subimage) to calculate stats 32 psImage * mask, ///< mask data for image (NULL ok) 33 int maskVal); ///< mask Mask for mask 34 34 35 psHistogram *psImageHistogram(psHistogram * out, // /< input histogram description & target36 psImage * in, // /< Image data to be histogramed.37 psImage * mask, // /< mask data for image (NULL ok)38 unsigned int maskVal); // /< mask Mask for mask35 psHistogram *psImageHistogram(psHistogram * out, ///< input histogram description & target 36 psImage * in, ///< Image data to be histogramed. 37 psImage * mask, ///< mask data for image (NULL ok) 38 unsigned int maskVal); ///< mask Mask for mask 39 39 40 40 /// Fit a 2-D polynomial surface to an image. 41 psPolynomial2D *psImageFitPolynomial(const psImage * input, // /< image to fit42 psPolynomial2D * coeffs // /< coefficient structure carries in41 psPolynomial2D *psImageFitPolynomial(const psImage * input, ///< image to fit 42 psPolynomial2D * coeffs ///< coefficient structure carries in 43 43 // desired terms & target 44 44 ); 45 45 46 46 /// Evaluate a 2-D polynomial surface to image pixels. 47 int psImageEvalPolynomial(const psImage * input, // /< image to fit48 const psPolynomial2D * coeffs // /< coefficient structure carries in desired terms47 int psImageEvalPolynomial(const psImage * input, ///< image to fit 48 const psPolynomial2D * coeffs ///< coefficient structure carries in desired terms 49 49 ); 50 50
Note:
See TracChangeset
for help on using the changeset viewer.
