IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9866


Ignore:
Timestamp:
Nov 5, 2006, 4:11:04 PM (20 years ago)
Author:
magnier
Message:

centroid shift for aperture ifdef-ed out

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r9843 r9866  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-11-03 15:21:15 $
     5 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-11-06 02:11:04 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    182182}
    183183
    184 // XXX the implemented version of psImageShift does not work (is inconsistent wrt psImageInterpolate frac pix def?)
    185 psImage *tmp_psImageShift (psImage *in, float dx, float dy)
    186 {
    187 
    188     int nx = in->numCols;
    189     int ny = in->numRows;
    190 
    191     psImage *out = psImageAlloc (nx, ny, PS_TYPE_F32);
    192 
    193     // we define an integer shift and a (positive) fractional shift
    194     int dxi = floor(dx);
    195     int dyi = floor(dy);
    196     float dxf = dx - dxi;  // +2.3 -> 2 and 0.3; -2.3 -> -3 and +0.7
    197     float dyf = dy - dyi;  // +2.3 -> 2 and 0.3; -2.3 -> -3 and +0.7
    198 
    199     // apply the integer shift
    200     int DXin = (dxi < 0) ? -dxi : 0;
    201     int DXot = (dxi < 0) ?   0  : dxi;
    202     int DYin = (dyi < 0) ? -dyi : 0;
    203     int DYot = (dyi < 0) ?   0  : dyi;
    204 
    205     for (int j = 0; j < ny - abs(dyi); j++) {
    206         for (int i = 0; i < nx - abs(dxi); i++) {
    207             out->data.F32[j+DYot][i+DXot] = in->data.F32[j+DYin][i+DXin];
    208         }
    209         // fill in the exposed x-border with 0.0
    210         int pix = (dxi > 0) ? 0 : nx - abs(dxi);
    211         for (int i = 0; i < abs(dxi); i++, pix++) {
    212             out->data.F32[j+DYot][pix] = 0.0;
    213         }
    214     }
    215 
    216     // fill in the exposed y-border with 0.0
    217     int pix = (dyi > 0) ? 0 : ny - abs(dyi);
    218     for (int j = 0; j < abs(dyi); j++, pix++) {
    219         for (int i = 0; i < nx; i++) {
    220             out->data.F32[pix][i] = 0.0;
    221         }
    222     }
    223 
    224     // apply the fractional shift
    225     if ((dxf > 0) || (dyf > 0)) {
    226         float value;
    227 
    228         double f00 =    dxf *   dyf;
    229         double f01 =    dxf *(1-dyf);
    230         double f10 = (1-dxf)*   dyf;
    231         double f11 = (1-dxf)*(1-dyf);
    232 
    233         for (int j = ny - 2; j >= 0; j--) {
    234             psF32 *V0 = out->data.F32[j+0];
    235             psF32 *V1 = out->data.F32[j+1];
    236             for (int i = nx - 2; i >= 0; i--, V0--, V1--) {
    237                 value  = V0[0] * f00;
    238                 value += V0[1] * f10;
    239                 value += V1[0] * f01;
    240                 value += V1[1] * f11;
    241                 V1[1] = value;
    242             }
    243         }
    244     }
    245     return out;
    246 }
    247 
    248184// return source aperture magnitude
    249185// interpolate the image pixels to place the center at xi+0.5,yi+0.5
     
    265201
    266202    // shift image to have centroid at xi+0.5, yi+0.5
    267     # if (1)
     203    # if (0)
     204        // this is necessary to make the measurement consistent with the growth model.
     205        // only do this if we are applying the model?
    268206        float dx = 0.5 - model->params->data.F32[PM_PAR_XPOS] + (int)model->params->data.F32[PM_PAR_XPOS];
    269207    float dy = 0.5 - model->params->data.F32[PM_PAR_YPOS] + (int)model->params->data.F32[PM_PAR_YPOS];
    270     psImage *tmpImage = tmp_psImageShift (image, dx, dy);
     208    psImage *tmpImage = psImageShift (NULL, image, dx, dy, 0.0, PS_INTERPOLATE_BICUBE);
    271209    # else
    272210
Note: See TracChangeset for help on using the changeset viewer.