Changeset 3774 for trunk/doc/pslib/psLibSDRS.tex
- Timestamp:
- Apr 27, 2005, 10:30:42 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/pslib/psLibSDRS.tex (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/psLibSDRS.tex
r3772 r3774 1 %%% $Id: psLibSDRS.tex,v 1.20 8 2005-04-27 19:59:04eugene Exp $1 %%% $Id: psLibSDRS.tex,v 1.209 2005-04-27 20:30:42 eugene Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 2650 2650 listed below, and fall into several categories. 2651 2651 2652 \subsubsection{Image Regions} 2653 2654 In many places, we need to refer to a rectangular area. We define a 2655 structure to represent a rectangle: 2656 \begin{verbatim} 2657 typedef struct { 2658 float x0; 2659 float x1; 2660 float y0; 2661 float y1; 2662 } psRegion; 2663 \end{verbatim} 2664 This structure is used in psLib as an abbreviation for the four 2665 floats, and is defined statically. Functions which accept or return a 2666 \code{psRegion} shall do so by value, not by pointer. 2667 2668 We define two functions to set and return the value of a 2669 \code{psRegion}. The first defines the region by the corner 2670 coordinates. The second function converts the IRAF description of a 2671 region in the form \code{[x0:x1,y0:y1]}, used for header entries such 2672 as \code{BIASSEC}, into the corresponding \code{psRegion} structure. 2673 2674 \begin{verbatim} 2675 psRegion psRegionSet (float x0, float x1, float y0, float y1); 2676 psRegion psRegionFromString (char *region); 2677 \end{verbatim} 2678 2679 All functions which use a psRegion must interpret the definition of 2680 $(x0,y0)$ and $(x1,y1)$ in the same way. The coordinate $(x0,y0)$ 2681 defines the starting pixel in the region. The coordinate $(x1,y1)$ 2682 defines 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, 2684 the 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 2652 2688 \subsubsection{Image Structure Manipulation} 2653 2689 2654 2690 \begin{verbatim} 2655 psImage *psImageSubset(psImage *image, int x0, int y0, int x1, int y1);2691 psImage *psImageSubset(psImage *image, psRegion region); 2656 2692 \end{verbatim} 2657 2693 Define a subimage of the specified area of the given image. This 2658 2694 function must raise an error if the requested subset area lies outside 2659 2695 of 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}. 2696 is the parent image, \code{region.x0, region.y0} specify the starting 2697 pixel of the subraster, and \code{region.x1,region.y1} specify the 2698 extent of the desired subraster. Note that the row and column of this 2699 ``upper right-hand corner'' are \textit{NOT} included in the region. 2700 In the event that \code{x1} or \code{y1} are negative, they shall be 2701 interpreted as being relative to the size of the parent image in that 2702 dimension. The entire subraster must be contained within the raster 2703 of the parent image. Note that the \code{refCounter} for the parent 2704 should be incremented. This function must be defined for the 2705 following types: \code{psU8}, \code{psU16}, \code{psS8}, \code{psS16}, 2706 \code{psF32}, \code{psF64}, \code{psC32}, \code{psC64}. 2683 2707 2684 2708 \begin{verbatim} … … 2694 2718 2695 2719 \begin{verbatim} 2696 psImage *psImageTrim(psImage *image, int x0, int y0, int x1, int y1);2720 psImage *psImageTrim(psImage *image, psRegion region); 2697 2721 \end{verbatim} 2698 2722 Trim the specified \code{image} in-place, which involves shuffling the 2699 2723 pixels 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. 2724 lower-left corner, \code{region.x0,region.y0}, and the upper-right 2725 corner, \code{region.x1,region.y1}. Note that the row and column of 2726 the ``upper right-hand corner'' are \textit{NOT} included in the 2727 region. In the event that \code{region.x1} or \code{region.y1} are 2728 negative, they shall be interpreted as being relative to the size of 2729 the parent image in that dimension. 2705 2730 2706 2731 The function shall generate an error if the specified region is … … 2724 2749 const psImage *mask, 2725 2750 unsigned int maskVal, 2726 int x0, int y0, int x1, int y1,2751 psRegion region, 2727 2752 psImageCutDirection direction, 2728 2753 const psStats *stats); 2729 2754 \end{verbatim} 2730 2755 Extract 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. 2756 The output vector contains either \code{region.x1-region.x0} or 2757 \code{region.y1-region.y0} elements, based on the value of the 2758 direction: 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 2760 defined by the lower-left corner, \code{region.x0,region.y0}, and the 2761 upper-right corner, \code{region.x1,region.y1}. Note that the row and 2762 column of the ``upper right-hand corner'' are \textit{NOT} included in 2763 the region. In the event that \code{region.x1} or \code{region.y1} 2764 are negative, they shall be interpreted as being relative to the size 2765 of the parent image in that dimension. 2740 2766 2741 2767 The input region is collapsed in the direction perpendicular to that … … 2758 2784 const psImage *mask, 2759 2785 unsigned int maskVal, 2760 float x0, 2761 float y0, 2762 float x1, 2763 float y1, 2786 psRegion region, 2764 2787 unsigned int nSamples, 2765 2788 psImageInterpolateMode mode); 2766 2789 \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 the2771 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 forthe2775 following types: \code{psS8}, \code{psU16}, \code{psF32}, 2776 \code{ps F64}.2790 Extract 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 2792 data type. The line segment is sampled \code{nSamples} times, hence 2793 the output vector contains \code{nSamples} elements. The 2794 interpolation method used to derive the output vector value at each 2795 sample along the line segment is specified by \code{mode}. If the 2796 \code{mask} is non-\code{NULL}, then pixels for which the 2797 corresponding mask value is \code{maskVal} are not included in the 2798 interpolation. This function must be defined for the following types: 2799 \code{psS8}, \code{psU16}, \code{psF32}, \code{psF64}. 2777 2800 2778 2801 \begin{verbatim} … … 2901 2924 2902 2925 \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, 2926 psImage *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, 2906 2935 double exposedValue); 2907 2936 \end{verbatim} … … 2909 2938 transformation. The size of the transformed image is defined by the 2910 2939 supplied \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}).2940 otherwise (size \code{region.x1 - region.x0} by \code{region.y1 - 2941 region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 = 2942 region.y0}). 2914 2943 2915 2944 If the \code{inputMask} is non-\code{NULL}, those pixels in the … … 3117 3146 3118 3147 \begin{verbatim} 3119 psImage *psPixelsToMask(psImage *out, const psPixels *pixels, const psRegion *region, unsigned int maskVal);3148 psImage *psPixelsToMask(psImage *out, const psPixels *pixels, const psRegion region, unsigned int maskVal); 3120 3149 psPixels *psMaskToPixels(psPixels *out, const psImage *mask, unsigned int maskVal); 3121 3150 \end{verbatim} … … 3125 3154 \code{maskVal}. The \code{out} image shall be modified if supplied, 3126 3155 or 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} or3156 image shall be \code{region.x1 - region.x0} by \code{region.y1 - 3157 region.y0}, with \code{out->x0 = region.x0} and \code{out->y0 = 3158 region.y0}. In the event that either of \code{pixels} or 3130 3159 \code{region} are \code{NULL}, the function shall generate an error 3131 3160 and return \code{NULL}. … … 3159 3188 3160 3189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3161 3162 \subsection{Image Regions}3163 3164 In many places, we need to refer to a rectangular area. We define a3165 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 form3180 \code{[x0:x1,y0:y1]}, used for header entries such as \code{BIASSEC},3181 into the corresponding \code{psRegion} structure.3182 3190 3183 3191 \subsection{Vector and Image Arithmetic} … … 5145 5153 \begin{verbatim} 5146 5154 psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out, const psPlaneTransform *in, 5147 psRegion *region, int nSamples);5155 psRegion region, int nSamples); 5148 5156 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out, const psPlaneTransform *trans1, 5149 const psPlaneTransform *trans2, psRegion *region,5157 const psPlaneTransform *trans2, psRegion region, 5150 5158 int nSamples); 5151 5159 bool psPlaneTransformFit(psPlaneTransform *trans, const psArray *source, const psArray *dest,
Note:
See TracChangeset
for help on using the changeset viewer.
