IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 13, 2008, 2:29:14 PM (18 years ago)
Author:
Paul Price
Message:

Fix for outrageous use of memory when combining GPC images --- there are so many chips and cells, each with their own concepts metadata, that the memory is filled with metadataItems. Added a purge of the ones that aren't required. Since the concepts are integral to the system, it's sometimes necessary when iterating to skip cells that have had the concepts purged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeMaskAverageConcepts.c

    r15937 r16989  
    1818// Generate a mask
    1919bool ppMergeMaskAverageConcepts(ppMergeData *data,  // Data
    20                                 ppMergeOptions *options, // Options
    21                                 pmConfig *config    // Configuration
     20                                ppMergeOptions *options, // Options
     21                                pmConfig *config    // Configuration
    2222    )
    2323{
     
    3838        while ((cellOut = pmFPAviewNextCell(view, fpaOut, 1))) {
    3939
     40            pmHDU *hdu = pmHDUGetLowest(fpaOut, chipOut, cellOut);
     41            if (!hdu || hdu->blankPHU) {
     42                continue;
     43            }
     44
    4045            // Get list of cells for concepts averaging
    41             psList *inCells = psListAlloc(NULL); // List of cells
    42             for (int i = 0; i < filenames->n; i++) {
    43                 if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
    44                     continue;
    45                 }
    46                 pmCell *cellIn = pmFPAviewThisCell(view, data->in->data[i]); // Input cell
    47                 psListAdd(inCells, PS_LIST_TAIL, cellIn);
    48             }
    49             if (!pmConceptsAverageCells(cellOut, inCells, NULL, NULL, true)) {
    50                 psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
    51                 psFree(inCells);
    52                 return false;
    53             }
    54             psFree(inCells);
     46            psList *inCells = psListAlloc(NULL); // List of cells
     47            for (int i = 0; i < filenames->n; i++) {
     48                if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
     49                    continue;
     50                }
     51                pmCell *cellIn = pmFPAviewThisCell(view, data->in->data[i]); // Input cell
     52                psListAdd(inCells, PS_LIST_TAIL, cellIn);
     53            }
     54            if (!pmConceptsAverageCells(cellOut, inCells, NULL, NULL, true)) {
     55                psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
     56                psFree(inCells);
     57                return false;
     58            }
     59            psFree(inCells);
    5560        }
    5661    }
     
    5964    psList *inFPAs = psListAlloc(NULL); // List of FPAs
    6065    for (int i = 0; i < filenames->n; i++) {
    61         if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
    62             continue;
    63         }
    64         pmFPA *fpaIn = data->in->data[i]; // Input FPA
    65         psListAdd(inFPAs, PS_LIST_TAIL, fpaIn);
     66        if (! filenames->data[i] || strlen(filenames->data[i]) == 0) {
     67            continue;
     68        }
     69        pmFPA *fpaIn = data->in->data[i]; // Input FPA
     70        psListAdd(inFPAs, PS_LIST_TAIL, fpaIn);
    6671    }
    6772
    6873    if (!pmConceptsAverageFPAs(fpaOut, inFPAs)) {
    69         psError(PS_ERR_UNKNOWN, false, "Unable to average FPA concepts.");
    70         psFree(inFPAs);
    71         return false;
     74        psError(PS_ERR_UNKNOWN, false, "Unable to average FPA concepts.");
     75        psFree(inFPAs);
     76        return false;
    7277    }
    7378    psFree(inFPAs);
Note: See TracChangeset for help on using the changeset viewer.