IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 278


Ignore:
Timestamp:
Mar 22, 2004, 4:33:23 PM (22 years ago)
Author:
Paul Price
Message:

Tidied up the definitions.
Put in *out arguments for several functions.
Added const for function arguments.

File:
1 edited

Legend:

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

    r269 r278  
    3939psImageAlloc (int nx,                   ///< image width
    4040              int ny,                   ///< image height
    41               psType type)              ///< image data type
    42 ;
     41              psType type               ///< image data type
     42    );
    4343
    4444/// Create a subimage of the specified area.
    4545psImage *
    46 psImageSubset (psImage *image,          ///< parent image
    47                int nx,                  ///< subimage width (<= image.nx - x0) 
    48                int ny,                  ///< subimage width (<= image.ny - y0) 
    49                int x0,                  ///< subimage x-offset (0 <= x0 < nx)   
    50                int y0)                  ///< subimage y-offset (0 <= y0 < ny)   
    51 ;
     46psImageSubset(psImage *out,             //!< Subimage to return, or NULL
     47              const psImage *image,     ///< parent image
     48              int nx,                   ///< subimage width (<= image.nx - x0) 
     49              int ny,                   ///< subimage width (<= image.ny - y0) 
     50              int x0,                   ///< subimage x-offset (0 <= x0 < nx)   
     51              int y0                    ///< subimage y-offset (0 <= y0 < ny)   
     52    );
    5253
    5354/// Destroy the specified image (destroy children if they exist).
    5455void
    55 psImageFree (psImage *image)            ///< free this image
    56 ;
    57 
    58 /// Destroy the children of the specified image.
     56psImageFree(psImage *restrict image     ///< free this image
     57    );
     58
     59/** Destroy the pixels of the specified image */
     60psImage *
     61psImageFreePixels(psImage *restrict image //!< Image whose pixels are to be freed
     62    );
     63
     64/// Destroy the children of the specified image.  Returns number of children freed.
    5965int
    60 psImageFreeChildren (psImage *image)    ///< free children of this image
    61 ;
     66psImageFreeChildren(const psImage *image ///< free children of this image
     67);
    6268
    6369/// Create a copy of the specified image.
    6470psImage *
    65 psImageCopy (psImage *output,           ///< target structure for output image data
    66              psImage *input)            ///< copy this image
    67 ;
     71psImageCopy(psImage *output,            ///< target structure for output image data
     72            const psImage *input        ///< copy this image
     73    );
    6874
    6975/*** various image pixel extractions ***/
     
    7177/// Extract pixels from rectlinear region to a vector.
    7278psFloatArray *
    73 psImageSlice (psImage *input,           ///< extract slice from this image
    74               int x,                    ///< starting x coord of region to slice
    75               int y,                    ///< starting y coord of region to slice
    76               int nx,                   ///< width of region in x
    77               int ny,                   ///< width of region in y
    78               int direction,            ///< direction of vector along slice
    79               psStats *stats)           ///< defines statistics used to find output values
    80 ;
     79psImageSlice(psFloatArray *out,         //!< Vector to output, or NULL
     80             const psImage *input,      ///< extract slice from this image
     81             int x,                     ///< starting x coord of region to slice
     82             int y,                     ///< starting y coord of region to slice
     83             int nx,                    ///< width of region in x
     84             int ny,                    ///< width of region in y
     85             int direction,             ///< direction of vector along slice
     86             const psStats *stats       ///< defines statistics used to find output values
     87    );
    8188
    8289/// Extract pixels along a line to a vector.
    8390psFloatArray *
    84 psImageCut (psImage *input,             ///< extract cut from this image
    85             float xs,                   ///< starting x coord of cut
    86             float ys,                   ///< starting y coord of cut
    87             float xe,                   ///< ending x coord of cut
    88             float ye,                   ///< ending y coord of cut
    89             float dw,                   ///< width of cut
    90             psStats *stats)             ///< defines statistics used to find output values
    91 ;
     91psImageCut(psFloatArray *out,           //!< Vector to output, or NULL
     92           const psImage *input,        ///< extract cut from this image
     93           float xs,                    ///< starting x coord of cut
     94           float ys,                    ///< starting y coord of cut
     95           float xe,                    ///< ending x coord of cut
     96           float ye,                    ///< ending y coord of cut
     97           float dw,                    ///< width of cut
     98           const psStats *stats         ///< defines statistics used to find output values
     99    );
    92100
    93101/// Extract radial annulii data to a vector.
    94102psFloatArray *
    95 psImageRadialCut (psImage *input,       ///< extract profile from this image
    96                   float x,              ///< center x coord of annulii
    97                   float y,              ///< center y coord of annulii
    98                   float radius,         ///< outer radius of annulii
    99                   float dr,             ///< radial step size of annulii
    100                   psStats *stats)               ///< defines statistics used to find output values
    101 ;
     103psImageRadialCut(psFloatArray *out,     //!< Vector to output, or NULL
     104                 const psImage *input,  ///< extract profile from this image
     105                 float x,               ///< center x coord of annulii
     106                 float y,               ///< center y coord of annulii
     107                 float radius,          ///< outer radius of annulii
     108                 float dr,              ///< radial step size of annulii
     109                 const psStats *stats   ///< defines statistics used to find output values
     110    );
    102111
    103112/// Extract a 2-d contour from an image at the given threshold.
    104113psFloatArray *
    105 psImageContour (psImage *input,         ///< create contour for this image
    106                 float threshold,        ///< contour image at this threshold
    107                 int binning)            ///< bin image by this value for contour calculation
    108 ;
     114psImageContour(psFloatArray *out,       //!< Vector to output, or NULL
     115               const psImage *input,    ///< create contour for this image
     116               float threshold, ///< contour image at this threshold
     117               int binning              ///< bin image by this value for contour calculation
     118    );
    109119
    110120/*** various image geometry manipulation ***/
    111121/// Rebin image to new scale.
    112122psImage *
    113 psImageRebin (psImage *input,           ///< rebin this image
    114               float scale,              ///< rebinning scale: doutput = scale*dinput
    115               psStats *stats)           ///< defines statistics used to find output values
    116 ;
     123psImageRebin(psImage *out,              //!< Image to output, or NULL
     124             const psImage *input,      ///< rebin this image
     125             float scale,               ///< rebinning scale: doutput = scale*dinput
     126             const psStats *stats       ///< defines statistics used to find output values
     127    );
    117128
    118129/// Rotate image by given angle.
    119130psImage *
    120 psImageRotate (psImage *input,          ///< rotate this image
    121                float angle)             ///< rotate by this amount (degrees)
    122 ;
     131psImageRotate(psImage *out,             //!< Image to output, or NULL
     132              const psImage *input,     ///< rotate this image
     133              float angle               ///< rotate by this amount anti-clockwise (degrees)
     134    );
    123135
    124136/// Shift image by an arbitrary number of pixels in either direction.
    125137/// Drop edge pixels, and set newly exposed pixels to 'exposed'.
    126138psImage *
    127 psImageShift (psImage *input,           ///< shift this image
    128               float dx,                 ///< shift by this amount in x
    129               float dy,                 ///< shift by this amount in y
    130               float exposed)            ///< set exposed pixels to this value
    131 ;
     139psImageShift(psImage *out,              //!< Image to output, or NULL
     140             const psImage *input,      ///< shift this image
     141             float dx,                  ///< shift by this amount in x
     142             float dy,                  ///< shift by this amount in y
     143             float exposed              ///< set exposed pixels to this value
     144    );
    132145
    133146/// Roll image by an integer number of pixels in either direction.
    134147/// Edge pixels wrap to the other side (no values are lost).
    135148psImage *
    136 psImageRoll (psImage *input,            ///< roll this image
    137              int dx,                    ///< roll this amount in x
    138              int dy)                    ///< roll this amount in y
    139 ;
     149psImageRoll(psImage *out,               //!< Image to output, or NULL
     150            const psImage *input,       ///< roll this image
     151            int dx,                     ///< roll this amount in x
     152            int dy                      ///< roll this amount in y
     153    );
    140154
    141155/// Determine statistics for image (or subimage).
    142156psStats *
    143 psImageGetStats (psImage *input,        ///< image (or subimage) to calculate stats
    144                  psStats *stats)        ///< defines statistics to be calculated
    145 ;
     157psImageGetStats(psImage *out,           //!< Image to output, or NULL
     158                const psImage *input,   ///< image (or subimage) to calculate stats
     159                psStats *stats          ///< defines statistics to be calculated & target
     160    );
    146161
    147162/// Construct a histogram from an image (or subimage).
    148163psHistogram *
    149 psImageHistogram (psHistogram *hist,    ///< input histogram description & target
    150                   psImage *input)       ///< determine histogram of this image
    151 ;
     164psImageHistogram(psHistogram *hist,     ///< input histogram description & target
     165                 const psImage *input   ///< determine histogram of this image
     166    );
    152167
    153168/// Fit a 2-D polynomial surface to an image.
    154169psPolynomial2D *
    155 psImageFitPolynomial (psImage *input,   ///< image to fit
    156                       psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms
    157 ;
     170psImageFitPolynomial(const psImage *input, ///< image to fit
     171                     psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
     172    );
    158173
    159174/// Evaluate a 2-D polynomial surface to image pixels.
    160175int
    161 psImageEvalPolynomial (psImage *input,  ///< image to fit
    162                        psPolynomial2D *coeffs) ///< coefficient structure carries in desired terms
    163 ;
     176psImageEvalPolynomial(const psImage *input, ///< image to fit
     177                      const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
     178    );
    164179
    165180/*** image input/output routines ***/
    166181/// Read an image or subimage from a named file.
    167182psImage *
    168 psImageReadSection (psImage *output,    ///< place data in this structure for output
    169                     int x,              ///< starting x coord of region
    170                     int y,              ///< starting y coord of region
    171                     int nx,             ///< x size of region (-1 for full range)
    172                     int ny,             ///< y size of region (-1 for full range)
    173                     int z,              ///< plane of interest
    174                     char *extname,      ///< MEF extension name ("PHU" for primary header)
     183psImageReadSection(psImage *output,     ///< place data in this structure for output
     184                   int x,               ///< starting x coord of region
     185                   int y,               ///< starting y coord of region
     186                   int nx,              ///< x size of region (-1 for full range)
     187                   int ny,              ///< y size of region (-1 for full range)
     188                   int z,               ///< plane of interest
     189                   const char *extname, ///< MEF extension name ("PHU" for primary header)
     190                   int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
     191                   const char *filename ///< file to read data from
     192    );
     193
     194/// Read an image or subimage from file descriptor.
     195psImage *
     196psImageFReadSection(psImage *output,    ///< place data in this structure for output
     197                    int x,              ///< starting x coord of region           
     198                    int y,              ///< starting y coord of region           
     199                    int dx,             ///< x size of region (-1 for full range)         
     200                    int dy,             ///< y size of region (-1 for full range)         
     201                    int z,              ///< plane of interest                     
     202                    const char *extname, ///< MEF extension name ("PHU" for primary header)
    175203                    int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    176                     char *filename)     ///< file to read data from
    177 ;
    178 
    179 /// Read an image or subimage from file descriptor.
    180 psImage *
    181 psImageFReadSection (psImage *output,   ///< place data in this structure for output
    182                      int x,             ///< starting x coord of region           
    183                      int y,             ///< starting y coord of region           
    184                      int dx,            ///< x size of region (-1 for full range)         
    185                      int dy,            ///< y size of region (-1 for full range)         
    186                      int z,             ///< plane of interest                     
    187                      char *extname,     ///< MEF extension name ("PHU" for primary header)                         
    188                      int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    189                      FILE *f)           ///< file descriptor to read data from             
    190 ;
     204                    const FILE *f       ///< file descriptor to read data from             
     205    );
    191206
    192207/// Write an image section to named file (which may exist).
    193208psImage *
    194 psImageWriteSection (psImage *input,    ///< image to write out
    195                      int x,             ///< starting x coord of region           
    196                      int y,             ///< starting y coord of region           
    197                      int z,             ///< plane of interest                     
    198                      char *extname,     ///< MEF extension name ("PHU" for primary header)                         
    199                      int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    200                      char *filename)    ///< file to write data to                 
    201 ;
     209psImageWriteSection(psImage *input,    ///< image to write out
     210                    int x,              ///< starting x coord of region           
     211                    int y,              ///< starting y coord of region           
     212                    int z,              ///< plane of interest                     
     213                    const char *extname, ///< MEF extension name ("PHU" for primary header)
     214                    int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
     215                    const char *filename ///< file to write data to               
     216    );
    202217
    203218/// Write an image section to named file (which may exist).
     
    207222                     int y,             ///< starting y coord of region           
    208223                     int z,             ///< plane of interest                     
    209                      char *extname,     ///< MEF extension name                   
     224                     const char *extname, ///< MEF extension name                         
    210225                     int extnum,        ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    211                      FILE *f)           ///< file descriptor to write data to             
    212 ;
     226                     const FILE *f      ///< file descriptor to write data to             
     227    );
    213228
    214229/// Read only header from image file.
    215 struct psMetadata *
    216 psImageReadHeader(struct psMetadata *output,    ///< read data to this structure
    217                   char *extname,        ///< MEF extension name ("PHU" for primary header)
     230psMetadata *
     231psImageReadHeader(psMetadata *output,   ///< read data to this structure
     232                  const char *extname,  ///< MEF extension name ("PHU" for primary header)
    218233                  int extnum,           ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    219                   char *filename)       ///< file to read from
    220 ;
     234                  const char *filename  ///< file to read from
     235    );
    221236
    222237/// Read only header from image file descriptor.
    223 struct psMetadata *
    224 psImageFReadHeader (struct psMetadata *output, ///< read data to this structure
    225                     char *extname,      ///< MEF extension name ("PHU" for primary header)
    226                     int extnum,         ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
    227                     FILE *f)            ///< file descriptor to read from
    228 ;
     238psMetadata *
     239psImageFReadHeader(psMetadata *output, ///< read data to this structure
     240                   const char *extname, ///< MEF extension name ("PHU" for primary header)
     241                   int extnum,          ///< MEF extension number (-1 for "PHU", 0 : Nextend - 1)
     242                   const FILE *f        ///< file descriptor to read from
     243    );
    229244
    230245/*** image FFT operations ***/
    231246/// Perform an FFT on the image.
    232247psImage *
    233 psImageFFT (psImage *input,             ///< image to FFT
    234             int direction)              ///< FFT direction
    235 ;
     248psImageFFT(psImage *input,              ///< image to FFT
     249           int direction                ///< FFT direction
     250    );
    236251
    237252/*** basic pixel manipulations ***/
    238 /// Clip image values outside of range to given values.
     253/// Clip image values outside of range to given values.  Return number of clipped pixels.
    239254int
    240 psImageClip (psImage *input,            ///< clip this image
    241              float min,                 ///< clip pixels with values < min
    242              float vmin,                ///< set min-clipped pixels to vmin
    243              float max,                 ///< clip pixels with values > max
    244              float vmax)                ///< set max-clipped pixels to vmax
    245 ;
    246 
    247 /// Clip NaN image pixels to given value.
     255psImageClip(psImage *input,             ///< clip this image
     256            float min,                  ///< clip pixels with values < min
     257            float vmin,                 ///< set min-clipped pixels to vmin
     258            float max,                  ///< clip pixels with values > max
     259            float vmax                  ///< set max-clipped pixels to vmax
     260    );
     261
     262/// Clip NaN image pixels to given value.  Return number of clipped pixels.
    248263int
    249 psImageClipNaN (psImage *input,         ///< clip this image
    250                 float value)            ///< set nan pixels to this value
    251 ;
    252 
    253 /// Overlay subregion of image with another image.
     264psImageClipNaN(psImage *input,          ///< clip this image & target
     265               float value              ///< set nan pixels to this value
     266    );
     267
     268/// Overlay subregion of image with another image.  Return number of pixels replaced.
    254269int
    255 psImageOverlaySection (psImage *image,  ///< input image
    256                 psImage *overlay,       ///< image to overlay
    257                 int x0,                 ///< x offset of overlay subimage
    258                 int y0,                 ///< y offset of overlay subimage
    259                 char *operator)         ///< overlay operation
    260 ;
     270psImageOverlaySection(psImage *image,   ///< input image & target
     271                      const psImage *overlay, ///< image to overlay
     272                      int x0,           ///< x offset of overlay subimage
     273                      int y0,           ///< y offset of overlay subimage
     274                      const char *operator ///< overlay operation
     275    );
    261276
    262277/* \} */ // End of AstroGroup Functions
Note: See TracChangeset for help on using the changeset viewer.