IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16408


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.

Location:
branches/pap_branch_080207/ppStack/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080207/ppStack/src/ppStack.h

    r16407 r16408  
    5151/// Convolve image to match specified seeing
    5252bool ppStackMatch(pmReadout *readout, ///< Readout to be convolved; replaced with output
     53                  psArray **regions, // Array of regions used in each PSF matching, returned
     54                  psArray **kernels, // Array of kernels used in each PSF matching, returned
    5355                  const pmReadout *sourcesRO, ///< Readout with sources
    5456                  const pmPSF *psf,     ///< Target PSF
  • branches/pap_branch_080207/ppStack/src/ppStackLoop.c

    r16407 r16408  
    1010
    1111#include "ppStack.h"
    12 
    13 #define ARRAY_BUFFER 16                 // Number to add to array at a time
    1412
    1513// Here follows lists of files for activation/deactivation at various stages.  Each must be NULL-terminated.
     
    327325#ifndef CONVOLVED_ALREADY
    328326        // Background subtraction, scaling and normalisation is performed automatically by the image matching
    329         if (!ppStackMatch(readout, sources, targetPSF, config)) {
     327        psArray *regions = NULL, *kernels = NULL; // Regions and kernels used in subtraction
     328        if (!ppStackMatch(readout, &regions, &kernels, sources, targetPSF, config)) {
    330329            psError(PS_ERR_UNKNOWN, false, "Unable to match image %d --- ignoring.", i);
    331330            psFree(sources);
     
    333332            return false;
    334333        }
     334
     335        subRegions->data[i] = regions;
     336        subKernels->data[i] = kernels;
    335337
    336338        // Write the temporary convolved files
     
    342344#endif
    343345
    344         // Extract the regions and solutions used in the image matching
    345         // This stops them from being freed when we iterate back up the FPA
    346         psArray *regions = psArrayAllocEmpty(ARRAY_BUFFER); // Array of regions
    347         {
    348             psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,
    349                                                                PM_SUBTRACTION_ANALYSIS_REGION); // Iterator
    350             psMetadataItem *item = NULL;// Item from iteration
    351             while ((item = psMetadataGetAndIncrement(iter))) {
    352                 assert(item->type == PS_DATA_REGION);
    353                 regions = psArrayAdd(regions, ARRAY_BUFFER, item->data.V);
    354             }
    355             psFree(iter);
    356         }
    357         psArray *kernels = psArrayAllocEmpty(ARRAY_BUFFER); // Array of kernels
    358         {
    359             psMetadataIterator *iter = psMetadataIteratorAlloc(readout->analysis, PS_LIST_HEAD,
    360                                                                PM_SUBTRACTION_ANALYSIS_KERNEL); // Iterator
    361             psMetadataItem *item = NULL;// Item from iteration
    362             while ((item = psMetadataGetAndIncrement(iter))) {
    363                 assert(item->type == PS_DATA_VECTOR);
    364                 kernels = psArrayAdd(kernels, ARRAY_BUFFER, item->data.V);
    365             }
    366             psFree(iter);
    367         }
    368         assert(regions->n == kernels->n);
    369 
    370         subRegions->data[i] = regions;
    371         subKernels->data[i] = kernels;
    372346        cells->data[i] = psMemIncrRefCounter(readout->parent);
    373 
    374347        filesIterateUp(config);
    375348    }
  • 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.