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