Changeset 7589 for trunk/psModules/src/detrend/pmSubtractBias.c
- Timestamp:
- Jun 16, 2006, 3:50:43 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmSubtractBias.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmSubtractBias.c
r7445 r7589 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-06- 08 22:14:28$13 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-06-17 01:50:43 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 106 106 psImage *subImage = sub->image; // The image to be subtracted 107 107 psImage *subMask = sub->mask; // The mask for the subtraction image 108 109 int xIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.XPARITY"); 110 int xSpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.XPARITY"); 111 if (xIpar != xSpar) { 112 psError(PS_ERR_UNKNOWN, true, "images for subtraction do not have the same " 113 "CELL.XPARITY (%d vs %d).\n pmSubtractBias must be upgraded to handle this situation\n", 114 xIpar, xSpar); 115 return false; 116 } 117 118 int yIpar = psMetadataLookupS32(NULL, in->parent->concepts, "CELL.YPARITY"); 119 int ySpar = psMetadataLookupS32(NULL, sub->parent->concepts, "CELL.YPARITY"); 120 if (yIpar != ySpar) { 121 psError(PS_ERR_UNKNOWN, true, "images for subtraction do not have the same " 122 "CELL.YPARITY (%d vs %d).\n pmSubtractBias must be upgraded to handle this situation\n", 123 xIpar, xSpar); 124 return false; 125 } 108 126 109 127 // Offsets of the cells … … 293 311 XXX: The SDRS does not specify type support. F32 is implemented here. 294 312 *****************************************************************************/ 295 pmReadout *pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts,296 const pmReadout *bias, const pmReadout *dark)313 bool pmSubtractBias(pmReadout *in, pmOverscanOptions *overscanOpts, 314 const pmReadout *bias, const pmReadout *dark) 297 315 { 298 316 psTrace(".psModule.pmSubtracBias.pmSubtractBias", 4, … … 319 337 overscanOpts->fitType != PM_FIT_POLY_CHEBY && overscanOpts->fitType != PM_FIT_SPLINE) { 320 338 psError(PS_ERR_UNKNOWN, true, "Invalid fit type (%d). Returning original image.\n", overscanOpts->fitType); 321 return (in);339 return false; 322 340 } 323 341 … … 349 367 if (! p_psGetStatValue(myStats, &reduced)) { 350 368 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation. Returning input image.\n"); 351 return (in);369 return false; 352 370 } 353 371 (void)psBinaryOp(image, image, "-", psScalarAlloc((float)reduced, PS_TYPE_F32)); … … 391 409 psFree(pixels); 392 410 if (! reduced) { 393 return in;411 return false; 394 412 } 395 413 … … 435 453 psFree(pixels); 436 454 if (! reduced) { 437 return in;455 return false; 438 456 } 439 457 … … 452 470 // Bias frame subtraction 453 471 if (bias) { 454 SubtractFrame(in, bias, 1.0); 472 if (!SubtractFrame(in, bias, 1.0)) 473 return false; 455 474 } 456 475 … … 459 478 float inTime = psMetadataLookupF32(NULL, in->parent->concepts, "CELL.DARKTIME"); 460 479 float darkTime = psMetadataLookupF32(NULL, dark->parent->concepts, "CELL.DARKTIME"); 461 SubtractFrame(in, dark, inTime/darkTime); 462 } 463 464 return in; 465 } 466 467 480 if (!SubtractFrame(in, dark, inTime/darkTime)) 481 return false; 482 } 483 484 return true; 485 } 486 487
Note:
See TracChangeset
for help on using the changeset viewer.
