IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1693


Ignore:
Timestamp:
Sep 6, 2004, 2:52:16 PM (22 years ago)
Author:
eugene
Message:

minor cleanups

Location:
trunk/doc/pslib
Files:
3 edited

Legend:

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

    r1691 r1693  
    255255  arbitrary direction, instead of merging the data along a particular
    256256  dimension.
     257\item added \code{psVector *coords} to the API for \code{psImageCut}.
    257258\item Added \code{psLibVersion} (bug 156).
    258259\item Added specification of iterator to \code{psMetadataSetIterator}.
  • trunk/doc/pslib/psLibADD.tex

    r1689 r1693  
    1 %%% $Id: psLibADD.tex,v 1.37 2004-09-03 21:05:42 price Exp $
     1%%% $Id: psLibADD.tex,v 1.38 2004-09-07 00:52:16 eugene Exp $
    22\documentclass[panstarrs]{panstarrs}
    33
     
    10651065(5,5).
    10661066
    1067 \subparagraph{Bilinear Interpolation ({\tt PS\_RESAMPLE\_SINC})}
    1068 
    1069 \subparagraph{Bilinear Interpolation ({\tt PS\_RESAMPLE\_LAGRANGE})}
     1067\subparagraph{Sinc Interpolation ({\tt PS\_RESAMPLE\_SINC})}
     1068
     1069\subparagraph{Lagrange Interpolation ({\tt PS\_RESAMPLE\_LAGRANGE})}
    10701070
    10711071\paragraph{Image Cuts and Slices}
     
    11091109sum is renormalized by the ratio (12.57/16.00).
    11101110
     1111\subparagraph{Radial Cuts}
     1112
     1113Consider an image with pixels $x_i,y_i$ and a reference coordinate
     1114$x_c, y_c$.  We want to construct a radial cut by measuring statistics
     1115for pixels in a sequence of radial annulii $r_s < r < r_e$.  For each
     1116annulus, we need to select the pixels which fall within this annulus.
     1117The coordinates of the center of pixel $i,j$ are $i+0.5,j+0.5$.  A
     1118given pixel has a distance from the reference coordinate of $dX = x_c
     1119- i - 0.5, dY = y_c - j - 0.5$.  The pixels to be used for a given
     1120radial annulus are all of those pixels for which $r_s < \sqrt{dX^2 +
     1121  dY^2} < r_e$.  This is more efficiently calculated by comparing the
     1122square of the radii and distances.  All pixels which satisfy the above
     1123condition are included in a specific annular radius.  All average
     1124quantities are calculated directly from the pixel ensemble
     1125statistics. 
     1126
     1127\subparagraph{Arbitrary Linear Cuts}
     1128
     1129Select the pixels which lie along a line following steps of 1 pixel
     1130length:
     1131
     1132\begin{verbatim}
     1133
     1134  dX = xe - xs;
     1135  dY = ye - ys;
     1136  L = hypot (dX, dY);
     1137  dX = dX / L;
     1138  dY = dY / L;
     1139
     1140  REALLOCATE (xvec[0].elements, float, MAX (L, 1));
     1141  REALLOCATE (yvec[0].elements, float, MAX (L, 1));
     1142  xvec[0].Nelements = L;
     1143  yvec[0].Nelements = L;
     1144
     1145  V = (float *)buf[0].matrix.buffer;
     1146  for (i = 0; i < L; i++) {
     1147    xi = xs + i*dX - 0.5;
     1148    yi = ys + i*dY - 0.5;
     1149    xvec[0].elements[i] = i;
     1150    yvec[0].elements[i] = V[xi + Nx*yi];
     1151  }
     1152\end{verbatim}
     1153
    11111154\paragraph{Image Rotation}
    11121155
     
    11571200%
    11581201\begin{eqnarray}
    1159 \sin \theta                        = \sin \delta \cos \delta_p - \cos \delta \sin \delta_p \sin (\alpha - \alpha_p)
    1160 \cos \theta \sin (\phi - \phi_p)   = \cos \delta \cos \delta_p \sin (\alpha - \alpha_p) + \sin \delta \sin \delta_p
    1161 \cos \theta \cos (\phi - \phi_p)   = \cos \delta \cos (\alpha - \alpha_p)
     1202\sin \theta                        & = & \sin \delta \cos \delta_p - \cos \delta \sin \delta_p \sin (\alpha - \alpha_p)
     1203\cos \theta \sin (\phi - \phi_p)   & = & \cos \delta \cos \delta_p \sin (\alpha - \alpha_p) + \sin \delta \sin \delta_p
     1204\cos \theta \cos (\phi - \phi_p)   & = & \cos \delta \cos (\alpha - \alpha_p)
    11621205\end{eqnarray}
    11631206%
     
    14031446\subsubsection{Offset}
    14041447
    1405 Coordinate offsets can either spherical offsets or linear offsets. 
     1448Coordinate offsets can be either spherical offsets or linear offsets.
    14061449
    14071450A spherical offset is performed by adding the components of the
     
    15421585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    15431586
    1544 \subsubsection{Offsets}
    1545 
    1546 \tbd{write down Offset calculation (from Bugzilla)}
    1547 \tbd{define RadialCut}
    1548 \tbd{define ImageCut}
    1549 \tbd{define SINC, BICUBIC interpolation}
     1587\subsubsection{Missing and Todo}
     1588
     1589\tbd{define SINC, LAGRANGE interpolation}
     1590
    15501591\tbd{define sunrise, sunset, sun position}
     1592
    15511593\tbd{define moonrise, moonset, moon position, moon phase}
     1594
    15521595\tbd{define planet functions}
    1553 \tbd{clean up psProjections}
     1596
    15541597\tbd{clean up FITS I/O issues}
     1598
    15551599\tbd{define Brent's method \& minimization bracketing}
    15561600
  • trunk/doc/pslib/psLibSDRS.tex

    r1692 r1693  
    1 %%% $Id: psLibSDRS.tex,v 1.108 2004-09-04 04:29:14 price Exp $
     1%%% $Id: psLibSDRS.tex,v 1.109 2004-09-07 00:52:16 eugene Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    23412341
    23422342\begin{verbatim}
    2343 psImage *psImageSubsection(const psImage *image, const char *section);
     2343psImage *psImageSubsection(psImage *image, const char *section);
    23442344\end{verbatim}
    23452345Similar to \code{psImageSubset}, but uses an image \code{section}, of
     
    23642364
    23652365\begin{verbatim}
    2366 psImage *psImageTrim(psImage *image, int x0, int x1, int y0, int y1);
     2366psImage *psImageTrim(psImage *image, int x0, int y0, int x1, int y1);
    23672367\end{verbatim}
    23682368Trim the specified \code{image} in-place, which involves shuffling the
     
    24182418
    24192419\begin{verbatim}
    2420 psVector *psImageCut(psVector *out, const psImage *input,
    2421                      const psImage *mask, unsigned int maskVal,
    2422                      float xs, float ys, float xe, float ye,
    2423                      unsigned int nSamples, psImageInterpolateMode mode);
    2424 \end{verbatim}
    2425 Extract pixels along a line segment, \code{(xs,ys)} to \code{(xe,ye)},
    2426 on the image to a vector (array of the appropriate data type).  The
    2427 line segment is sampled \code{nSamples} times, hence the output vector
    2428 contains \code{nSamples} elements.  The interpolation method used to
    2429 derive the output vector value at each sample along the line segment
    2430 is specified by \code{mode}.  If the \code{mask} is non-\code{NULL},
    2431 then pixels for which the corresponding mask value is \code{maskVal}
    2432 are not included in the interpolation.  This function must be defined
    2433 for the following types: \code{psS8}, \code{psU16}, \code{psF32},
     2420psVector *psImageCut(psVector *out,
     2421                     psVector *coords,
     2422                     const psImage *input,
     2423                     const psImage *mask,
     2424                     unsigned int maskVal,
     2425                     float x0,
     2426                     float y0,
     2427                     float x1,
     2428                     float y1,
     2429                     unsigned int nSamples,
     2430                     psImageInterpolateMode mode);
     2431\end{verbatim}
     2432Extract pixels along a line segment, \code{(x0,y0)} to \code{(x1,y1)},
     2433on the image to a vector of the same data type.  The line segment is
     2434sampled \code{nSamples} times, hence the output vector contains
     2435\code{nSamples} elements.  The interpolation method used to derive the
     2436output vector value at each sample along the line segment is specified
     2437by \code{mode}.  If the \code{mask} is non-\code{NULL}, then pixels
     2438for which the corresponding mask value is \code{maskVal} are not
     2439included in the interpolation.  This function must be defined for the
     2440following types: \code{psS8}, \code{psU16}, \code{psF32},
    24342441\code{psF64}.
    24352442
    24362443\begin{verbatim}
    2437 psVector *psImageRadialCut(psVector *out, const psImage *input,
     2444psVector *psImageRadialCut(psVector *out,
     2445                           const psImage *input,
    24382446                           const psImage *mask,
    24392447                           unsigned int maskVal,
    2440                            float x, float y,
    2441                            const psVector *radii, const psStats *stats);
     2448                           float x,
     2449                           float y,
     2450                           const psVector *radii,
     2451                           const psStats *stats);
    24422452\end{verbatim}
    24432453Extract radial region data to a vector.  A vector is constructed where
     
    26122622is specified by \code{x0,y0}, while the upper right-hand corner of the
    26132623requested region is specified by \code{x1,y1}.  A negative value for
    2614 either of \code{x1} or \code{y2} specifies the size of the region to
     2624either of \code{x1} or \code{y1} specifies the size of the region to
    26152625be read counting down from the end of the array.
    26162626
     
    33953405The \code{psMetadataAdd} routine is required to check that all
    33963406metadata names are unique unless the type is already qualified as
    3397 \code{PS_META_NON_UNIQUE}; in this case the data are added to the
     3407\code{PS_META_ITEM_SET}; in this case the data are added to the
    33983408corresponding \code{psMetadataItem.items} list.
    33993409
     
    34403450Care should be taken not to leak memory when appending an item for
    34413451which the key already exists in the metadata (and is not
    3442 \code{PS_META_NON_UNIQUE}).
     3452\code{PS_META_ITEM_SET}).
    34433453%
    34443454\begin{verbatim}
     
    40364046
    40374047\end{document}
    4038 
    4039 
    4040 An example of the usage of the metadata APIs is as follows:
    4041 \begin{verbatim}
    4042     for (int i = 0; i < 10; i += 5) {
    4043         float sqrti = sqrt(i);
    4044         psMetadataAdd(ms, PS_LIST_TAIL, psMetadataItemAlloc(PS_META_INT, &i, NULL, "const.%d", i));
    4045         psMetadataAdd(ms, PS_LIST_TAIL, psMetadataItemAlloc(PS_META_FLOAT, &sqrti,
    4046                       "square root", "const.sqrt%d", i));
    4047     }
    4048     psMetadataAdd(ms, psMetadataItemAlloc(PS_META_STR, "Bonjour", "French", "lang.hello"));
    4049     /*
    4050      * Remove a key
    4051      */
    4052     psMetadataItemFree(psMetadataRemove(ms, PS_LIST_UNKNOWN, "lang.hello"));
    4053     /*
    4054      * Print all metadata
    4055      */
    4056     fprintf(stdout, "------\n");
    4057     psMetadataSetIterator(ms, 1, PS_LIST_HEAD);
    4058     while ((meta = psMetadataGetNext(ms, NULL, 1)) != NULL) {
    4059         psMetadataItemPrint(stdout, meta, "");
    4060     }
    4061     /*
    4062      * Look up a key by name
    4063      */
    4064     fprintf(stdout, "------\n");
    4065     fprintf(stdout, "Looking up by name:\n");
    4066     meta = psMetadataLookup(ms, "const.5");
    4067     if (meta != NULL) {
    4068         psMetadataItemPrint(stdout, meta, "");
    4069     }
    4070 \end{verbatim}
    4071 
    4072 \subsubsection{Naming convention for Metadata}
    4073 
    4074 The \code{psMetadataItem} struct includes a name.  This name should be of
    4075 the form \code{name1.name2.name3}$\cdots$, e.g.\hfil\break
    4076 \null\qquad\qquad\code{IPP.phase1.ota12.biassec}.
    4077 
    4078 We must set in place a system for assigning the top-level `domains'
    4079 to responsible individuals, and for gathering a complete list of
    4080 all metadata names in use throughout the project.
    4081 
    4082 \paragraph{Support for Multiple Values for a Given Name}
    4083 
    4084 \begin{verbatim}
    4085     psMetadataAdd(ms, PS_LIST_UNKNOWN, psMetadataItemAlloc(PS_META_STR | PS_META_NON_UNIQUE,
    4086                                                            "Bonjour", "French", "lang.hello"));
    4087     psMetadataAdd(ms, PS_LIST_UNKNOWN, psMetadataItemAlloc(PS_META_STR | PS_META_NON_UNIQUE,
    4088                                                            "Aloha", "Hawaiian", "lang.hello"));
    4089     psMetadataAdd(ms, PS_LIST_UNKNOWN, psMetadataItemAlloc(PS_META_STR | PS_META_NON_UNIQUE,
    4090                                                            "Good Morning", "English", "lang.hello"));
    4091     /*
    4092      * Print all metadata starting "lang"
    4093      */
    4094     psMetadataSetIterator(ms, 2, PS_LIST_HEAD);
    4095     while ((meta = psMetadataGetNext(ms, "lang", 2)) != NULL) {
    4096         psMetadataItemPrint(stdout, meta, "");
    4097     }
    4098 \end{verbatim}
Note: See TracChangeset for help on using the changeset viewer.