Changeset 21363 for trunk/psModules/src/camera/pmHDUGenerate.c
- Timestamp:
- Feb 5, 2009, 4:31:25 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmHDUGenerate.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmHDUGenerate.c
r18227 r21363 274 274 pmReadout *readout = cell->readouts->data[0]; // The first readout, as representative 275 275 // The proper image, used to get the size 276 psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout-> weight);276 psImage *image = readout->image ? readout->image : (readout->mask ? readout->mask : readout->variance); 277 277 if (!image) { 278 278 continue; … … 283 283 image->numCols, image->numRows, readout->mask->numCols, readout->mask->numRows); 284 284 } 285 if (readout-> weight&&286 (readout-> weight->numCols != image->numCols || readout->weight->numRows != image->numRows)) {287 psWarning("Image and weighthave different sizes (%dx%d vs %dx%d)!\n",288 image->numCols, image->numRows, readout-> weight->numCols, readout->weight->numRows);285 if (readout->variance && 286 (readout->variance->numCols != image->numCols || readout->variance->numRows != image->numRows)) { 287 psWarning("Image and variance have different sizes (%dx%d vs %dx%d)!\n", 288 image->numCols, image->numRows, readout->variance->numCols, readout->variance->numRows); 289 289 } 290 290 // New reference … … 355 355 psElemType imageType = 0; // Type of readout images 356 356 psElemType maskType = 0; // Type of readout masks 357 psElemType weightType = 0; // Type of readout weights357 psElemType varianceType = 0; // Type of readout variances 358 358 { 359 359 psListIterator *iter = psListIteratorAlloc(cells, PS_LIST_HEAD, false); // Iterator for cells … … 381 381 maskType = checkTypes(maskType, readout->mask->type.type); 382 382 } 383 if (!hdu-> weights && readout->weight) {384 weightType = checkTypes(weightType, readout->weight->type.type);383 if (!hdu->variances && readout->variance) { 384 varianceType = checkTypes(varianceType, readout->variance->type.type); 385 385 } 386 386 } … … 388 388 psFree(iter); 389 389 } 390 if (numReadouts == 0 || (imageType == 0 && maskType == 0 && weightType == 0)) {390 if (numReadouts == 0 || (imageType == 0 && maskType == 0 && varianceType == 0)) { 391 391 // Nothing from which to create an HDU 392 392 psFree(cells); … … 421 421 } 422 422 } 423 if ( weightType) {424 hdu-> weights = psArrayAlloc(numReadouts);423 if (varianceType) { 424 hdu->variances = psArrayAlloc(numReadouts); 425 425 for (int i = 0; i < numReadouts; i++) { 426 psImage * weight = psImageAlloc(xSize, ySize, weightType);427 psImageInit( weight, 0.0);428 hdu-> weights->data[i] = weight;426 psImage *variance = psImageAlloc(xSize, ySize, varianceType); 427 psImageInit(variance, 0.0); 428 hdu->variances->data[i] = variance; 429 429 } 430 430 } … … 448 448 449 449 psArray *readouts = cell->readouts; // Array of readouts 450 450 451 psArray *hduImages = hdu->images; // Array of images in the HDU 451 452 psArray *hduMasks = hdu->masks; // Array of masks in the HDU 452 psArray *hdu Weights = hdu->weights; // Array of weights in the HDU453 psArray *hduVariances = hdu->variances; // Array of variances in the HDU 453 454 for (int i = 0; i < readouts->n; i++) { 454 455 pmReadout *readout = readouts->data[i]; // The readout of interest … … 467 468 readout->mask = new; 468 469 } 469 if (readout-> weight) {470 psImage *new = pasteImage(hdu Weights->data[i], readout->weight, trimsec);471 psFree(readout-> weight);472 readout-> weight= new;470 if (readout->variance) { 471 psImage *new = pasteImage(hduVariances->data[i], readout->variance, trimsec); 472 psFree(readout->variance); 473 readout->variance = new; 473 474 } 474 475 … … 504 505 505 506 // Return the level that an extension applies to 506 static pmFPALevel extensionLevel( pmHDU *hdu // HDU to check507 static pmFPALevel extensionLevel(const pmHDU *hdu // HDU to check 507 508 ) 508 509 { … … 512 513 } 513 514 bool mdok = true; // Status of MD lookup 514 psMetadata *file = psMetadataLookupMetadata(&mdok, hdu->format, "FILE"); // File info rmationfor camera format515 psMetadata *file = psMetadataLookupMetadata(&mdok, hdu->format, "FILE"); // File info for camera format 515 516 if (!mdok || !file) { 516 517 psError(PS_ERR_UNEXPECTED_NULL, true, "Can't file FILE information for camera format " … … 581 582 return false; 582 583 } 583 if (hdu->images && hdu->masks && hdu-> weights) {584 if (hdu->images && hdu->masks && hdu->variances) { 584 585 // It's already here! 585 586 return true; … … 631 632 return generateForCells(chip); 632 633 } 633 if (hdu->images && hdu->masks && hdu-> weights) {634 if (hdu->images && hdu->masks && hdu->variances) { 634 635 // It's already here! 635 636 return true; … … 680 681 return generateForChips(fpa); 681 682 } 682 if (hdu->images && hdu->masks && hdu-> weights) {683 if (hdu->images && hdu->masks && hdu->variances) { 683 684 // It's already here! 684 685 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
