Changeset 18392
- Timestamp:
- Jun 30, 2008, 6:26:26 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/fits/psFitsImage.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/psFitsImage.c
r18208 r18392 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.3 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2008-0 6-20 02:50:01$9 * @version $Revision: 1.32 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2008-07-01 04:26:26 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 522 522 int numRows = image->numRows; // Number of rows for image 523 523 int status = 0; // Status from cfitsio 524 bool success = true; 524 525 psFitsCompression *compress = NULL; // FITS compression parameters; to save state 525 526 … … 531 532 if (!diskImage) { 532 533 psError(PS_ERR_UNKNOWN, false, "Unable to convert image to desired disk format."); 533 goto INSERT_FAIL; 534 success = false; 535 goto INSERT_DONE; 534 536 } 535 537 … … 537 539 if (!isfinite(bscale) || !isfinite(bzero)) { 538 540 // Couldn't scale, so don't compress. Save compression parameters for later 539 useRequestedScale = false;541 useRequestedScale = false; 540 542 compress = psFitsCompressionGet(fits); 541 543 if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 542 544 psError(PS_ERR_IO, false, "Unable to unset compression."); 543 goto INSERT_FAIL; 545 success = false; 546 goto INSERT_DONE; 544 547 } 545 548 } … … 550 553 int dataType; // cfitsio data type 551 554 if (!p_psFitsTypeToCfitsio(diskImage->type.type, &bitPix, &cfitsioBzero, &dataType)) { 552 goto INSERT_FAIL; 555 success = false; 556 goto INSERT_DONE; 553 557 } 554 558 if (cfitsioBzero != 0.0) { … … 592 596 } 593 597 if (psFitsError(status, true, "Could not create image HDU.")) { 594 goto INSERT_FAIL; 598 success = false; 599 goto INSERT_DONE; 595 600 } 596 601 … … 598 603 if (header && !psFitsWriteHeader(fits, header)) { 599 604 psError(PS_ERR_IO, false, "Unable to write FITS header.\n"); 600 goto INSERT_FAIL; 605 success = false; 606 goto INSERT_DONE; 601 607 } 602 608 … … 612 618 "Scaling: TRUE = BZERO + BSCALE * DISK", &status); 613 619 if (psFitsError(status, true, "Could not write BSCALE/BZERO headers to file.")) { 614 goto INSERT_FAIL; 620 success = false; 621 goto INSERT_DONE; 615 622 } 616 623 } … … 624 631 fits_set_imgnull(fits->fd, blank, &status); 625 632 if (psFitsError(status, true, "Could not write BLANK header to file.")) { 626 goto INSERT_FAIL; 633 success = false; 634 goto INSERT_DONE; 627 635 } 628 636 } … … 648 656 } 649 657 if (psFitsError(status, true, "Could not write image to file.")) { 650 goto INSERT_FAIL; 651 } 652 653 return true; 654 655 INSERT_FAIL: 658 success = false; 659 goto INSERT_DONE; 660 } 661 662 INSERT_DONE: 656 663 psFree(diskImage); 657 664 if (compress) { … … 660 667 psFree(compress); 661 668 } 662 return false;669 return success; 663 670 } 664 671 … … 699 706 if (!isfinite(bscale) || !isfinite(bzero)) { 700 707 // Couldn't scale, so don't compress. Save compression parameters for later 701 useRequestedScale = false;708 useRequestedScale = false; 702 709 compress = psFitsCompressionGet(fits); 703 710 if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) {
Note:
See TracChangeset
for help on using the changeset viewer.
