IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 5, 2005, 11:51:26 AM (21 years ago)
Author:
Paul Price
Message:

Removing stac-specific configuration out of functions so that I can use them in other programs. Program appears to work as it did before.

File:
1 edited

Legend:

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

    r3610 r3666  
    77#define MIN(x,y) (((x) > (y)) ? (y) : (x))
    88#define MAX(x,y) (((x) > (y)) ? (x) : (y))
    9 
    10 #define MAXCHAR 80
    11 
    12 static int numTransforms = 0;           // Number of transformations performed
    13 
    149
    1510// Hacked the original ps_ImagePixelInterpolateBILINEAR_F32 to add variances
     
    115110                   const psVector *scales, // Relative scales
    116111                   const psVector *offsets, // Relative offsets
    117                    const stacConfig *config // Configuration
     112                   int outnx, int outny // Size of output images
    118113    )
    119114{
    120115    int nImages = images->n;            // Number of images
    121     int nx = config->outnx, ny = config->outny; // Size of output images
    122     numTransforms++;
    123116
    124117    // Check input sizes
     
    134127    if (*outputs == NULL) {
    135128        *outputs = psArrayAlloc(nImages);
    136         psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", nx, ny);
     129        psTrace("stac.transform", 5, "Allocating space for transformed images, %dx%d\n", outnx, outny);
    137130        for (int i = 0; i < nImages; i++) {
    138             (*outputs)->data[i] = psImageAlloc(nx, ny, PS_TYPE_F32);
     131            (*outputs)->data[i] = psImageAlloc(outnx, outny, PS_TYPE_F32);
    139132        }
    140133    }
     
    144137    if (errors && (*outErrors == NULL)) {
    145138        *outErrors = psArrayAlloc(errors->n);
    146         psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", nx, ny);
     139        psTrace("stac.transform", 5, "Allocating space for transformed error images, %dx%d\n", outnx, outny);
    147140        for (int i = 0; i < nImages; i++) {
    148             (*outErrors)->data[i] = psImageAlloc(nx, ny, PS_TYPE_F32);
     141            (*outErrors)->data[i] = psImageAlloc(outnx, outny, PS_TYPE_F32);
    149142        }
    150143    }
     
    187180#if 0
    188181        // No need for initialisation, since we iterate over the entire output image.
    189         for (int y = 0; y < ny; y++) {
    190             for (int x = 0; x < nx; x++) {
     182        for (int y = 0; y < outny; y++) {
     183            for (int x = 0; x < outnx; x++) {
    191184                outImage->data.F32[y][x] = 0.0;
    192185                outError->data.F32[y][x] = 0.0;
     
    202195
    203196        // Iterate over the output image pixels
    204         for (int y = 0; y < ny; y++) {
    205             for (int x = 0; x < nx; x++) {
     197        for (int y = 0; y < outny; y++) {
     198            for (int x = 0; x < outnx; x++) {
    206199                // Only transform those pixels requested
    207200                if (!region || (region && region->data.U8[y][x])) {
     
    229222        } // Iterating over output pixels
    230223
    231 #ifdef TESTING
    232         // Write error image out to check
    233         char shiftName[MAXCHAR];        // Filename of shift image
    234         char errName[MAXCHAR];          // Filename of error image
    235         sprintf(shiftName,"%s.shift.%d",config->inputs->data[n],numTransforms);
    236         sprintf(errName,"%s.shifterr.%d",config->inputs->data[n],numTransforms);
    237         psTrace("stac.transform.test", 6,
    238                 "Output files have size: %dx%d\n",outImage->numCols,outImage->numRows);
    239 
    240         psFits *shiftFile = psFitsAlloc(shiftName);
    241         psFits *errFile = psFitsAlloc(errName);
    242         if (!psFitsWriteImage(shiftFile, NULL, outImage, 0, NULL)) {
    243             psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName);
    244         }
    245         psTrace("stac", 1, "Shifted image written to %s\n", shiftName);
    246         if (!psFitsWriteImage(errFile, NULL, outError, 0, NULL)) {
    247             psErrorStackPrint(stderr, "Unable to write image: %s\n", errName);
    248         }
    249         psTrace("stac", 1, "Shifted error image written to %s\n", errName);
    250         psFree(shiftFile);
    251         psFree(errFile);
    252 #endif
    253 
    254224    } // Iterating over images
    255225
Note: See TracChangeset for help on using the changeset viewer.