IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 27, 2005, 10:30:42 AM (21 years ago)
Author:
eugene
Message:

final for cycle 6, includes changes for psRegion

File:
1 edited

Legend:

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

    r3772 r3774  
    1 %%% $Id: psLibSDRS.tex,v 1.208 2005-04-27 19:59:04 eugene Exp $
     1%%% $Id: psLibSDRS.tex,v 1.209 2005-04-27 20:30:42 eugene Exp $
    22\documentclass[panstarrs,spec]{panstarrs}
    33
     
    26502650listed below, and fall into several categories.
    26512651
     2652\subsubsection{Image Regions}
     2653
     2654In many places, we need to refer to a rectangular area.  We define a
     2655structure to represent a rectangle:
     2656\begin{verbatim}
     2657typedef struct {
     2658  float x0;
     2659  float x1;
     2660  float y0;
     2661  float y1;
     2662} psRegion;
     2663\end{verbatim}
     2664This structure is used in psLib as an abbreviation for the four
     2665floats, and is defined statically.  Functions which accept or return a
     2666\code{psRegion} shall do so by value, not by pointer.
     2667
     2668We define two functions to set and return the value of a
     2669\code{psRegion}.  The first defines the region by the corner
     2670coordinates.  The second function converts the IRAF description of a
     2671region in the form \code{[x0:x1,y0:y1]}, used for header entries such
     2672as \code{BIASSEC}, into the corresponding \code{psRegion} structure.
     2673
     2674\begin{verbatim}
     2675psRegion psRegionSet (float x0, float x1, float y0, float y1);
     2676psRegion psRegionFromString (char *region);
     2677\end{verbatim}
     2678
     2679All functions which use a psRegion must interpret the definition of
     2680$(x0,y0)$ and $(x1,y1)$ in the same way. The coordinate $(x0,y0)$
     2681defines the starting pixel in the region.  The coordinate $(x1,y1)$
     2682defines the outer bound of the region.  The size of the region is
     2683$(x1-x0,y1-y1)$.  If either $x1$ or $y1$ is less than or equal to 0,
     2684the value is added to the image dimensions ($Nx + x1$).  Thus a region
     2685\code{[0:0,0:0]} refers to the full image array, while
     2686\code{[0:-10,0:-20]} trims the last 10 colums and the last 20 rows.
     2687
    26522688\subsubsection{Image Structure Manipulation}
    26532689
    26542690\begin{verbatim}
    2655 psImage *psImageSubset(psImage *image, int x0, int y0, int x1, int y1);
     2691psImage *psImageSubset(psImage *image, psRegion region);
    26562692\end{verbatim}
    26572693Define a subimage of the specified area of the given image.  This
    26582694function must raise an error if the requested subset area lies outside
    26592695of the parent image and return \code{NULL}.  The argument \code{image}
    2660 is the parent image, \code{x0, y0} specify the starting pixel of the
    2661 subraster, and \code{x1,y1} specify the extent of the desired
    2662 subraster.  Note that the row and column of this ``upper right-hand
    2663 corner'' are \textit{NOT} included in the region.  In the event that
    2664 \code{x1} or \code{y1} are negative, they shall be interpreted as
    2665 being relative to the size of the parent image in that dimension.  The
    2666 entire subraster must be contained within the raster of the parent
    2667 image.  Note that the \code{refCounter} for the parent should be
    2668 incremented.  This function must be defined for the following types:
    2669 \code{psU8}, \code{psU16}, \code{psS8}, \code{psS16}, \code{psF32},
    2670 \code{psF64}, \code{psC32}, \code{psC64}.
    2671 
    2672 \begin{verbatim}
    2673 psImage *psImageSubsection(psImage *image, const char *section);
    2674 \end{verbatim}
    2675 Similar to \code{psImageSubset}, but uses an image \code{section}, of
    2676 the form \code{[x1:x2,y1:y2]}.  If the image section is not fully
    2677 contained within the input \code{image}, then the function shall
    2678 generate an error and return \code{NULL}.  Note that the
    2679 \code{refCounter} for the parent should be incremented.  This function
    2680 must be defined for the following types: \code{psU8}, \code{psU16},
    2681 \code{psS8}, \code{psS16}, \code{psF32}, \code{psF64}, \code{psC32},
    2682 \code{psC64}.
     2696is the parent image, \code{region.x0, region.y0} specify the starting
     2697pixel of the subraster, and \code{region.x1,region.y1} specify the
     2698extent of the desired subraster.  Note that the row and column of this
     2699``upper right-hand corner'' are \textit{NOT} included in the region.
     2700In the event that \code{x1} or \code{y1} are negative, they shall be
     2701interpreted as being relative to the size of the parent image in that
     2702dimension.  The entire subraster must be contained within the raster
     2703of the parent image.  Note that the \code{refCounter} for the parent
     2704should be incremented.  This function must be defined for the
     2705following types: \code{psU8}, \code{psU16}, \code{psS8}, \code{psS16},
     2706\code{psF32}, \code{psF64}, \code{psC32}, \code{psC64}.
    26832707
    26842708\begin{verbatim}
     
    26942718
    26952719\begin{verbatim}
    2696 psImage *psImageTrim(psImage *image, int x0, int y0, int x1, int y1);
     2720psImage *psImageTrim(psImage *image, psRegion region);
    26972721\end{verbatim}
    26982722Trim the specified \code{image} in-place, which involves shuffling the
    26992723pixels around in memory.  The region to be kept is defined by the
    2700 lower-left corner, \code{x0,y0}, and the upper-right corner,
    2701 \code{x1,y1}.  Note that the row and column of the ``upper right-hand
    2702 corner'' are \textit{NOT} included in the region.  In the event that
    2703 \code{x1} or \code{y1} are negative, they shall be interpreted as
    2704 being relative to the size of the parent image in that dimension.
     2724lower-left corner, \code{region.x0,region.y0}, and the upper-right
     2725corner, \code{region.x1,region.y1}.  Note that the row and column of
     2726the ``upper right-hand corner'' are \textit{NOT} included in the
     2727region.  In the event that \code{region.x1} or \code{region.y1} are
     2728negative, they shall be interpreted as being relative to the size of
     2729the parent image in that dimension.
    27052730
    27062731The function shall generate an error if the specified region is
     
    27242749                       const psImage *mask,
    27252750                       unsigned int maskVal,
    2726                        int x0, int y0, int x1, int y1,
     2751                       psRegion region,
    27272752                       psImageCutDirection direction,
    27282753                       const psStats *stats);
    27292754\end{verbatim}
    27302755Extract pixels from rectlinear region to a vector (array of floats).
    2731 The output vector contains either \code{x1-x0} or \code{y1-y0}
    2732 elements, based on the value of the direction: e.g., if
    2733 \code{direction} is \code{PS_CUT_X_POS}, there are \code{x1-x0}
    2734 elements.  The region to be ``sliced'' is defined by the lower-left
    2735 corner, \code{x0,y0}, and the upper-right corner, \code{x1,y1}.  Note
    2736 that the row and column of the ``upper right-hand corner'' are
    2737 \textit{NOT} included in the region.  In the event that \code{x1} or
    2738 \code{y1} are negative, they shall be interpreted as being relative to
    2739 the size of the parent image in that dimension.
     2756The output vector contains either \code{region.x1-region.x0} or
     2757\code{region.y1-region.y0} elements, based on the value of the
     2758direction: e.g., if \code{direction} is \code{PS_CUT_X_POS}, there are
     2759\code{region.x1-region.x0} elements.  The region to be ``sliced'' is
     2760defined by the lower-left corner, \code{region.x0,region.y0}, and the
     2761upper-right corner, \code{region.x1,region.y1}.  Note that the row and
     2762column of the ``upper right-hand corner'' are \textit{NOT} included in
     2763the region.  In the event that \code{region.x1} or \code{region.y1}
     2764are negative, they shall be interpreted as being relative to the size
     2765of the parent image in that dimension.
    27402766
    27412767The input region is collapsed in the direction perpendicular to that
     
    27582784                     const psImage *mask,
    27592785                     unsigned int maskVal,
    2760                      float x0,
    2761                      float y0,
    2762                      float x1,
    2763                      float y1,
     2786                     psRegion region,
    27642787                     unsigned int nSamples,
    27652788                     psImageInterpolateMode mode);
    27662789\end{verbatim}
    2767 Extract pixels along a line segment, \code{(x0,y0)} to \code{(x1,y1)},
    2768 on the image to a vector of the same data type.  The line segment is
    2769 sampled \code{nSamples} times, hence the output vector contains
    2770 \code{nSamples} elements.  The interpolation method used to derive the
    2771 output vector value at each sample along the line segment is specified
    2772 by \code{mode}.  If the \code{mask} is non-\code{NULL}, then pixels
    2773 for which the corresponding mask value is \code{maskVal} are not
    2774 included in the interpolation.  This function must be defined for the
    2775 following types: \code{psS8}, \code{psU16}, \code{psF32},
    2776 \code{psF64}.
     2790Extract pixels along a line segment, \code{(region.x0,region.y0)} to
     2791\code{(region.x1,region.y1)}, on the image to a vector of the same
     2792data type.  The line segment is sampled \code{nSamples} times, hence
     2793the output vector contains \code{nSamples} elements.  The
     2794interpolation method used to derive the output vector value at each
     2795sample along the line segment is specified by \code{mode}.  If the
     2796\code{mask} is non-\code{NULL}, then pixels for which the
     2797corresponding mask value is \code{maskVal} are not included in the
     2798interpolation.  This function must be defined for the following types:
     2799\code{psS8}, \code{psU16}, \code{psF32}, \code{psF64}.
    27772800
    27782801\begin{verbatim}
     
    29012924
    29022925\begin{verbatim}
    2903 psImage *psImageTransform(psImage *output, psArray **blankPixels, const psImage *input,
    2904                           const psImage *inputMask, int inputMaskVal, const psPlaneTransform *outToIn,
    2905                           const psRegion *region, const psPixels *pixels, psImageInterpolateMode mode,
     2926psImage *psImageTransform(psImage *output,
     2927                          psArray **blankPixels,
     2928                          const psImage *input,
     2929                          const psImage *inputMask,
     2930                          int inputMaskVal,
     2931                          const psPlaneTransform *outToIn,
     2932                          const psRegion region,
     2933                          const psPixels *pixels,
     2934                          psImageInterpolateMode mode,
    29062935                          double exposedValue);
    29072936\end{verbatim}
     
    29092938transformation.  The size of the transformed image is defined by the
    29102939supplied \code{output} image, if non-\code{NULL}, or the \code{region}
    2911 otherwise (size \code{region->x1 - region->x0} by \code{region->y1 -
    2912 region->y0}, with \code{out->x0 = region->x0} and \code{out->y0 =
    2913 region->y0}).
     2940otherwise (size \code{region.x1 - region.x0} by \code{region.y1 -
     2941region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 =
     2942region.y0}).
    29142943
    29152944If the \code{inputMask} is non-\code{NULL}, those pixels in the
     
    31173146
    31183147\begin{verbatim}
    3119 psImage *psPixelsToMask(psImage *out, const psPixels *pixels, const psRegion *region, unsigned int maskVal);
     3148psImage *psPixelsToMask(psImage *out, const psPixels *pixels, const psRegion region, unsigned int maskVal);
    31203149psPixels *psMaskToPixels(psPixels *out, const psImage *mask, unsigned int maskVal);
    31213150\end{verbatim}
     
    31253154\code{maskVal}.  The \code{out} image shall be modified if supplied,
    31263155or allocated and returned if \code{NULL}.  The size of the output
    3127 image shall be \code{region->x1 - region->x0} by \code{region->y1 -
    3128 region->y0}, with \code{out->x0 = region->x0} and \code{out->y0 =
    3129 region->y0}.  In the event that either of \code{pixels} or
     3156image shall be \code{region.x1 - region.x0} by \code{region.y1 -
     3157region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 =
     3158region.y0}.  In the event that either of \code{pixels} or
    31303159\code{region} are \code{NULL}, the function shall generate an error
    31313160and return \code{NULL}.
     
    31593188
    31603189%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    3161 
    3162 \subsection{Image Regions}
    3163 
    3164 In many places, we need to refer to a rectangular area.  We define a
    3165 structure to represent a rectangle:
    3166 \begin{verbatim}
    3167 typedef struct {
    3168   float x0;
    3169   float x1;
    3170   float y0;
    3171   float y1;
    3172 } psRegion;
    3173 psRegion *psRegionAlloc (float x0, float x1, float y0, float y1);
    3174 \end{verbatim}
    3175 
    3176 \begin{verbatim}
    3177 psRegion *psRegionFromString (char *region);
    3178 \end{verbatim}
    3179 This function converts the IRAF description of a region in the form
    3180 \code{[x0:x1,y0:y1]}, used for header entries such as \code{BIASSEC},
    3181 into the corresponding \code{psRegion} structure.
    31823190
    31833191\subsection{Vector and Image Arithmetic}
     
    51455153\begin{verbatim}
    51465154psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out, const psPlaneTransform *in,
    5147                                          psRegion *region, int nSamples);
     5155                                         psRegion region, int nSamples);
    51485156psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out, const psPlaneTransform *trans1,
    5149                                           const psPlaneTransform *trans2, psRegion *region,
     5157                                          const psPlaneTransform *trans2, psRegion region,
    51505158                                          int nSamples);
    51515159bool psPlaneTransformFit(psPlaneTransform *trans, const psArray *source, const psArray *dest,
Note: See TracChangeset for help on using the changeset viewer.