Changeset 3500 for trunk/psLib/src/dataIO/psFits.c
- Timestamp:
- Mar 24, 2005, 1:52:25 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/dataIO/psFits.c (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/dataIO/psFits.c
r3495 r3500 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-03-24 2 2:21:17$9 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-03-24 23:52:25 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 190 190 } 191 191 192 static bool isHDUEmpty( psFits* fits)192 static bool isHDUEmpty(const psFits* fits) 193 193 { 194 194 /* check for keys - no keys means this is really an empty HDU */ … … 265 265 } 266 266 267 bool psFitsMoveExtName( psFits* fits,267 bool psFitsMoveExtName(const psFits* fits, 268 268 const char* extname) 269 269 { … … 295 295 } 296 296 297 bool psFitsMoveExtNum( psFits* fits,297 bool psFitsMoveExtNum(const psFits* fits, 298 298 int extnum, 299 299 bool relative) … … 333 333 } 334 334 335 int psFitsGetExtNum( psFits* fits)335 int psFitsGetExtNum(const psFits* fits) 336 336 { 337 337 int hdunum; … … 347 347 } 348 348 349 char* psFitsGetExtName( psFits* fits)349 char* psFitsGetExtName(const psFits* fits) 350 350 { 351 351 if (fits == NULL) { … … 368 368 } 369 369 370 bool psFitsSetExtName( psFits* fits, const char* name)370 bool psFitsSetExtName(const psFits* fits, const char* name) 371 371 { 372 372 if (fits == NULL) { … … 396 396 } 397 397 398 int psFitsGetSize( psFits* fits)398 int psFitsGetSize(const psFits* fits) 399 399 { 400 400 if (fits == NULL) { … … 419 419 } 420 420 421 psFitsType psFitsGetExtType( psFits* fits)421 psFitsType psFitsGetExtType(const psFits* fits) 422 422 { 423 423 if (fits == NULL) { … … 583 583 584 584 psHash* psFitsReadHeaderSet(psHash* out, 585 psFits* fits)585 const psFits* fits) 586 586 { 587 587 if (fits == NULL) { … … 636 636 637 637 psImage* psFitsReadImage(psImage* output, // a psImage to recycle. 638 psFits* fits, // the psFits object638 const psFits* fits, // the psFits object 639 639 psRegion region, // the region in the FITS image to read 640 640 int z) // the z-plane in the FITS image cube to read … … 652 652 psS32 datatype = 0; 653 653 654 if (fits == NULL) 655 { 654 if (fits == NULL) { 656 655 psError(PS_ERR_BAD_PARAMETER_NULL, true, 657 656 PS_ERRORTEXT_psFits_NULL); … … 662 661 // check to see if we even are positioned on an image HDU 663 662 int hdutype; 664 if ( fits_get_hdu_type(fits->p_fd,&hdutype, &status) != 0) 665 { 663 if ( fits_get_hdu_type(fits->p_fd,&hdutype, &status) != 0) { 666 664 char fitsErr[MAX_STRING_LENGTH]; 667 665 (void)fits_get_errstatus(status, fitsErr); … … 671 669 return NULL; 672 670 } 673 if (hdutype != IMAGE_HDU) 674 { 671 if (hdutype != IMAGE_HDU) { 675 672 psError(PS_ERR_IO, true, 676 673 PS_ERRORTEXT_psFits_NOT_IMAGE_TYPE); … … 679 676 680 677 /* Get the data type 'bitPix' from the FITS image */ 681 if (fits_get_img_equivtype(fits->p_fd, &bitPix, &status) != 0) 682 { 678 if (fits_get_img_equivtype(fits->p_fd, &bitPix, &status) != 0) { 683 679 fits_get_errstatus(status, fitsErr); 684 680 psError(PS_ERR_IO, true, … … 690 686 691 687 /* Get the dimensions 'nAxis' from the FITS image */ 692 if (fits_get_img_dim(fits->p_fd, &nAxis, &status) != 0) 693 { 688 if (fits_get_img_dim(fits->p_fd, &nAxis, &status) != 0) { 694 689 (void)fits_get_errstatus(status, fitsErr); 695 690 psError(PS_ERR_IO, true, … … 701 696 702 697 /* Validate the number of axis */ 703 if ((nAxis < 2) || (nAxis > 3)) 704 { 698 if ((nAxis < 2) || (nAxis > 3)) { 705 699 psError(PS_ERR_IO, true, 706 700 PS_ERRORTEXT_psFits_IMAGE_DIMENSION_UNSUPPORTED, … … 711 705 712 706 /* Get the Image size from the FITS file */ 713 if (fits_get_img_size(fits->p_fd, nAxis, nAxes, &status) != 0) 714 { 707 if (fits_get_img_size(fits->p_fd, nAxis, nAxes, &status) != 0) { 715 708 (void)fits_get_errstatus(status, fitsErr); 716 709 psError(PS_ERR_IO, true, … … 725 718 firstPixel[2] = z + 1; 726 719 727 if (region.x1 > 0) 728 { 720 if (region.x1 > 0) { 729 721 lastPixel[0] = region.x1; 730 } else 731 { 722 } else { 732 723 lastPixel[0] = nAxes[0] + region.x1; // n.b., region.x1 < 0 733 724 } 734 if (region.y1 > 0) 735 { 725 if (region.y1 > 0) { 736 726 lastPixel[1] = region.y1; 737 } else 738 { 727 } else { 739 728 lastPixel[1] = nAxes[1] + region.y1; // n.b., region.y1 < 0 740 729 } … … 745 734 increment[2] = 1; 746 735 747 switch (bitPix) 748 { 736 switch (bitPix) { 749 737 case BYTE_IMG: 750 738 datatype = PS_TYPE_U8; … … 796 784 datatype); 797 785 798 if (output == NULL) 799 { 786 if (output == NULL) { 800 787 psError(PS_ERR_UNKNOWN, false, 801 788 "Failed to allocate a properly sized image."); … … 805 792 // n.b., this assumes contiguous image buffer 806 793 if (fits_read_subset(fits->p_fd, fitsDatatype, firstPixel, lastPixel, increment, 807 NULL, output->data.V[0], &anynull, &status) != 0) 808 { 794 NULL, output->data.V[0], &anynull, &status) != 0) { 809 795 psFree(output); 810 796 (void)fits_get_errstatus(status, fitsErr); … … 819 805 } 820 806 821 bool psFitsWriteImage( psFits* fits,807 bool psFitsWriteImage(const psFits* fits, 822 808 const psMetadata* header, 823 809 const psImage* input, … … 911 897 } 912 898 913 bool psFitsUpdateImage( psFits* fits,899 bool psFitsUpdateImage(const psFits* fits, 914 900 const psImage* input, 915 901 psRegion region, … … 1050 1036 1051 1037 bool psFitsWriteHeader(const psMetadata* header, 1052 psFits* fits)1038 const psFits* fits) 1053 1039 { 1054 1040 … … 1132 1118 } 1133 1119 1134 psMetadata* psFitsReadTableRow( psFits* fits,1120 psMetadata* psFitsReadTableRow(const psFits* fits, 1135 1121 int row) 1136 1122 { … … 1257 1243 } 1258 1244 1259 psArray* psFitsReadTableColumn( psFits* fits,1245 psArray* psFitsReadTableColumn(const psFits* fits, 1260 1246 const char* colname) 1261 1247 { … … 1339 1325 } 1340 1326 1341 psVector* psFitsReadTableColumnNum( psFits* fits,1327 psVector* psFitsReadTableColumnNum(const psFits* fits, 1342 1328 const char* colname) 1343 1329 { … … 1422 1408 1423 1409 1424 psArray* psFitsReadTable( psFits* fits)1410 psArray* psFitsReadTable(const psFits* fits) 1425 1411 { 1426 1412 int status = 0; … … 1469 1455 } 1470 1456 1471 bool psFitsWriteTable( psFits* fits,1457 bool psFitsWriteTable(const psFits* fits, 1472 1458 psMetadata* header, 1473 1459 psArray* table, … … 1650 1636 } 1651 1637 1652 bool psFitsUpdateTable( psFits* fits,1638 bool psFitsUpdateTable(const psFits* fits, 1653 1639 psMetadata* data, 1654 1640 int row)
Note:
See TracChangeset
for help on using the changeset viewer.
