psImagePixelExtract.h

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

Generated on Fri Feb 2 22:24:35 2007 for pslib by  doxygen 1.5.1