00001 /** @file psImagePixelExtract.h 00002 * 00003 * @brief Contains basic image extraction operations, as specified in the 00004 * PSLIB SDRS sections "Image Pixel Extractions". 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 00016 #ifndef PSIMAGE_PIXEL_EXTRACT_H 00017 #define PSIMAGE_PIXEL_EXTRACT_H 00018 00019 #include "psImage.h" 00020 #include "psVector.h" 00021 #include "psStats.h" 00022 00023 /// @addtogroup Image 00024 /// @{ 00025 00026 /* Cut direction flag. Used with psImageCut function. 00027 */ 00028 typedef enum { 00029 PS_CUT_X_POS, ///< Cut in the x dimension from left to right 00030 PS_CUT_X_NEG, ///< Cut in the x dimension from rigth to left 00031 PS_CUT_Y_POS, ///< Cut in the y dimension from bottom up 00032 PS_CUT_Y_NEG ///< Cut in the y dimension from top down. 00033 } psImageCutDirection; 00034 00035 /** Extract pixels from rectlinear region to a vector (array of floats). 00036 * 00037 * The output vector contains either col1-col0 or row1-row0 elements, based 00038 * on the value of the direction: e.g., if direction is PS_CUT_X_POS, there 00039 * are col1-col0 elements. The region to be sliced is defined by the 00040 * lower-left corner, (col0,row0), and the upper-right corner, (col1,row1). 00041 * Note that the row and column of the upper right-hand corner are NOT 00042 * included in the region. In the event that col1 or row1 are negative, they 00043 * shall be interpreted as being relative to the size of the parent image in 00044 * that dimension. The input region is collapsed in the direction perpendicular 00045 * to that specified by direction, and each element of the output vectors is 00046 * derived from the statistics of the pixels at that direction coordinate. The 00047 * statistic used to derive the output vector value is specified by stats. 00048 * If mask is non-NULL, pixels for which the corresponding mask pixel 00049 * matches maskVal are excluded from operations. If coords is not NULL, the 00050 * calculated coordinates along the slice are returned in this vector. Only 00051 * one of the statistics choices may be specified, otherwise the function 00052 * must return an error. 00053 * 00054 * This function is defined for the following types: psS8, psU16, psF32, psF64. 00055 * 00056 * @return psVector the resulting vector 00057 */ 00058 psVector* psImageSlice( 00059 psVector* out, ///< psVector to recycle, or NULL. 00060 psVector* coords, 00061 ///< If not NULL, it is populated with the coordinate in the slice dimension 00062 ///< coorsponding to the output vector's value of the same position in the 00063 ///< vector. This vector maybe resized and retyped as appropriate. 00064 const psImage* input, ///< the input image in which to perform the slice 00065 const psImage* mask, ///< the mask for the input image. 00066 psMaskType maskVal, ///< the mask value to apply to the mask 00067 psRegion region, ///< the slice region 00068 psImageCutDirection direction, ///< the slice dimension and direction 00069 const psStats* stats ///< the statistic to perform in slice operation 00070 ); 00071 00072 /** Extract pixels from an image along a line to a vector (array of floats). 00073 * 00074 * The vector (xs,ys) - (xe,ye) forms the basis of the output vector. Pixels 00075 * are considered in a rectangular region of width dw about this vector. The 00076 * input region is collapsed in the perpendicular direction, and each element 00077 * of the output vector represents pixel-sized boxes, where the value is 00078 * derived from the statistics of the pixels interpolated along the 00079 * perpendicular direction. The specific algorithm which must be used is 00080 * described in the PSLib ADD (PSDC-430-006). The statistic used to derive 00081 * the output vector value is specified by stats. Only one of the statistics 00082 * choices may be specified, otherwise the function must return an error. 00083 * This function must be defined for the following types: psS8, psU16, psF32, 00084 * psF64. 00085 * 00086 * @return psVector* resulting vector 00087 */ 00088 psVector* psImageCut( 00089 psVector* out, ///< psVector to recycle, or NULL. 00090 psVector* cutCols, ///< if not NULL, the calculated column values along the slice (output) 00091 psVector* cutRows, ///< if not NULL, the calculated row values along the slice (output) 00092 const psImage* input, ///< the input image in which to perform the cut 00093 const psImage* mask, ///< the mask for the input image. 00094 psMaskType maskVal, ///< the mask value to apply to the mask 00095 psRegion region, ///< the start and end points to cut along 00096 unsigned int nSamples, ///< the number of samples along the cut 00097 psImageInterpolateMode mode ///< the interpolation method to use 00098 ); 00099 00100 /** Extract radial region data to a vector. A vector is constructed where each 00101 * vector elements is derived from the statistics of the pixels which land 00102 * within one of a sequence of radii. The radii are centered on the image 00103 * pixel coordinate x,y, and are defined by the sequence of values in the 00104 * vector radii. The specific algorithm which must be used is described in 00105 * the PSLib ADD (PSDC-430-006). The statistic used to derive the output 00106 * vector value is specified by stats. Only one of the statistics choices 00107 * may be specified, otherwise the function must return an error. This 00108 * function must be defined for the following types: psS8, psU16, psF32, 00109 * psF64. 00110 * 00111 * @return psVector resulting vector 00112 */ 00113 psVector* psImageRadialCut( 00114 psVector* out, ///< psVector to recycle, or NULL. 00115 const psImage* input, ///< the input image in which to perform the cut 00116 const psImage* mask, ///< the mask for the input image. 00117 psMaskType maskVal, ///< the mask value to apply to the mask 00118 float x, ///< the column of the center of the cut circle 00119 float y, ///< the row of the center of the cut circle 00120 const psVector* radii, ///< the radii of the cut circle 00121 const psStats* stats ///< the statistic to perform in operation 00122 ); 00123 00124 /// @} 00125 00126 #endif // #ifndef PSIMAGE_PIXEL_EXTRACT_H
1.4.2