Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psPixels.h

Go to the documentation of this file.
00001 /** @file  psPixels.h
00002  *
00003  *  @brief Contains psPixel related functions
00004  *
00005  *  @ingroup Image
00006  *
00007  *  @author Robert DeSonia, MHPCC
00008  *
00009  *  @version $Revision: 1.1.1.1 $ $Name:  $
00010  *  @date $Date: 2005/06/15 21:08:12 $
00011  *
00012  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00013  */
00014 #ifndef PS_PIXELS_H
00015 #define PS_PIXELS_H
00016 
00017 #include "psImage.h"
00018 #include "psVector.h"
00019 
00020 /// @addtogroup Image
00021 /// @{
00022 
00023 typedef struct
00024 {
00025     psS32 x;
00026     psS32 y;
00027 }
00028 psPixelCoord;
00029 
00030 /** list of pixel coordinates
00031  *
00032  *  Usually an image mask is the best way to carry information about what
00033  *  pixels mean what. However, in the case where the number of pixels in which
00034  *  we are interested is limited, it is more efficient to simply carry a list
00035  *  of pixels. An example of this is in the image combination code, where we
00036  *  want to perform an operation on a relatively small fraction of pixels, and
00037  *  it is inefficient to go through an entire mask image checking each pixel.
00038  *
00039  */
00040 typedef struct
00041 {
00042     int n;
00043     int nalloc;
00044     psPixelCoord* data;
00045 }
00046 psPixels;
00047 
00048 
00049 /** Allocates a new psPixels structure
00050  *
00051  *  @return psPixels*   new psPixels
00052  */
00053 psPixels* psPixelsAlloc(
00054     int size                           ///< the size of the coordinate vectors
00055 );
00056 
00057 /** resizes a psPixels structure
00058  *
00059  *  @return psPixels*   resized psPixels
00060  */
00061 psPixels* psPixelsRealloc(
00062     psPixels* pixels,                  ///< psPixels to resize, or NULL to create new psPixels
00063     int size                           ///< the size of the coordinate vectors
00064 );
00065 
00066 /** Add a pixel location to a psPixels
00067  *
00068  *  @return psPixels*       psPixels with the value appended.
00069  */
00070 psPixels* p_psPixelsAppend(
00071     psPixels* pixels,                  ///< psPixels to append new coordinate to.  NULL creates a new one.
00072     int growth,                        ///< number of elements to grow the psPixels list, if necessary.  if growth < 1, 10 is used.
00073     psS32 x,                           ///< x coordinate to append
00074     psS32 y                            ///< y coordinate to append
00075 );
00076 
00077 /** Copies a psPixels object
00078  *
00079  *  Makes a deep copy of the data in a psPixels object.  Any data in the OUT
00080  *  parameter will be destroyed and OUT will be resized, if necessary.
00081  *
00082  *  @return psPixels*   a new psPixels that is a duplicate to IN
00083  */
00084 psPixels* psPixelsCopy(
00085     psPixels* out,                     ///< psPixels struct to recycle, or NULL
00086     const psPixels* in                 ///< psPixels struct to copy
00087 );
00088 
00089 /** Generate a psImage from a psPixels
00090  *
00091  *  psPixelsToMask shall return an image of type U8 with the pixels lying
00092  *  within the specified region set to the maskVal. The out image shall be
00093  *  modified if supplied, or allocated and returned if NULL. The size of the
00094  *  output image shall be region->x1 - region->x0 by region->y1 - region->y0,
00095  *  with out->x0 = region->x0 and out->y0 = region->y0. In the event that
00096  *  either of pixels or region are NULL, the function shall generate an
00097  *  error and return NULL.
00098  *
00099  *  @return psImage*    generated mask image
00100  */
00101 psImage* psPixelsToMask(
00102     psImage* out,                      ///< psImage to recycle, or NULL
00103     const psPixels* pixels,            ///< list of pixels to use
00104     const psRegion region,             ///< region to define the output mask image
00105     unsigned int maskVal               ///< the mask bit-values to act upon
00106 );
00107 
00108 /** Generate a psPixels from a mask psImage
00109  *
00110  *  psMaskToPixels shall return a psPixels consisting of the coordinates in
00111  *  the mask that match the maskVal. The out pixel list shall be modified if
00112  *  supplied, or allocated and returned if NULL. In hte event that mask is
00113  *  NULL, the function shall generate an error and return NULL.
00114  *
00115  *  @return psPixels*   generated psPixels pixel list
00116  */
00117 psPixels* psPixelsFromMask(
00118     psPixels *out,                     ///< psPixels to recycle, or NULL
00119     const psImage *mask,               ///< the input mask psImage
00120     unsigned int maskVal               ///< the mask bit-values to act upon
00121 );
00122 
00123 /** Concatenates two psPixels
00124  *
00125  *  psPixelsConcatenate shall concatenate pixels onto out. In the event that
00126  *  out is NULL, a new psPixels shall be allocated, and the contents of
00127  *  pixels simply copied in. If pixels is NULL, the function shall generate
00128  *  an error and return NULL. The function shall take care to ensure that
00129  *  there are no duplicate pixels in out.
00130  *
00131  *  @return psPixels         Concatenated psPixel list
00132  */
00133 psPixels* psPixelsConcatenate(
00134     psPixels *out,                     ///< psPixels to recycle, or NULL
00135     const psPixels *pixels             ///< psPixels to append to OUT
00136 );
00137 
00138 /** Prints a psPixels to specified destination. */
00139 bool p_psPixelsPrint(
00140     FILE *fd,
00141     psPixels* pixels,
00142     const char *name
00143 );
00144 
00145 #endif // #ifndef PS_PIXELS_H

Generated on Wed Jun 15 11:00:57 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1