IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12742


Ignore:
Timestamp:
Apr 4, 2007, 12:42:48 PM (19 years ago)
Author:
Paul Price
Message:

Updating following API change to psImagePixelInterpolate

Location:
trunk/psModules/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmSkySubtract.c

    r12696 r12742  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-03-30 21:12:56 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-04-04 22:42:48 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535DetermineNumBits(data): This routine takes an enum psStatsOptions as an
    3636argument and returns the number of non-zero bits.
    37  
     37
    3838XXX: This code is duplicated in the ReadoutCombine file.
    3939 *****************************************************************************/
     
    9191input psImage and scales it smaller by a factor of binFactor.  The statistic
    9292used in combining input pixels is specified in statOptions.
    93  
     93
    9494XXX: use static vectors for myStats, binVector and binMask.
    9595XXX: I coded this before I was aware of a psLib reBin function.  I don't
     
    163163CalculatePolyTerms(xOrder, yOrder): this routine will calculate the number of
    164164coefficients (or terms) in a 2-D polynomial of order (xOrder, yOrder).
    165  
     165
    166166XXX: Use your brain and figure out the analytical expression.
    167  
     167
    168168XXX: Why isn't it simply (xOrder+1) * (yOrder+1)?
    169169 *****************************************************************************/
     
    199199    polyTerms[i][0] = the power to which X is raised in the i-th term of in an
    200200    poly-order sky background polynomial.
    201  
     201
    202202    polyTerms[i][1] = the power to which Y is raised in the i-th term of in an
    203203    poly-order sky background polynomial.
     
    248248This procedure calculates various combinations of powers of x and y and stores
    249249them in the data structure p_psPolySums[][].  After it completes:
    250  
     250
    251251    p_psPolySums[i][j] == x^i * y^j
    252  
     252
    253253XXX: Use a psImage for the p_psPolySums data structure?
    254254XXX: p_psPolySums: should this be a global?  Did you get the storage classifier
     
    296296used in this routine is based on that of the pilot project ADD, but is not
    297297documented anywhere.
    298  
     298
    299299XXX: Different trace message facilities in use here.
    300300 *****************************************************************************/
     
    471471/******************************************************************************
    472472pmReadout pmSubtractSky():
    473  
     473
    474474XXX: use static vectors for myStats, and the binned image
    475  
     475
    476476XXX: The SDR is silent about types.  PS_TYPE_F32 is implemented here.
    477  
     477
    478478XXX: Sync the psTrace message facilities.
    479479 *****************************************************************************/
     
    691691        }
    692692    } else {
     693
     694        psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR,
     695                                                                           binnedImage, NULL, NULL, 0,
     696                                                                           0.0, 0.0, 0, 0, 0.0);
     697
    693698        for (psS32 row = 0; row < trimmedImg->numRows ; row++) {
    694699            for (psS32 col = 0; col < trimmedImg->numCols ; col++) {
     
    705710                binColF64+= 0.5;
    706711
    707                 psF32 binPixel = (psF32) psImagePixelInterpolate(
    708                                      binnedImage, binColF64, binRowF64,
    709                                      NULL, 0, 0.0, PS_INTERPOLATE_BILINEAR);
    710                 trimmedImg->data.F32[row][col]-= binPixel;
     712                double binPixel;
     713                if (!psImagePixelInterpolate(&binPixel, NULL, NULL, binColF64, binRowF64, interp)) {
     714                    psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     715                    psFree(interp);
     716                    psFree(binnedImage);
     717                    return NULL;
     718                }
     719                trimmedImg->data.F32[row][col] -= binPixel;
    711720
    712721                psTrace("psModules.detrend", 8,
    713                         "image[%d][%d] <--> binnedImage[%.2f][%.2f]: %f\n",
     722                        "image[%d][%d] <--> binnedImage[%.2f][%.2f]: %lf\n",
    714723                        row, col, binRowF64-0.5, binColF64-0.5, binPixel);
    715724            }
    716725        }
     726        psFree(interp);
    717727
    718728    }
  • trunk/psModules/src/imcombine/pmImageCombine.c

    r11115 r12742  
    88 *  @author GLG, MHPCC
    99 *
    10  *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2007-01-16 23:51:51 $
     10 *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2007-04-04 22:42:48 $
    1212 *
    1313 *  XXX: pmRejectPixels() has a known bug with the pmImageTransform() call.
     
    375375image, this routine determines the size of the input image which maps to that
    376376image, and returns the result in a psRegion struct.
    377  
     377
    378378XXX: Basically, this routine is only guaranteed to work if the transform is
    379379linear.
    380  
     380
    381381XXX: Shouldn't this functionality be part of psImageTransform()?
    382382 *****************************************************************************/
     
    491491pmRejectPixels(images, errors, inToOut, outToIn, rejThreshold,
    492492gradLimit)
    493  
     493
    494494XXX: Optimization: we don't need to transform the entire mask image.
    495495XXX: The inToOut and outToIn transforms are confusing.  Verify that what
     
    591591        // in other images.
    592592        //
     593
     594        psImageInterpolateOptions *interp = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR,
     595                                                                           transformedImage, NULL, NULL,
     596                                                                           0, 0.0, 0.0, 0, 0, 0.0);
     597
    593598        for (psS32 p = 0 ; p < pixelList->n ; p++) {
    594599            inCoords->x = 0.5 + (psF32) (pixelList->data[p]).x;
    595600            inCoords->y = 0.5 + (psF32) (pixelList->data[p]).y;
    596601            psPlaneTransformApply(outCoords, myInToOut, inCoords);
    597             psF32 maskVal = (psF32) psImagePixelInterpolate(transformedImage, outCoords->x, outCoords->y,
    598                             NULL, 0, 0.0, PS_INTERPOLATE_BILINEAR);
     602            double maskVal;
     603            if (!psImageInterpolate(&maskVal, NULL, NULL, outCoords->x, outCoords->y, interp)) {
     604                psError(PS_ERR_UNKNOWN, false, "Unable to interpolate image.");
     605                psFree(interp);
     606                psFree(maskImage);
     607                psFree(maskImageF32);
     608                psFree(transformedImage);
     609                psFree(inCoords);
     610                psFree(outCoords);
     611                psFree(rejects);
     612                return NULL;
     613            }
    599614            if (maskVal > rejThreshold) {
    600615
     
    656671        }
    657672
     673        psFree(interp);
    658674        psFree(maskImage);
    659675        psFree(maskImageF32);
Note: See TracChangeset for help on using the changeset viewer.