IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 27, 2008, 2:59:07 PM (18 years ago)
Author:
Paul Price
Message:

Adding count and sigma files as outputs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080320/ppMerge/src/ppMergeCamera.c

    r17090 r17157  
    55#include <stdio.h>
    66#include <string.h>
     7#include <assert.h>
    78#include <pslib.h>
    89#include <psmodules.h>
     
    1011#include "ppMerge.h"
    1112
     13// Define an output file, with its own FPA
     14bool outputFile(pmConfig *config,       // Configuration
     15                const char *name,       // Name of output file
     16                pmFPAfileType type,     // Type of file
     17                const char *description, // Description of file
     18                psMetadata *format,     // Camera format
     19                pmFPAview *view         // View for PHU
     20    )
     21{
     22    assert(config);
     23    assert(name && strlen(name) > 0);
     24    assert(view);
     25
     26    // Output image
     27    pmFPA *fpa = pmFPAConstruct(config->camera); // FPA to contain the output
     28    if (!fpa) {
     29        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration.");
     30        return false;
     31    }
     32
     33    pmFPAfile *output = pmFPAfileDefineOutput(config, fpa, name);
     34    psFree(fpa);                        // Drop reference
     35    if (!output) {
     36        psError(PS_ERR_IO, false, "Unable to generate output file from %s", name);
     37        return false;
     38    }
     39    if (output->type != type) {
     40        psError(PS_ERR_IO, true, "%s is not of type %s", name, pmFPAfileStringFromType(type));
     41        return false;
     42    }
     43    output->save = true;
     44
     45    if (!pmFPAAddSourceFromView(fpa, description, view, format)) {
     46        psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");
     47        return false;
     48    }
     49
     50    return true;
     51}
    1252
    1353
     
    191231                    psFree(cell->concepts);
    192232                    cell->concepts = NULL;
     233                    cell->data_exists = false;
     234                    cell->file_exists = false;
    193235                    culled++;
    194236                }
     
    197239                psFree(chip->concepts);
    198240                chip->concepts = NULL;
     241                chip->data_exists = false;
     242                chip->file_exists = false;
    199243            }
    200244        }
     
    256300    }
    257301
    258     pmFPAfile *output = pmFPAfileDefineOutput(config, fpa, outName);
    259     psFree(fpa);                        // Drop reference
    260     if (!output) {
    261         psError(PS_ERR_IO, false, _("Unable to generate output file from %s"), outName);
     302    if (!outputFile(config, outName, fileType, "Merged detrend", format, phuView)) {
    262303        psFree(outName);
    263         return false;
    264     }
    265     if (output->type != fileType) {
    266         psError(PS_ERR_IO, true, "%s is not of type %s", outName, pmFPAfileStringFromType(fileType));
    267         psFree(outName);
    268         return false;
    269     }
    270     output->save = true;
     304        psFree(phuView);
     305        return false;
     306    }
    271307    psFree(outName);
    272308
    273     if (!pmFPAAddSourceFromView(fpa, "Merged detrend", phuView, format)) {
    274         psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");
    275         psFree(fpa);
    276         return false;
    277     }
     309    if (!outputFile(config, "PPMERGE.OUTPUT.SIGMA", fileType, "Merge sigma", format, phuView)) {
     310        psFree(phuView);
     311        return false;
     312    }
     313
     314    if (!outputFile(config, "PPMERGE.OUTPUT.COUNT", fileType, "Merged count", format, phuView)) {
     315        psFree(phuView);
     316        return false;
     317    }
     318
    278319    psFree(phuView);
    279320
Note: See TracChangeset for help on using the changeset viewer.