IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 11, 2008, 7:09:46 PM (18 years ago)
Author:
Paul Price
Message:

Since I'm throwing away the convolved image in ppStackMatch(), I need to extract the regions and kernels there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080207/ppStack/src/ppStackMatch.c

    r16373 r16408  
    99#include "ppStack.h"
    1010
     11#define ARRAY_BUFFER 16                 // Number to add to array at a time
     12
     13
    1114//#define TESTING
    1215
    13 bool ppStackMatch(pmReadout *readout, const pmReadout *sourcesRO, const pmPSF *psf, const pmConfig *config)
     16bool ppStackMatch(pmReadout *readout, psArray **regions, psArray **kernels,
     17                  const pmReadout *sourcesRO, const pmPSF *psf, const pmConfig *config)
    1418{
     19    assert(readout);
     20    assert(regions && !*regions);
     21    assert(kernels && !*kernels);
     22    assert(sourcesRO);
     23    assert(psf);
     24    assert(config);
     25
    1526    // Look up appropriate values from the ppSub recipe
    1627    bool mdok;                          // Status of MD lookup
     
    105116    readout->mask   = psMemIncrRefCounter(output->mask);
    106117    readout->weight = psMemIncrRefCounter(output->weight);
     118
     119    // Extract the regions and solutions used in the image matching
     120    // This stops them from being freed when we iterate back up the FPA
     121    *regions = psArrayAllocEmpty(ARRAY_BUFFER); // Array of regions
     122    {
     123        psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,
     124                                                           PM_SUBTRACTION_ANALYSIS_REGION); // Iterator
     125        psMetadataItem *item = NULL;// Item from iteration
     126        while ((item = psMetadataGetAndIncrement(iter))) {
     127            assert(item->type == PS_DATA_REGION);
     128            *regions = psArrayAdd(*regions, ARRAY_BUFFER, item->data.V);
     129        }
     130        psFree(iter);
     131    }
     132    *kernels = psArrayAllocEmpty(ARRAY_BUFFER); // Array of kernels
     133    {
     134        psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,
     135                                                           PM_SUBTRACTION_ANALYSIS_KERNEL); // Iterator
     136        psMetadataItem *item = NULL;// Item from iteration
     137        while ((item = psMetadataGetAndIncrement(iter))) {
     138            assert(item->type == PS_DATA_VECTOR);
     139            *kernels = psArrayAdd(*kernels, ARRAY_BUFFER, item->data.V);
     140        }
     141        psFree(iter);
     142    }
     143    assert((*regions)->n == (*kernels)->n);
     144
     145
    107146    psFree(output);
    108147
Note: See TracChangeset for help on using the changeset viewer.