IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12588


Ignore:
Timestamp:
Mar 26, 2007, 4:43:22 PM (19 years ago)
Author:
magnier
Message:

created a common set of routines to define the binning parameters

Location:
trunk/psLib/src
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/Makefile.am

    r12183 r12588  
    1313        psImageStructManip.c \
    1414        psImageMaskOps.c \
     15        psImageBinning.c \
    1516        psImageUnbin.c
    1617
     
    2627        psImageStructManip.h \
    2728        psImageMaskOps.h \
     29        psImageBinning.h \
    2830        psImageUnbin.h
    2931
  • trunk/psLib/src/imageops/psImageUnbin.c

    r11795 r12588  
     1/** @file  psImageUnbin.c
     2 *
     3 *  @brief Functions to perform unbinning (resampling) of images.
     4 *
     5 *  @ingroup Image
     6 *
     7 *  @author Eugene Magnier, IfA
     8 *
     9 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-03-27 02:43:22 $
     11 *
     12 *  Copyright 2007 Institute for Astronomy, University of Hawaii
     13 */
     14
    115#ifdef HAVE_CONFIG_H
    216# include "config.h"
     
    418
    519#include <stdio.h>
    6 
    720#include "psError.h"
     21#include "psAssert.h"
     22#include "psRegion.h"
    823#include "psImage.h"
    9 #include "psAssert.h"
     24#include "psImageBinning.h"
    1025#include "psImageUnbin.h"
    1126
     
    1530// binned pixel.
    1631// XXX check that this is still consistent with psphotImageMedian...
    17 psImage *psImageUnbin(psImage *out, const psImage *in, int DX, int DY, int dx, int dy)
     32psImage *psImageUnbin(psImage *out, const psImage *in, const psImageBinning *binning)
    1833{
    1934    PS_ASSERT_IMAGE_NON_NULL(in, NULL);
    2035    PS_ASSERT_IMAGE_NON_NULL(out, NULL);
     36
     37    int DX = binning->nXbin;
     38    int DY = binning->nYbin;
     39    int dx = binning->nXskip;
     40    int dy = binning->nYskip;
     41
    2142    PS_ASSERT_INT_POSITIVE(DX, NULL);
    2243    PS_ASSERT_INT_POSITIVE(DY, NULL);
     
    2849    long Nx = out->numCols;
    2950    long Ny = out->numRows;
     51
     52    // XXX validate the binning structure vs the input and output images?
    3053
    3154    psF32 **vIn = in->data.F32;
     
    183206 * cases should be added
    184207 */
    185 double psImageUnbinPixel(const int ix, const int iy, // desired Unbinned point
     208double psImageUnbinPixel(const int ix, const int iy, // desired Unbinned point (parent coords)
    186209                         const psImage *in, // binned image
    187                          const int DX, const int DY,  //!< Scaling factors in x and y
    188                          const int dx, const int dy)   //!< Overhang
     210                         const psImageBinning *binning)   //!< Overhang
    189211{
     212
     213    int DX = binning->nXbin;
     214    int DY = binning->nYbin;
     215    int dx = binning->nXskip;
     216    int dy = binning->nYskip;
     217
    190218    PS_ASSERT_IMAGE_NON_NULL(in, NAN);
    191219    assert (in->type.type == PS_TYPE_F32);
     220
    192221    PS_ASSERT_INT_POSITIVE(DX, NAN);
    193222    PS_ASSERT_INT_POSITIVE(DY, NAN);
     
    197226     * Find which binned pixel we're in
    198227     */
    199     const int Xs = (ix + dx)/DX; // index of binned pixel
    200     const int Ys = (iy + dy)/DY;
     228
     229    const int Xs = (ix - dx)/DX; // index of binned pixel
     230    const int Ys = (iy - dy)/DY;
    201231    if (Xs < 0 || Xs >= in->numCols || Ys < 0 || Ys >= in->numRows) {
    202232        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Point (%d,%d) lies outside binned image", ix, iy);
  • trunk/psLib/src/imageops/psImageUnbin.h

    r11248 r12588  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  $Date: 2007-01-23 22:47:23 $
     8 *  $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9 *  $Date: 2007-03-27 02:43:22 $
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1111 */
     
    1717/// @{
    1818
    19 #include "psImage.h"
    20 
    2119// This needs to be considered more carefully
    2220psImage *psImageUnbin (psImage *out,    //!< Output image
    2321                       const psImage *in, //!< Input image
    24                        int DX, int DY,  //!< Scaling factors in x and y
    25                        int dx, int dy   //!< Overhang
    26                       );
     22                       const psImageBinning *binning ///< binning definition
     23    );
     24
    2725double psImageUnbinPixel(const int ix, const int iy, //!< desired Unbinned point
    2826                         const psImage *in, //!< binned image
    29                          const int DX, const int DY,  //!< Scaling factors in x and y
    30                          const int dx, const int dy   //!< Overhang
     27                         const psImageBinning *binning ///< binning definition
    3128                        );
    3229
  • trunk/psLib/src/pslib_strict.h

    r11669 r12588  
    99*  @author Eric Van Alst, MHPCC
    1010*
    11 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2007-02-06 21:55:28 $
     11*  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2007-03-27 02:43:22 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4343//#include "psXML.h"
    4444
     45#include "psRegion.h"
    4546#include "psImageConvolve.h"
    4647#include "psImageGeomManip.h"
     
    5051#include "psImageStructManip.h"
    5152#include "psImageMaskOps.h"
     53#include "psImageBinning.h"
    5254#include "psImageUnbin.h"
    5355
     
    6567#include "psMinimizePolyFit.h"
    6668#include "psRandom.h"
    67 #include "psRegion.h"
    6869#include "psRegionForImage.h"
    6970#include "psPolynomial.h"
Note: See TracChangeset for help on using the changeset viewer.