IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3610 for trunk/stac/src/stac.c


Ignore:
Timestamp:
Mar 31, 2005, 5:07:12 PM (21 years ago)
Author:
Paul Price
Message:

Working very nicely now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/stac/src/stac.c

    r3435 r3610  
    2727    // Set trace levels
    2828    psTraceSetLevel(".",0);
     29    psTraceSetLevel(".psLib", 0);
    2930    psTraceSetLevel("stac.checkMemory",10);
    3031    psTraceSetLevel("stac.config",10);
     
    3839    psTraceSetLevel("stac.area",10);
    3940    psTraceSetLevel("stac.size",10);
     41    psTraceSetLevel("stac.scales",7);
    4042
    4143    // Set logging level
     
    6567    psArray *transformed = NULL;
    6668    psArray *transformedErrors = NULL;
    67     (void)stacTransform(&transformed, &transformedErrors, inputs, inverseMaps, errors, NULL, NULL, config);
     69    (void)stacTransform(&transformed, &transformedErrors, inputs, inverseMaps, errors, NULL, NULL, NULL, NULL,
     70                        config);
    6871
    6972    psTrace("stac.time",1,"Transformation completed at %f seconds\n", getTime() - startTime);
     73
     74    psVector *scales = NULL;            // Relative scales between images
     75    psVector *offsets = NULL;           // Offsets between images
     76    (void)stacScales(&scales, &offsets, transformed, config);
     77    // Rescale the images
     78    (void)stacRescale(transformed, transformedErrors, NULL, scales, offsets);
    7079
    7180    // Combine with rejection
     
    122131    }
    123132
    124     // Redo transformation with the masks
     133    // Redo transformation with the masks and scales/offsets
    125134    (void)stacTransform(&transformed, &transformedErrors, inputs, inverseMaps, errors, rejectedSource,
    126                         combineRegion, config);
     135                        combineRegion, scales, offsets, config);
    127136
    128137    // Combine the newly-transformed CR-free images, no rejection
     
    139148    psFree(outFile);
    140149
     150    // Save shifted images
     151    if (config->saveShifts) {
     152        for (int i = 0; i < transformed->n; i++) {
     153            char shiftName[MAXCHAR];    // Filename of shifted image
     154            sprintf(shiftName, "%s.shift", config->inputs->data[i]);
     155            psFits *shiftFile = psFitsAlloc(shiftName);
     156            if (!psFitsWriteImage(shiftFile, NULL, transformed->data[i], 0, NULL)) {
     157                psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName);
     158            }
     159            psTrace("stac", 1, "Shifted image %d written to %s\n", i, shiftName);
     160            psFree(shiftFile);
     161        }
     162    }
     163
    141164    // Free everything I've used
    142165    stacConfigFree(config);
     166    psFree(scales);
     167    psFree(offsets);
    143168    psFree(combineRegion);
    144169    psFree(regions);
Note: See TracChangeset for help on using the changeset viewer.