IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14906


Ignore:
Timestamp:
Sep 20, 2007, 9:16:15 AM (19 years ago)
Author:
magnier
Message:

handle edge cases of 1x2, 2x1, and 1x1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070830/psLib/src/imageops/psImageUnbin.c

    r14861 r14906  
    77 *  @author Eugene Magnier, IfA
    88 *
    9  *  @version $Revision: 1.7.8.2 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-09-17 01:14:28 $
     9 *  @version $Revision: 1.7.8.3 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-09-20 19:16:15 $
    1111 *
    1212 *  Copyright 2007 Institute for Astronomy, University of Hawaii
     
    284284    }
    285285
     286    // limiting cases: Nx == 1 and/or Ny == 1
     287
     288    // if we have a single pixel, there is no spatial information
     289    if ((in->numCols == 1) && (in->numRows == 1)) {
     290        const double value = in->data.F32[0][0];
     291        return value;
     292    }
     293
    286294    // handle edge cases with extrapolation
    287295
     
    289297    const int iy = y - 0.5; // index of reference pixel
    290298
     299    // do numCols,Rows first so we are never < 0
    291300    const int Xs = PS_MAX (PS_MIN (ix, in->numCols - 2), 0);
    292301    const int Ys = PS_MAX (PS_MIN (iy, in->numRows - 2), 0);
     
    301310    const double rx = 1.0 - dx;
    302311    const double ry = 1.0 - dy;
     312
     313    // if Nx == 1, we have no x-dir spatial information
     314    if (in->numCols == 1) {
     315        double V0 = in->data.F32[Ys][Xs];
     316        double V1 = in->data.F32[Ye][Xs];
     317
     318        const double value = V0*ry + V1*dy;
     319        return value;
     320    }   
     321
     322    // if Ny == 1, we have no y-dir spatial information
     323    if (in->numRows == 1) {
     324        double V0 = in->data.F32[Ys][Xs];
     325        double V1 = in->data.F32[Ys][Xe];
     326
     327        const double value = V0*rx + V1*dx;
     328        return value;
     329    }   
    303330
    304331    // Vxy
Note: See TracChangeset for help on using the changeset viewer.