Changeset 15111
- Timestamp:
- Sep 29, 2007, 11:55:41 AM (19 years ago)
- Location:
- branches/pap_branch_070920/psLib/src/fits
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_070920/psLib/src/fits/psFits.c
r14984 r15111 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.71.2. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-09-2 2 03:06:16$9 * @version $Revision: 1.71.2.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-09-29 21:55:41 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 144 144 &status); 145 145 if (fptr == NULL || status != 0) { 146 char fitsErr[MAX_STRING_LENGTH] 147 ; 146 char fitsErr[MAX_STRING_LENGTH]; 148 147 fits_get_errstatus(status, fitsErr); 149 148 psError(PS_ERR_IO, true, … … 163 162 &status); 164 163 if (fptr == NULL || status != 0) { 165 char fitsErr[MAX_STRING_LENGTH] 166 ; 164 char fitsErr[MAX_STRING_LENGTH]; 167 165 fits_get_errstatus(status, fitsErr); 168 166 psError(PS_ERR_IO, true, … … 211 209 } 212 210 213 static void psFits OptionsFree(psFitsOptions *opt)214 { 215 psFree( opt->tilesize);216 } 217 218 psFits Options* psFitsOptionsAlloc(211 static void psFitsCompressionFree(psFitsCompression *comp) 212 { 213 psFree(comp->tilesize); 214 } 215 216 psFitsCompression* psFitsCompressionAlloc( 219 217 psFitsCompressionType type, ///< type of compression 220 218 psVector *tilesize, ///< vector defining compression tile size … … 224 222 ) 225 223 { 226 psFitsOptions *opt = psAlloc(sizeof(psFitsOptions)); 227 228 opt->type = type; 229 opt->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64); 230 opt->noisebits = noisebits; 231 opt->scale = scale; 232 opt->smooth = smooth; 233 234 psMemSetDeallocator(opt, (psFreeFunc) psFitsOptionsFree); 235 236 return opt; 224 psFitsCompression *comp = psAlloc(sizeof(psFitsCompression)); 225 psMemSetDeallocator(comp, (psFreeFunc) psFitsCompressionFree); 226 227 comp->type = type; 228 comp->tilesize = psVectorCopy(NULL, tilesize, PS_DATA_S64); 229 comp->noisebits = noisebits; 230 comp->scale = scale; 231 comp->smooth = smooth; 232 233 return comp; 237 234 } 238 235 … … 669 666 psAbort("can't map (long) type to a psLib type"); 670 667 } 668 psFree(dim); 671 669 // status check belongs to fits_set_tile_dim() call 672 670 if (status) { … … 711 709 712 710 713 bool psFits SetOptions(711 bool psFitsCompressionApply( 714 712 psFits* fits, ///< psFits object to close 715 psFits Options *opt///< options object713 psFitsCompression *comp ///< options object 716 714 ) 717 715 { 718 return psFitsSetCompression( 719 fits, 720 opt->type, 721 opt->tilesize, 722 opt->noisebits, 723 opt->scale, 724 opt->smooth); 716 return psFitsSetCompression(fits, comp->type, comp->tilesize, comp->noisebits, comp->scale, comp->smooth); 725 717 } 726 718 … … 855 847 856 848 849 psFitsCompressionType psFitsCompressionTypeFromString(const char *string) 850 { 851 if (!string || strlen(string) == 0) { 852 psWarning("Unable to identify compression type --- none set."); 853 return PS_FITS_COMPRESS_NONE; 854 } 855 856 if (strcmp(string, "GZIP") == 0) return PS_FITS_COMPRESS_GZIP; 857 if (strcmp(string, "RICE") == 0) return PS_FITS_COMPRESS_RICE; 858 if (strcmp(string, "HCOMPRESS") == 0) return PS_FITS_COMPRESS_HCOMPRESS; 859 if (strcmp(string, "PLIO") == 0) return PS_FITS_COMPRESS_PLIO; 860 861 psWarning("Unable to identify compression type (%s) --- none set.", string); 862 return PS_FITS_COMPRESS_NONE; 863 } -
branches/pap_branch_070920/psLib/src/fits/psFits.h
r14984 r15111 4 4 * @author Robert DeSonia, MHPCC 5 5 * 6 * @version $Revision: 1.31.2. 1$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-09-2 2 03:06:16$6 * @version $Revision: 1.31.2.2 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-09-29 21:55:41 $ 8 8 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 51 51 * 52 52 */ 53 typedef struct 54 { 53 typedef struct { 55 54 fitsfile* fd; ///< the CFITSIO fits files handle. 56 55 bool writable; ///< Is the file writable? 57 56 char *extword; ///< user-specified word to name extensions (NULL implies EXTNAME) 58 } 59 psFits; 60 61 /** FITS options object. */ 62 typedef struct 63 { 57 } psFits; 58 59 /** FITS compression settings. */ 60 typedef struct { 64 61 psFitsCompressionType type; ///< type of compression 65 62 psVector *tilesize; ///< vector defining compression tile size … … 67 64 int scale; ///< hcompress scale 68 65 int smooth; ///< hcompress smothing 69 } 70 psFitsOptions; 66 } psFitsCompression; 71 67 72 68 /** Opens a FITS file and allocates the associated psFits object. … … 116 112 * @return psFitsOptions or NULL on failure 117 113 */ 118 psFits Options* psFitsOptionsAlloc(114 psFitsCompression* psFitsCompressionAlloc( 119 115 psFitsCompressionType type, ///< type of compression 120 116 psVector *tilesize, ///< vector defining compression tile size … … 123 119 int smooth ///< hcompress smothing 124 120 ); 121 122 /// Return the FITS compression type specified by a string 123 psFitsCompressionType psFitsCompressionTypeFromString( 124 const char *string ///< String with compression type 125 ); 125 126 126 127 /** Closes a FITS file. … … 151 152 * @return bool TRUE if successfully configured, otherwise FALSE 152 153 */ 153 bool psFits SetOptions(154 bool psFitsCompressionApply( 154 155 psFits* fits, ///< psFits object to close 155 psFits Options *opt///< options object156 psFitsCompression *compress ///< options object 156 157 ); 157 158
Note:
See TracChangeset
for help on using the changeset viewer.
