Changeset 3666 for trunk/stac/src/stacTransform.c
- Timestamp:
- Apr 5, 2005, 11:51:26 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/stac/src/stacTransform.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/stac/src/stacTransform.c
r3610 r3666 7 7 #define MIN(x,y) (((x) > (y)) ? (y) : (x)) 8 8 #define MAX(x,y) (((x) > (y)) ? (x) : (y)) 9 10 #define MAXCHAR 8011 12 static int numTransforms = 0; // Number of transformations performed13 14 9 15 10 // Hacked the original ps_ImagePixelInterpolateBILINEAR_F32 to add variances … … 115 110 const psVector *scales, // Relative scales 116 111 const psVector *offsets, // Relative offsets 117 const stacConfig *config // Configuration112 int outnx, int outny // Size of output images 118 113 ) 119 114 { 120 115 int nImages = images->n; // Number of images 121 int nx = config->outnx, ny = config->outny; // Size of output images122 numTransforms++;123 116 124 117 // Check input sizes … … 134 127 if (*outputs == NULL) { 135 128 *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); 137 130 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); 139 132 } 140 133 } … … 144 137 if (errors && (*outErrors == NULL)) { 145 138 *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); 147 140 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); 149 142 } 150 143 } … … 187 180 #if 0 188 181 // 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++) { 191 184 outImage->data.F32[y][x] = 0.0; 192 185 outError->data.F32[y][x] = 0.0; … … 202 195 203 196 // 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++) { 206 199 // Only transform those pixels requested 207 200 if (!region || (region && region->data.U8[y][x])) { … … 229 222 } // Iterating over output pixels 230 223 231 #ifdef TESTING232 // Write error image out to check233 char shiftName[MAXCHAR]; // Filename of shift image234 char errName[MAXCHAR]; // Filename of error image235 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 #endif253 254 224 } // Iterating over images 255 225
Note:
See TracChangeset
for help on using the changeset viewer.
