IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13372


Ignore:
Timestamp:
May 12, 2007, 9:51:20 AM (19 years ago)
Author:
rhl
Message:

Allow pmMergeFootprintArrays to ignore some of peaks

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/pmFootprint.c

    r13351 r13372  
    893893    }
    894894
    895     psImage *grownIdImage = psImageConvolveDirect(idImage, circle);
     895    psImage *grownIdImage = psImageConvolveDirect(idImage, circle); // Here's the actual grow step
    896896    psFree(circle);     
    897897
    898     psArray *grown = pmFindFootprints(grownIdImage, 0.5, 1);
     898    psArray *grown = pmFindFootprints(grownIdImage, 0.5, 1); // and here we rebuild the grown footprints
    899899    assert (grown != NULL);
    900900    psFree(idImage); psFree(grownIdImage);
    901901    /*
    902902     * Now assign the peaks appropriately.  We could do this more efficiently
    903      * using idImage (which we just freed), but this is easy and probably fast enough
     903     * using grownIdImage (which we just freed), but this is easy and probably fast enough
    904904     */
    905905    const psArray *peaks = pmFootprintArrayToPeaks(footprints);
     
    918918 * their reference counters suitable incremented)
    919919 */
    920 psArray *pmMergeFootprintArrays(const psArray *footprints1,
    921                                 const psArray *footprints2) {
     920psArray *pmMergeFootprintArrays(const psArray *footprints1, // one set of footprints
     921                                const psArray *footprints2, // the other set
     922                                const int includePeaks) { // which peaks to set? 0x1 => footprints1, 0x2 => 2
    922923    assert (footprints1->n == 0 || pmIsFootprint(footprints1->data[0]));
    923924    assert (footprints2->n == 0 || pmIsFootprint(footprints2->data[0]));
     
    962963     * Now assign the peaks appropriately.  We could do this more efficiently
    963964     * using idImage (which we just freed), but this is easy and probably fast enough
    964      */
    965     const psArray *peaks;
     965     */
     966    if (includePeaks & 0x1) {
     967        const psArray *peaks = pmFootprintArrayToPeaks(footprints1);
     968        pmPeaksAssignToFootprints(merged, peaks);
     969        psFree((psArray *)peaks);
     970    }
     971
     972    if (includePeaks & 0x2) {
     973        const psArray *peaks = pmFootprintArrayToPeaks(footprints2);
     974        pmPeaksAssignToFootprints(merged, peaks);
     975        psFree((psArray *)peaks);
     976    }
    966977   
    967     peaks = pmFootprintArrayToPeaks(footprints1);
    968     pmPeaksAssignToFootprints(merged, peaks);
    969     psFree((psArray *)peaks);
    970 
    971     peaks = pmFootprintArrayToPeaks(footprints2);
    972     pmPeaksAssignToFootprints(merged, peaks);
    973     psFree((psArray *)peaks);
    974 
    975978    return merged;
    976979}
     
    10311034    psFree(ids);
    10321035    //
    1033     // Make sure that peaks within each footprint are sorted
     1036    // Make sure that peaks within each footprint are sorted and unique
    10341037    //
    10351038    for (int i = 0; i < footprints->n; i++) {
    10361039        pmFootprint *fp = footprints->data[i];
    10371040        fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN);
     1041
     1042        for (int j = 1; j < fp->peaks->n; j++) { // check for duplicates
     1043            if (fp->peaks->data[j] == fp->peaks->data[j-1]) {
     1044                (void)psArrayRemoveIndex(fp->peaks, j);
     1045                j--;                    // we moved everything down one
     1046            }
     1047        }
    10381048    }
    10391049
  • trunk/psphot/src/pmFootprint.h

    r13351 r13372  
    3636
    3737psArray *pmGrowFootprintArray(const psArray *footprints, int r);
    38 psArray *pmMergeFootprintArrays(const psArray *footprints1, const psArray *footprints2);
     38psArray *pmMergeFootprintArrays(const psArray *footprints1, const psArray *footprints2,
     39                                const int includePeaks);
    3940
    4041psImage *pmSetFootprintArrayIDs(const psArray *footprints, const bool relativeIDs);
Note: See TracChangeset for help on using the changeset viewer.