IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 362


Ignore:
Timestamp:
Mar 31, 2004, 11:14:20 PM (22 years ago)
Author:
eugene
Message:

updated image APIs and descriptions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/pslib/psLibSDRS.tex

    r361 r362  
    1 %%% $Id: psLibSDRS.tex,v 1.23 2004-04-01 08:54:37 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.24 2004-04-01 09:14:20 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    19491949specified by \code{psStats *stats}.
    19501950\begin{verbatim}
    1951 psFloatArray *psImageSlice(psFloatArray *out, psImage *input, int x, int y, int nx, int ny, int direction, const psStats *stats);
     1951psFloatArray *psImageSlice(psFloatArray *out, psImage *input,
     1952                           int x, int y, int nx, int ny,
     1953                           int direction, const psStats *stats);
    19521954\end{verbatim}
    19531955
     
    19621964specified by \code{psStats stats}.
    19631965\begin{verbatim}
    1964 psFloatArray *psImageCut(psFloatArray *out, psImage *input, float xs, float ys, float xe, float ye, float dw, const psStats *stats);
     1966psFloatArray *psImageCut(psFloatArray *out, psImage *input,
     1967                         float xs, float ys, float xe, float ye, float dw,
     1968                         const psStats *stats);
    19651969\end{verbatim}
    19661970
     
    19731977stats}
    19741978\begin{verbatim}
    1975 psFloatArray *psImageRadialCut(psFloatArray *out, psImage *input, float x, float y, float radius, float dr, psStats *stats);
     1979psFloatArray *psImageRadialCut(psFloatArray *out, psImage *input,
     1980                               float x, float y, float radius, float dr,
     1981                               psStats *stats);
    19761982\end{verbatim}
    19771983
     
    19801986Rebin image to new scale.  A new image is constructed in which the
    19811987dimensions are reduced by a factor of \code{scale} $\le 1$ (it is an
    1982 error for \code{scale} $> 1$).  The output image represents a
    1983 one-to-one mapping of the pixels in the input image, except for edge
    1984 effects.  Each pixel in the output image is derived from the
    1985 statistics of the corresponding input image pixels based on the
    1986 statistics specified by \code{psStats stats}.  \tbd{interpolation?}
    1987 \begin{verbatim}
    1988 psImage *
    1989 psImageRebin(psImage *out,              ///< Image to output, or NULL
    1990              const psImage *input,      ///< rebin this image
    1991              float scale,               ///< rebinning scale: doutput = scale*dinput
    1992              const psStats *stats       ///< defines statistics used to find output values
    1993     );
     1988error for \code{scale} $> 1$).  The output image is generated from all
     1989input image pixels.  Each pixel in the output image is derived from
     1990the statistics of the corresponding set of input image pixels based on
     1991the statistics specified by \code{psStats stats}.
     1992\begin{verbatim}
     1993psImage *psImageRebin(psImage *out, psImage *input, float scale, psStats *stats);
    19941994\end{verbatim}
    19951995
     
    19971997output image must contain all of the pixels from the input image in
    19981998their new frame.  Pixels in the output image which do not map to input
    1999 pixels should be set of \tbd{value}.  The center of rotation is always
     1999pixels should be set to \tbd{value}.  The center of rotation is always
    20002000the center pixel of the image.  The rotation is specified in the sense
    20012001that a positive angle is an anti-clockwise rotation. 
    20022002\begin{verbatim}
    2003 psImage *
    2004 psImageRotate(psImage *out,             ///< Image to output, or NULL
    2005               const psImage *input,     ///< rotate this image
    2006               float angle               ///< rotate by this amount anti-clockwise (degrees)
    2007     );
     2003psImage *psImageRotate(psImage *out, psImage *input, float angle);
    20082004\end{verbatim}
    20092005
     
    20152011set to the value given by \code{exposed}. 
    20162012\begin{verbatim}
    2017 psImage *
    2018 psImageShift(psImage *out,              ///< Image to output, or NULL
    2019              const psImage *input,      ///< shift this image
    2020              float dx,                  ///< shift by this amount in x
    2021              float dy,                  ///< shift by this amount in y
    2022              float exposed              ///< set exposed pixels to this value
    2023     );
    2024 \end{verbatim}
    2025 
    2026 Roll image by an integer number of pixels in either direction.  The
    2027 output image is the same dimensions as the input image.  Edge pixels
    2028 wrap to the other side (no values are lost).
    2029 \begin{verbatim}
    2030 psImage *
    2031 psImageRoll(psImage *out,               ///< Image to output, or NULL
    2032             const psImage *input,       ///< roll this image
    2033             int dx,                     ///< roll this amount in x
    2034             int dy                      ///< roll this amount in y
    2035     );
     2013psImage *psImageShift(psImage *out, psImage *input, float dx, float dy, float exposed);
     2014\end{verbatim}
     2015
     2016Roll image by an integer number of pixels (\code{dx,dy}) in either
     2017direction.  The output image is the same dimensions as the input
     2018image.  Edge pixels wrap to the other side (no values are lost).
     2019\begin{verbatim}
     2020psImage *psImageRoll(psImage *out, psImage *input, int dx, int dy);
    20362021\end{verbatim}
    20372022
     
    20412026determined are specified by \code{psStats stats}.
    20422027\begin{verbatim}
    2043 psStats *
    2044 psImageGetStats(const psImage *input,   ///< image (or subimage) to calculate stats
    2045                 psStats *stats          ///< defines statistics to be calculated & target
    2046     );
     2028psStats *psImageGetStats(psImage *input, psStats *stats);
    20472029\end{verbatim}
    20482030
    20492031Construct a histogram from an image (or subimage).  The histogram to
    2050 generate is specified by \code{psHistogram hist}.
    2051 \begin{verbatim}
    2052 psHistogram *
    2053 psImageHistogram(psHistogram *hist,     ///< input histogram description & target
    2054                  const psImage *input   ///< determine histogram of this image
    2055     );
    2056 \end{verbatim}
    2057 
    2058 Fit a 2-D polynomial surface to an image.  The input structure
    2059 \code{coeffs} contains the desired order and terms of interest.
    2060 \tbd{how do we specify the renormalization?}
    2061 \begin{verbatim}
    2062 psPolynomial2D *
    2063 psImageFitPolynomial(const psImage *input, ///< image to fit
    2064                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
    2065     );
    2066 \end{verbatim}
    2067 
    2068 Evaluate a 2-D polynomial surface to image pixels.  Given the input
    2069 polynomial coefficients, return an image generated on the basis of the
    2070 input image pixels which evaluates the polynomial for all pixels in
    2071 the image.a
    2072 \begin{verbatim}
    2073 int
    2074 psImageEvalPolynomial(const psImage *input, ///< image to fit
    2075                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
    2076     );
     2032generate is specified by \code{psHistogram hist} (see
     2033section~\ref{histogram}).
     2034\begin{verbatim}
     2035psHistogram *psImageHistogram(psHistogram *hist, psImage *input);
     2036\end{verbatim}
     2037
     2038Fit a 2-D Chebychev polynomial surface to an image.  The input
     2039structure \code{coeffs} contains the desired order and terms of
     2040interest.
     2041\begin{verbatim}
     2042psPolynomial2D *psImageFitPolynomial(psImage *input, psPolynomial2D *coeffs);
     2043\end{verbatim}
     2044
     2045Evaluate a 2-D polynomial surface for the image pixels.  Given the
     2046input polynomial coefficients, set the image pixel values on the basis
     2047of the polynomial function.  \tbd{return value?}
     2048\begin{verbatim}
     2049int psImageEvalPolynomial(psImage *input, psPolynomial2D *coeffs);
    20772050\end{verbatim}
    20782051
     
    20872060native image is a cube, the value of z specifies the requested slice
    20882061of the image.  The data is read from the extension specified by
    2089 extname (matching the EXTNAME keyword) or by the extnum value (with -1
    2090 representing the PHU, 0 the first extension, etc).  This function must
     2062extname (matching the EXTNAME keyword) or by the extnum value (with 0
     2063representing the PHU, 1 the first extension, etc).  This function must
    20912064generate an error and return \code{NULL} if any of the specified
    20922065parameters are out of range for the data in the image file, if the
     
    20942067one-dimensional.
    20952068\begin{verbatim}
    2096 psImage *
    2097 psImageReadSection(psImage *output,     ///< place data in this structure for output
    2098                    int x,               ///< starting x coord of region
    2099                    int y,               ///< starting y coord of region
    2100                    int nx,              ///< x size of region (-1 for full range)
    2101                    int ny,              ///< y size of region (-1 for full range)
    2102                    int z,               ///< plane of interest
    2103                    const char *extname, ///< MEF extension name ("PHU" for primary header)
    2104                    int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2105                    const char *filename ///< file to read data from
    2106     );
     2069psImage *psImageReadSection(psImage *output,
     2070                            int x, int y, int nx, int ny, int z,
     2071                            char *extname, int extnum, char *filename);
    21072072\end{verbatim}
    21082073 
     
    21122077\begin{verbatim}
    21132078psImage *
    2114 psImageFReadSection(psImage *output,    ///< place data in this structure for output
    2115                     int x,              ///< starting x coord of region           
    2116                     int y,              ///< starting y coord of region           
    2117                     int dx,             ///< x size of region (-1 for full range)         
    2118                     int dy,             ///< y size of region (-1 for full range)         
    2119                     int z,              ///< plane of interest                     
    2120                     const char *extname, ///< MEF extension name ("PHU" for primary header)
    2121                     int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2122                     FILE *f     ///< file descriptor to read data from             
    2123     );
    2124 \end{verbatim}
    2125 
    2126 \TBD{The use of \code{FILE*} to carry around the file descriptor is to be reviewed.}
    2127 
    2128 Write an image section to named file, which may exist.  This
     2079psImageFReadSection(psImage *output,
     2080                    int x, int y, int nx, int ny, int z,
     2081                    char *extname, int extnum, FILE *f);
     2082\end{verbatim}
     2083\tbd{The use of \code{FILE*} to carry around the file descriptor is to be reviewed.}
     2084
     2085Write an image section to the named file, which may exist.  This
    21292086operation may write a portion of an image over the existing bytes of
    21302087an existing image.  If the file does not exist, it should be created.
    21312088If the specified extension does not exist, it should be created.  If
    21322089an extension is specified and no PHU exists, a basic PHU should be
    2133 created. 
    2134 \begin{verbatim}
    2135 psImage *
    2136 psImageWriteSection(psImage *input,    ///< image to write out
    2137                     int x,              ///< starting x coord of region           
    2138                     int y,              ///< starting y coord of region           
    2139                     int z,              ///< plane of interest                     
    2140                     const char *extname, ///< MEF extension name ("PHU" for primary header)
    2141                     int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2142                     const char *filename ///< file to write data to               
    2143     );
    2144 \end{verbatim}
    2145 
    2146 Write an image section to file descriptor.
    2147 \begin{verbatim}
    2148 psImage *
    2149 psImageFWriteSection(psImage *input,    ///< image to write out
    2150                      int x,             ///< starting x coord of region           
    2151                      int y,             ///< starting y coord of region           
    2152                      int z,             ///< plane of interest                     
    2153                      const char *extname, ///< MEF extension name                         
    2154                      int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2155                      FILE *f            ///< file descriptor to write data to             
    2156     );
    2157 \end{verbatim}
    2158 
    2159 \TBD{The use of \code{FILE*} to carry around the file descriptor is to be reviewed.}
     2090created.
     2091\begin{verbatim}
     2092psImage *psImageWriteSection(psImage *input,
     2093                             int x, int y, int z,
     2094                             char *extname, int extnum, char *filename);
     2095\end{verbatim}
     2096
     2097Write an image section to file descriptor as above:
     2098\begin{verbatim}
     2099psImage *psImageFWriteSection(psImage *input,
     2100                              int x, int y, int z,
     2101                              char *extname, int extnum, FILE *f);
     2102\end{verbatim}
     2103\tbd{The use of \code{FILE*} to carry around the file descriptor is to be reviewed.}
    21602104
    21612105Read header data from a FITS image file into a \code{psMetaData}
    2162 structure.  If the named extension does not exist, the function should
    2163 return an error. 
    2164 \begin{verbatim}
    2165 psMetadata *
    2166 psImageReadHeader(psMetadata *output,   ///< read data to this structure
    2167                   const char *extname,  ///< MEF extension name ("PHU" for primary header)
    2168                   int extnum,           ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2169                   const char *filename  ///< file to read from
    2170     );
     2106structure (see section~\ref{metadata}.  The \code{extname} and
     2107\code{extnum} parameters specify the extension of interest as above.
     2108If the named extension does not exist, the function should return an
     2109error.
     2110\begin{verbatim}
     2111psMetadata *psImageReadHeader(psMetadata *output, char *extname, int extnum, char *filename);
    21712112\end{verbatim}
    21722113
     
    21742115structure. 
    21752116\begin{verbatim}
    2176 psMetadata *
    2177 psImageFReadHeader(psMetadata *output, ///< read data to this structure
    2178                    const char *extname, ///< MEF extension name ("PHU" for primary header)
    2179                    int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    2180                    FILE *f              ///< file descriptor to read from
    2181     );
     2117psMetadata *psImageFReadHeader(psMetadata *output, char *extname, int extnum, FILE *f);
    21822118\end{verbatim}
    21832119
    21842120\subsubsection{Image Pixel Manipulations}
    21852121
    2186 Perform a 2-D FFT on the specified image.  The returned image is of
    2187 type \code{psComplex}.
    2188 \begin{verbatim}
    2189 psImage *
    2190 psImageFFT(psImage *output,             ///< Output image
    2191            const psImage *input,        ///< image to FFT
    2192            int direction                ///< FFT direction
    2193     );
    2194 \end{verbatim}
    2195 
    21962122Clip image values outside of range to given values.  All pixels with
    2197 values $<$ min are set to the value vmin. All pixels with values $>$
    2198 max are set to the value vmax.
    2199 \begin{verbatim}
    2200 int
    2201 psImageClip(psImage *input,             ///< clip this image
    2202             float min,                  ///< clip pixels with values < min
    2203             float vmin,                 ///< set min-clipped pixels to vmin
    2204             float max,                  ///< clip pixels with values > max
    2205             float vmax                  ///< set max-clipped pixels to vmax
    2206     );
    2207 \end{verbatim}
    2208 
    2209 Clip NaN image pixels to given value.  Pixels with NaN, +Inf or -Inf
    2210 values are set to the specified value.  Returns the number of clipped
    2211 pixels.
    2212 \begin{verbatim}
    2213 int
    2214 psImageClipNaN(psImage *input,          ///< clip this image & target
    2215                float value              ///< set nan pixels to this value
    2216     );
     2123values \code{< min} are set to the value \code{vmin}. All pixels with
     2124values \code{> max} are set to the value \code{vmax}. Returns the
     2125number of clipped pixels.
     2126\begin{verbatim}
     2127int psImageClip(psImage *input, float min, float vmin, float max, float vmax);
     2128\end{verbatim}
     2129
     2130Clip \code{NaN} image pixels to given value.  Pixels with \code{NaN},
     2131\code{+Inf} or \code{-Inf} values are set to the specified value.
     2132Returns the number of clipped pixels.
     2133\begin{verbatim}
     2134int psImageClipNaN(psImage *input, float value);
    22172135\end{verbatim}
    22182136
     
    22202138the \code{image} which correspond to the pixels in \code{overlay} with
    22212139values derived from the values in \code{image} and \code{overlay}
    2222 based on the given operator.  Valid operators are ``='' (set image
    2223 value to overlay value), ``+'' (add overlay value to image value),
    2224 ``-'' (subtract overlay from image), ``*'' (multiply overlay times
    2225 image), ``/'' (divide image by overlay). 
    2226 \begin{verbatim}
    2227 int
    2228 psImageOverlaySection(psImage *image,   ///< input image & target
    2229                       const psImage *overlay, ///< image to overlay
    2230                       int x0,           ///< x offset of overlay subimage
    2231                       int y0,           ///< y offset of overlay subimage
    2232                       const char *operator ///< overlay operation
    2233     );
     2140based on the given operator \code{op}.  Valid operators are \code{=}
     2141(set image value to overlay value), \code{+} (add overlay value to
     2142image value), \code{-} (subtract overlay from image), \code{*}
     2143(multiply overlay times image), \code{/} (divide image by overlay).
     2144\begin{verbatim}
     2145int psImageOverlaySection(psImage *image, psImage *overlay, int x0, int y0, char *op);
    22342146\end{verbatim}
    22352147
Note: See TracChangeset for help on using the changeset viewer.