IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 18, 2004, 5:18:31 PM (22 years ago)
Author:
Paul Price
Message:

Updating from SDRS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psImage.h

    r1576 r1585  
    4848psImage *
    4949psImageSubset(const psImage *image,     ///< parent image
    50               int width,                ///< subimage width (<= image.ncols - col0) 
    51               int height,               ///< subimage height (<= image.nrows - row0) 
     50              int nx,                   ///< subimage width (<= image.ncols - col0) 
     51              int ny,                   ///< subimage height (<= image.nrows - row0) 
    5252              int x0,                   ///< subimage starting col (0 <= col0 < ncols)   
    5353              int y0)                   ///< subimage starting row (0 <= row0 < nrows)   
     
    5757psImage *
    5858psImageSubsection(const psImage *image, ///< Parent image
    59                   const *section        ///< Image section, of the form [x1:x2,y1:y2]
    60     );
    61 
    62 
    63 /// Destroy the specified image (destroy children if they exist).
    64 void
    65 psImageFree(psImage *restrict image)    ///< free this image
    66 ;
    67 
    68 /** Destroy the pixels of the specified image */
    69 psImage *
    70 psImageFreePixels(psImage *restrict image) ///< Image whose pixels are to be freed
    71 ;
     59                  const char *section   ///< Image section, of the form [x1:x2,y1:y2]
     60    );
     61
    7262
    7363/// Create a copy of the specified image.
     
    7868;
    7969
     70
    8071/// Trim an image, in-place in memory
    8172psImage *
     
    8576    );
    8677           
    87 
    8878/*** various image pixel extractions ***/
     79
     80/** Direction in which to cut */
     81typedef enum {
     82    PS_CUT_X_POS,                       ///< Cut in positive x direction
     83    PS_CUT_X_NEG,                       ///< Cut in negative x direction
     84    PS_CUT_Y_POS,                       ///< Cut in positive y direction
     85    PS_CUT_Y_NEG                        ///< Cut in negative y direction
     86} psImageCutDirection;
    8987
    9088/// Extract pixels from rectlinear region to a vector.
    9189psVector *
    9290psImageSlice(psVector *out,             ///< Vector to output, or NULL
    93              const psImage *input,      ///< extract slice from this image
    94              int x,                     ///< starting x coord of region to slice
    95              int y,                     ///< starting y coord of region to slice
    96              int nx,                    ///< length of region in x
    97              int ny,                    ///< length of region in y
    98              int direction,             ///< direction of vector along slice
    99              const psStats *stats)      ///< defines statistics used to find output values
    100 ;
     91             psVector *coords,          ///< Returned coordinates along the slice, or NULL
     92             const psImage *input,      ///< Input image
     93             const psImage *mask,       ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     94             unsigned int maskVal,      ///< Value in mask to ignore
     95             unsigned int x,            ///< starting x coord of region to slice
     96             unsigned int y,            ///< starting y coord of region to slice
     97             unsigned int nx,           ///< length of region in x
     98             unsigned int ny,           ///< length of region in y
     99             psImageCutDirection direction, ///< Direction in which to cut
     100             const psStats *stats       ///< defines statistics used to find output values
     101    );
    101102
    102103/// Extract pixels along a line to a vector.
     
    104105psImageCut(psVector *out,               ///< Vector to output, or NULL
    105106           const psImage *input,        ///< extract cut from this image
     107           const psImage *mask,         ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     108           unsigned int maskVal,        ///< Value in mask to ignore
    106109           float xs,                    ///< starting x coord of cut
    107110           float ys,                    ///< starting y coord of cut
     
    109112           float ye,                    ///< ending y coord of cut
    110113           float dw,                    ///< width of cut
    111            const psStats *stats)                ///< defines statistics used to find output values
     114           const psStats *stats)        ///< defines statistics used to find output values
    112115;
    113116
     
    116119psImageRadialCut(psVector *out,         ///< Vector to output, or NULL
    117120                 const psImage *input,  ///< extract profile from this image
     121                 const psImage *mask,   ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     122                 unsigned int maskVal,  ///< Value in mask to ignore
    118123                 float x,               ///< center x coord of annulii
    119124                 float y,               ///< center y coord of annulii
     
    123128
    124129/*** various image geometry manipulation ***/
     130
     131/** How to do interpolation */
     132typedef enum {
     133    PS_INTERPOLATE_FLAT,
     134    PS_INTERPOLATE_BILINEAR,
     135    PS_INTERPOLATE_BICUBIC,
     136    PS_INTERPOLATE_SINC
     137} psImageInterpolateMode mode;
     138
    125139/// Rebin image to new scale.
    126140psImage *
    127141psImageRebin(psImage *out,              ///< Image to output, or NULL
    128              const psImage *input,      ///< rebin this image
    129              float scale,               ///< rebinning scale: doutput = scale*dinput
     142             const psImage *in,         ///< rebin this image
     143             const psImage *restrict mask, ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     144             unsigned int maskVal,      ///< Value in mask to ignore
     145             int scale,                 ///< rebinning scale
    130146             const psStats *stats)      ///< defines statistics used to find output values
    131147;
    132148
     149/** Resample image to new scale */
     150psImage *
     151psImageResample(psImage *out,           ///< Image to output, or NULL
     152                const psImage *in,      ///< resample this image
     153                int scale,              ///< Factor by which to resample
     154                psImageInterpolateMode mode ///< Interpolation method
     155    );
     156
    133157/// Rotate image by given angle.
    134158psImage *
    135159psImageRotate(psImage *out,             ///< Image to output, or NULL
    136               const psImage *input,     ///< rotate this image
    137               float angle)              ///< rotate by this amount anti-clockwise (degrees)
    138 ;
     160              const psImage *in,        ///< rotate this image
     161              float angle               ///< rotate by this amount anti-clockwise (degrees)
     162              psC64 exposed,            ///< Set exposed pixels to this value
     163              psImageInterpolateMode mode ///< Interpolation method
     164    );
    139165
    140166/// Shift image by an arbitrary number of pixels in either direction.
     
    142168psImage *
    143169psImageShift(psImage *out,              ///< Image to output, or NULL
    144              const psImage *input,      ///< shift this image
     170             const psImage *in,         ///< shift this image
    145171             float dx,                  ///< shift by this amount in x
    146172             float dy,                  ///< shift by this amount in y
    147              float exposed)             ///< set exposed pixels to this value
    148 ;
     173             psC64 exposed,             ///< set exposed pixels to this value
     174             psImageInterpolateMode mode ///< Interpolation method
     175);
    149176
    150177/// Roll image by an integer number of pixels in either direction.
     
    152179psImage *
    153180psImageRoll(psImage *out,               ///< Image to output, or NULL
    154             const psImage *input,       ///< roll this image
     181            const psImage *in,  ///< roll this image
    155182            int dx,                     ///< roll this amount in x
    156183            int dy)                     ///< roll this amount in y
     
    160187psStats *
    161188psImageGetStats(psStats *stats,         ///< defines statistics to be calculated & target
    162                 const psImage *input)   ///< image (or subimage) to calculate stats
    163 ;
     189                const psImage *in,      ///< image (or subimage) to calculate stats
     190                const psImage *mask,    ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     191                unsigned int maskVal    ///< Value in mask to ignore
     192    );
    164193
    165194/// Construct a histogram from an image (or subimage).
    166195psHistogram *
    167196psImageHistogram(psHistogram *hist,     ///< input histogram description & target
    168                  const psImage *input)  ///< determine histogram of this image
    169 ;
     197                 const psImage *in      ///< determine histogram of this image
     198                 const psImage *mask,   ///< Ignore those pixels where mask & maskVal == 1.  May be NULL
     199                 unsigned int maskVal   ///< Value in mask to ignore
     200    );
    170201
    171202/// Fit a 2-D polynomial surface to an image.
     
    177208/// Evaluate a 2-D polynomial surface to image pixels.
    178209psImage *
    179 psImageEvalPolynomial(const psImage *input, ///< image to produce
     210psImageEvalPolynomial(psImage *input,   ///< image to produce
    180211                      const psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms
    181212;
     213
     214/** Perform interpolation of image pixel values */
     215psF64
     216psImagePixelInterpolate(const psImage *input, ///< Image on which to interpolate
     217                        float x, float y, ///< Fractional pixel coordinates at which to interpolate
     218                        psC64 unexposedValue, ///< Value for pixels that don't have an input value
     219                        psImageInterpolateMode mode ///< Interpolation method
     220    );
     221
    182222
    183223/*** image input/output routines ***/
     
    185225psImage *
    186226psImageReadSection(psImage *output,     ///< place data in this structure for output
    187                    int x,               ///< starting x coord of region
    188                    int y,               ///< starting y coord of region
     227                   int x0,              ///< starting x coord of region
     228                   int y0,              ///< starting y coord of region
    189229                   int nx,              ///< x size of region (-1 for full range)
    190230                   int ny,              ///< y size of region (-1 for full range)
     
    192232                   const char *extname, ///< MEF extension name ("PHU" for primary header)
    193233                   int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    194                    const char *filename)        ///< file to read data from
    195 ;
    196 
    197 /// Read an image or subimage from file descriptor.
    198 psImage *
    199 psImageFReadSection(psImage *output,    ///< place data in this structure for output
    200                     int x,              ///< starting x coord of region           
    201                     int y,              ///< starting y coord of region           
    202                     int nx,             ///< x size of region (-1 for full range)         
    203                     int ny,             ///< y size of region (-1 for full range)         
    204                     int z,              ///< plane of interest                     
    205                     const char *extname, ///< MEF extension name ("PHU" for primary header)
    206                     int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    207                     FILE *f)            ///< file descriptor to read data from             
     234                   const char *filename) ///< file to read data from
    208235;
    209236
     
    219246;
    220247
    221 /// Write an image section to named file (which may exist).
    222 psImage *
    223 psImageFWriteSection(const psImage *input, ///< image to write out
    224                      int x,             ///< starting x coord of region           
    225                      int y,             ///< starting y coord of region           
    226                      int z,             ///< plane of interest                     
    227                      const char *extname, ///< MEF extension name                         
    228                      int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    229                      FILE *f)           ///< file descriptor to write data to             
    230 ;
    231 
    232248/*** basic pixel manipulations ***/
    233249/// Clip image values outside of range to given values.  Return number of clipped pixels.
    234250int
    235251psImageClip(psImage *input,             ///< Image to be clipped, and output
    236             float min,                  ///< clip pixels with values < min
    237             float vmin,                 ///< set min-clipped pixels to vmin
    238             float max,                  ///< clip pixels with values > max
    239             float vmax)                 ///< set max-clipped pixels to vmax
    240 ;
     252            double min,                 ///< clip pixels with values < min
     253            double vmin,                ///< set min-clipped pixels to vmin
     254            double max,                 ///< clip pixels with values > max
     255            double vmax)                ///< set max-clipped pixels to vmax
     256;
     257
     258/** Clipping for complex data */
     259int
     260psImageClipComplexRegion(psImage *input, ///< Image to be clipped, and output
     261                         complex double min, ///< clip pixels with values < min
     262                         complex double vmin, ///< set min-clipped pixels to vmin
     263                         complex double max, ///< clip pixels with values > max
     264                         complex double vmax ///< set max-clipped pixels to vmax
     265    );
    241266
    242267/// Clip NaN image pixels to given value.  Return number of clipped pixels.
Note: See TracChangeset for help on using the changeset viewer.