IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 5:10:36 PM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090128. Resolved a small number of conflicts. Compiles, but not tested in detail.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpTransformTile.c

    r21323 r21368  
    66 *
    77 *  @author IfA
    8  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2009-02-05 20:44:04 $
     8 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2009-02-06 03:10:36 $
    1010 *  Copyright 2009 Institute for Astronomy, University of Hawaii
    1111 */
     
    2020    psFree(args->interp);
    2121    psFree(args->region);
     22    psFree(args->covariance);
    2223    return;
    2324}
     
    4243    args->yMin = PS_MAX_S32;
    4344    args->yMax = PS_MIN_S32;
     45    args->covariance = NULL;
    4446
    4547    return args;
     
    6062    // Dereference images for convenience
    6163    psF32 **outImageData     = args->output->image->data.F32;
    62     psF32 **outVarData       = (args->output->weight) ? args->output->weight->data.F32 : NULL;
     64    psF32 **outVarData       = (args->output->variance) ? args->output->variance->data.F32 : NULL;
    6365    psImageMaskType **outMaskData = (args->output->mask)   ? args->output->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
    6466    psImageMaskType **inMaskData  = (args->input->mask)    ? args->input->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
     
    9294            }
    9395
    94             double imageValue, varValue; // Value of image and variance map
    95 
    9696            // psImagePixelInterpolate determines the value at pixel coordinate (x,y) in child coordinates
     97            double imageValue, varValue; // Value of image and variance map
    9798            psImageMaskType maskValue = inMaskData ? inMaskData[(int)yIn][(int)xIn] : 0; // Value of mask
    98 
    9999            if (!psImageInterpolate(&imageValue, &varValue, &maskValue, xIn, yIn, args->interp)) {
    100100                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     
    118118    }
    119119
     120    if (goodPixels > 0) {
     121        float xOut = 0.5 * (xMin + xMax), yOut = 0.5 * (yMin + yMax); // Position of interest on output
     122        double xIn, yIn;                // Position of interest on input
     123        pswarpMapApply(&xIn, &yIn, map, xOut + 0.5, yOut + 0.5);
     124        // XXX Why are we subtracting the *output* col0,row0 from the *input* coordinates?
     125        // I expect these are zero, so that it makes no difference, but it's distracting.
     126        xIn -= outCol0;
     127        yIn -= outRow0;
     128        psKernel *kernel = psImageInterpolationKernel(xIn, yIn, args->interp->mode); // Interpolation kernel
     129        args->covariance = psImageCovarianceCalculate(kernel, args->input->covariance);
     130        psFree(kernel);
     131    }
     132
    120133    args->goodPixels = goodPixels;
    121134    args->xMin = xMin;
Note: See TracChangeset for help on using the changeset viewer.