Changeset 2857 for trunk/psModules/src/pmSubtractBias.c
- Timestamp:
- Dec 30, 2004, 12:22:00 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/pmSubtractBias.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractBias.c
r2856 r2857 6 6 * @author George Gusciora, MHPCC 7 7 * 8 * @version $Revision: 1.2 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12-30 2 1:35:03$8 * @version $Revision: 1.28 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-30 22:22:00 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 40 40 if (((in->image)->numRows + in->row0 - bias->row0) > (bias->image)->numRows) { 41 psError(PS_ERR_UNKNOWN,true, "bias image does not have enough rows \n");41 psError(PS_ERR_UNKNOWN,true, "bias image does not have enough rows. Returning in image\n"); 42 42 return(in); 43 43 } 44 44 if (((in->image)->numCols + in->row0 - bias->row0) > (bias->image)->numCols) { 45 psError(PS_ERR_UNKNOWN,true, "bias image does not have enough columns \n");45 psError(PS_ERR_UNKNOWN,true, "bias image does not have enough columns. Returning in image\n"); 46 46 return(in); 47 47 } … … 129 129 130 130 if (numOptions == 0) { 131 psError(PS_ERR_UNKNOWN,true, "No statistics options have been specified \n");131 psError(PS_ERR_UNKNOWN,true, "No statistics options have been specified.\n"); 132 132 } 133 133 if (numOptions != 1) { … … 225 225 226 226 } else { 227 psError(PS_ERR_UNKNOWN, true, "unknown fit type\n"); 227 psError(PS_ERR_UNKNOWN, true, "unknown fit type. Returning NULL.\n"); 228 psFree(newVec); 229 return(NULL); 228 230 } 229 231 … … 251 253 PS_READOUT_CHECK_TYPE(in, PS_TYPE_F32, NULL); 252 254 if ((overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE)) { 253 psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE) \n");255 psError(PS_ERR_UNKNOWN,true, "(overscans == NULL) && (overScanAxis != PM_OVERSCAN_NONE). Returning in image\n"); 254 256 return(in); 255 257 } … … 260 262 (fit != PM_OVERSCAN_COLUMNS) && 261 263 (fit != PM_OVERSCAN_ALL)) { 262 psError(PS_ERR_UNKNOWN, true, "fit is unallowable (%d) \n", fit);264 psError(PS_ERR_UNKNOWN, true, "fit is unallowable (%d). Returning in image.\n", fit); 263 265 return(in); 264 266 } … … 268 270 (overScanAxis != PM_OVERSCAN_COLUMNS) && 269 271 (overScanAxis != PM_OVERSCAN_ALL)) { 270 psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d) \n", overScanAxis);272 psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d). Returning in image.\n", overScanAxis); 271 273 return(in); 272 274 } … … 302 304 if (fit != PM_FIT_NONE) { 303 305 psLogMsg(__func__, PS_LOG_WARN, 304 "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE \n");306 "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE. Proceeding to full fram subtraction.\n"); 305 307 } 306 308 307 309 if (overscans != NULL) { 308 310 psLogMsg(__func__, PS_LOG_WARN, 309 "WARNING: pmSubtractBias.(): overScanAxis equals NONE and overscans does not equal NULL \n");311 "WARNING: pmSubtractBias.(): overScanAxis equals NONE and overscans does not equal NULL. Proceeding to full fram subtraction.\n"); 310 312 } 311 313 return(psSubtractFrame(in, bias)); … … 314 316 if ((overScanAxis == PM_OVERSCAN_ALL) && (fit != PM_FIT_NONE)) { 315 317 psLogMsg(__func__, PS_LOG_WARN, 316 "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE \n");318 "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE. Proceeding with the rest of the module.\n"); 317 319 } 318 320 … … 321 323 // We subtract each overscan region from the image data. 322 324 // 323 // XXX: Do we generate a single stat from all the overscan regions, and324 // subtract that from the input image? Or do we generate a single stat325 // from each overscan region, and subtract them from the input image?326 // The SDR is ambiguous.327 325 if (overScanAxis == PM_OVERSCAN_ALL) { 328 326 tmpOverscan = (psListElem *) overscans->head; 329 327 while (NULL != tmpOverscan) { 330 328 myOverscanImage = (psImage *) tmpOverscan->data; 331 psImageStats(myStats, myOverscanImage, NULL, 0xffffffff); 332 p_psGetStatValue(myStats, &statValue); 329 psStats *rc = psImageStats(myStats, myOverscanImage, NULL, 0xffffffff); 330 if (rc == NULL) { 331 psError(PS_ERR_UNKNOWN, false, "psImageStats(): could not perform requested statistical operation. Returning in image.\n"); 332 return(in); 333 } 334 if (false == p_psGetStatValue(myStats, &statValue)) { 335 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation. Returning in image.\n"); 336 return(in); 337 } 333 338 p_psImageSubtractScalar(in->image, statValue); 334 339 … … 340 345 // This check is redundant with above code. 341 346 if (!((overScanAxis == PM_OVERSCAN_ROWS) || (overScanAxis == PM_OVERSCAN_COLUMNS))) { 342 psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d) \n", overScanAxis);347 psError(PS_ERR_UNKNOWN, true, "overScanAxis is unallowable (%d).\nReturning in image.\n", overScanAxis); 343 348 return(in); 344 349 } … … 371 376 tmpRow->data.F32[j] = myOverscanImage->data.F32[j][i]; 372 377 } 373 myStats = psVectorStats(myStats, tmpRow, NULL, NULL, 0); 374 p_psGetStatValue(myStats, &statValue); 378 psStats *rc = psVectorStats(myStats, tmpRow, NULL, NULL, 0); 379 if (rc == NULL) { 380 psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation. Returning in image.\n"); 381 return(in); 382 } 383 if (false == p_psGetStatValue(rc, &statValue)) { 384 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation. Returning in image.\n"); 385 return(in); 386 } 375 387 overscanVector->data.F32[i] = statValue; 376 388 } … … 383 395 in->image->numCols, 384 396 fitSpec, fit); 397 if (newVec == NULL) { 398 psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector(): could not scale the overscan vector. Returning in image.\n"); 399 return(in); 400 } 385 401 psFree(overscanVector); 386 402 overscanVector = newVec; 387 403 } else { 388 psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector. Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL. \n");404 psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector. Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL. Returning in image.\n"); 389 405 psFree(overscanVector); 390 406 return(in); … … 414 430 tmpCol->data.F32[j] = myOverscanImage->data.F32[i][j]; 415 431 } 416 myStats = psVectorStats(myStats, tmpCol, NULL, NULL, 0); 417 p_psGetStatValue(myStats, &statValue); 432 psStats *rc = psVectorStats(myStats, tmpCol, NULL, NULL, 0); 433 if (rc == NULL) { 434 psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation. Returning in image.\n"); 435 return(in); 436 } 437 if (false == p_psGetStatValue(rc, &statValue)) { 438 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation. Returning in image.\n"); 439 return(in); 440 } 418 441 overscanVector->data.F32[i] = statValue; 419 442 } … … 426 449 in->image->numRows, 427 450 fitSpec, fit); 451 if (newVec == NULL) { 452 psError(PS_ERR_UNKNOWN, false, "ScaleOverscanVector(): could not scale the overscan vector. Returning in image.\n"); 453 return(in); 454 } 428 455 psFree(overscanVector); 429 456 overscanVector = newVec; 430 457 } else { 431 psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector. Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL. \n");458 psError(PS_ERR_UNKNOWN, true, "Don't know how to scale the overscan vector. Set fit to PM_FIT_SPLINE or PM_FIT_POLYNOMIAL. Returning in image.\n"); 432 459 psFree(overscanVector); 433 460 return(in); … … 456 483 } 457 484 } 458 myStats = psVectorStats(myStats, binVec, NULL, NULL, 0); 459 p_psGetStatValue(myStats, &statValue); 485 psStats *rc = psVectorStats(myStats, binVec, NULL, NULL, 0); 486 if (rc == NULL) { 487 psError(PS_ERR_UNKNOWN, false, "psVectorStats(): could not perform requested statistical operation. Returning in image.\n"); 488 return(in); 489 } 490 if (false == p_psGetStatValue(rc, &statValue)) { 491 psError(PS_ERR_UNKNOWN, false, "p_psGetStatValue(): could not determine result from requested statistical operation. Returning in image.\n"); 492 return(in); 493 } 460 494 myBin->data.F32[i] = statValue; 461 495 } … … 486 520 myPoly = psVectorFitPolynomial1D(myPoly, NULL, overscanVector, NULL); 487 521 if (myPoly == NULL) { 488 psError(PS_ERR_UNKNOWN, false, "Could not fit a polynomial to overscan vector. \n");522 psError(PS_ERR_UNKNOWN, false, "Could not fit a polynomial to overscan vector. Returning in image.\n"); 489 523 psFree(overscanVector); 490 524 return(in); … … 494 528 mySpline = psVectorFitSpline1D(mySpline, NULL, overscanVector, NULL); 495 529 if (mySpline == NULL) { 496 psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector. \n");530 psError(PS_ERR_UNKNOWN, false, "Could not fit a spline to overscan vector. Returning in image.\n"); 497 531 psFree(overscanVector); 498 532 return(in); … … 535 569 } 536 570 } else { 571 // 537 572 // If we get here, then no polynomials were fit to the overscan 538 573 // vector. We simply subtract it, taking into account binning, 539 574 // from the image. 575 // 540 576 541 577 //
Note:
See TracChangeset
for help on using the changeset viewer.
