IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 10, 2010, 7:38:54 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201

File:
1 edited

Legend:

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

    r25758 r26896  
    3131
    3232    // Transform sources
    33     psArray *inSources = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.SOURCES"); // Sources in source
     33    pmDetections *inDetections = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.DETECTIONS"); // Sources in source
     34    if (!inDetections) return true;
     35    psArray *inSources = inDetections->allSources;
    3436    if (!inSources) return true;
    3537
    3638    pswarpMapGrid *sourceGrid = pswarpMapGridFromImage(output, input, nGridX, nGridY); // Grid for sources
    3739
    38     psArray *outSources = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, output->analysis, "PSPHOT.SOURCES")); // Target sources
     40    pmDetections *outDetections = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, output->analysis, "PSPHOT.DETECTIONS")); // Target sources
     41    if (!outDetections) {
     42        outDetections = pmDetectionsAlloc();
     43        psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY, "Warped sources", outDetections);
     44    }
     45    psArray *outSources = outDetections->allSources;
    3946    if (!outSources) {
    40         outSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER);
    41         psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY,
    42                          "Warped sources", outSources);
     47        outDetections->allSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER);
     48        outSources = outDetections->allSources;
    4349    }
    4450
     
    5763            psError(PS_ERR_UNKNOWN, false, "Unable to get grid coordinates for source at %f,%f\n",
    5864                    xIn, yIn);
    59             psFree(outSources);
     65            psFree(outDetections);
    6066            psFree(sourceGrid);
    6167            return false;
     
    7278            psError(PS_ERR_UNKNOWN, false, "Unable to transform coordinates for source at %f,%f\n",
    7379                    xIn, yIn);
    74             psFree(outSources);
     80            psFree(outDetections);
    7581            psFree(sourceGrid);
    7682            return false;
     
    142148    }
    143149    psFree(sourceGrid);
    144     psFree(outSources);             // Drop reference
     150    psFree(outDetections);             // Drop reference
    145151    return true;
    146152}
Note: See TracChangeset for help on using the changeset viewer.