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