Changeset 15335
- Timestamp:
- Oct 19, 2007, 1:52:39 PM (19 years ago)
- Location:
- trunk/psLib/src/fits
- Files:
-
- 2 added
- 6 edited
-
Makefile.am (modified) (2 diffs)
-
psFits.c (modified) (6 diffs)
-
psFits.h (modified) (2 diffs)
-
psFitsFloat.c (added)
-
psFitsFloat.h (added)
-
psFitsHeader.c (modified) (3 diffs)
-
psFitsImage.c (modified) (7 diffs)
-
psFitsImage.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/fits/Makefile.am
r8914 r15335 9 9 psFitsImage.c \ 10 10 psFitsTable.c 11 # psFitsFloat.c 11 12 12 13 EXTRA_DIST = fits.i … … 17 18 psFitsImage.h \ 18 19 psFitsTable.h 20 # psFitsFloat.h 19 21 20 22 CLEANFILES = *~ *.bb *.bbg *.da -
trunk/psLib/src/fits/psFits.c
r15179 r15335 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.7 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-10- 03 21:27:21$9 * @version $Revision: 1.73 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-10-19 23:52:39 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 163 163 fits->extword = NULL; 164 164 fits->conventions.compression = true; 165 fits->conventions.psBitpix = true; 166 fits->bscale = 0.0; 167 fits->bzero = 0.0; 165 168 psMemSetDeallocator(fits,(psFreeFunc)fitsFree); 166 169 … … 397 400 { 398 401 PS_ASSERT_FITS_NON_NULL(fits, false); 399 400 if (! fits->writable) { 401 psError(PS_ERR_IO, true, 402 _("The psFits object is not writable.")); 403 return false; 404 } 402 PS_ASSERT_FITS_WRITABLE(fits, false); 405 403 406 404 // move to the specified HDU … … 431 429 { 432 430 PS_ASSERT_FITS_NON_NULL(fits, false); 431 PS_ASSERT_FITS_WRITABLE(fits, false); 433 432 PS_ASSERT_STRING_NON_EMPTY(extname, false); 434 435 if (! fits->writable) {436 psError(PS_ERR_IO, true,437 _("The psFits object is not writable."));438 return false;439 }440 433 441 434 // move to the specified HDU … … 509 502 bool psFitsTruncate(psFits* fits) 510 503 { 511 PS_ASSERT_FITS_NON_NULL(fits, NULL); 512 513 if (! fits->writable) { 514 psError(PS_ERR_IO, true, 515 _("The psFits object is not writable.")); 516 return PS_FITS_TYPE_NONE; 517 } 504 PS_ASSERT_FITS_NON_NULL(fits, false); 505 PS_ASSERT_FITS_WRITABLE(fits, false); 518 506 519 507 int newEnd = psFitsGetExtNum(fits); … … 547 535 { 548 536 PS_ASSERT_FITS_NON_NULL(fits, false); 537 PS_ASSERT_FITS_WRITABLE(fits, false); 549 538 550 539 // convert psFitsCompressionType to cfitsio compression types -
trunk/psLib/src/fits/psFits.h
r15249 r15335 4 4 * @author Robert DeSonia, MHPCC 5 5 * 6 * @version $Revision: 1.3 3$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-10- 09 03:00:05$6 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-10-19 23:52:39 $ 8 8 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 57 57 struct { 58 58 bool compression; ///< Compression convention: handling of compressed images 59 bool psBitpix; ///< Pan-STARRS BITPIX for floating-point conversion 59 60 } conventions; ///< Conventions to honour 61 double bscale; ///< Scaling to apply when reading FITS data; 0 for auto 62 double bzero; ///< Zero point to apply when reading FITS data; auto if bscale = 0 60 63 } psFits; 61 64 -
trunk/psLib/src/fits/psFitsHeader.c
r15191 r15335 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.3 6$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-10- 04 01:16:33$9 * @version $Revision: 1.37 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-10-19 23:52:39 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 593 593 { 594 594 PS_ASSERT_FITS_NON_NULL(fits, false); 595 PS_ASSERT_FITS_WRITABLE(fits, false); 595 596 PS_ASSERT_METADATA_NON_NULL(output, false); 596 597 … … 604 605 { 605 606 PS_ASSERT_FITS_NON_NULL(fits, false); 607 PS_ASSERT_FITS_WRITABLE(fits, false); 606 608 607 609 // We allow output == NULL in order to write a minimal header. -
trunk/psLib/src/fits/psFitsImage.c
r15179 r15335 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-10- 03 21:27:21$9 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-10-19 23:52:39 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 185 185 } 186 186 187 188 bool psFitsImageSize(int *numCols, int *numRows, psElemType *type, const psFits *fits, psRegion region) 189 { 190 PS_ASSERT_FITS_NON_NULL(fits, NULL); 191 192 if (psFitsCheckSingleCompressedImagePHU(fits, NULL)) { 193 // This is really what we want, not the empty PHU 194 psTrace("psLib.fits", 1, 195 "This PHU should really be a compressed image --- reading that image instead."); 196 } 197 198 p_psFitsReadInfo *info = p_psFitsReadInfoAlloc(fits, region, 0); // How big the region to read is 199 200 if (numCols) { 201 *numCols = info->lastPixel[0] - info->firstPixel[0] + 1; 202 } 203 if (numRows) { 204 *numRows = info->lastPixel[1] - info->firstPixel[1] + 1; 205 } 206 if (type) { 207 *type = info->psDatatype; 208 } 209 210 psFree(info); 211 212 return true; 213 } 214 215 187 216 // Read into an extant image of just the right size 188 217 static bool fitsReadImage(psImage *output, // Output image … … 287 316 { 288 317 PS_ASSERT_FITS_NON_NULL(fits, false); 318 PS_ASSERT_FITS_WRITABLE(fits, false); 289 319 PS_ASSERT_IMAGE_NON_NULL(input, false); 290 320 // this is equivalent to insert after the last HDU … … 302 332 { 303 333 PS_ASSERT_FITS_NON_NULL(fits, false); 334 PS_ASSERT_FITS_WRITABLE(fits, false); 304 335 PS_ASSERT_IMAGE_NON_NULL(input, false); 305 336 … … 402 433 { 403 434 PS_ASSERT_FITS_NON_NULL(fits, false); 435 PS_ASSERT_FITS_WRITABLE(fits, false); 404 436 PS_ASSERT_IMAGE_NON_NULL(input, false); 405 437 … … 556 588 { 557 589 PS_ASSERT_FITS_NON_NULL(fits, false); 590 PS_ASSERT_FITS_WRITABLE(fits, false); 558 591 PS_ASSERT_ARRAY_NON_NULL(input, false); 559 592 … … 622 655 { 623 656 PS_ASSERT_FITS_NON_NULL(fits, false); 657 PS_ASSERT_FITS_WRITABLE(fits, false); 624 658 PS_ASSERT_ARRAY_NON_NULL(input, false); 625 659 -
trunk/psLib/src/fits/psFitsImage.h
r11248 r15335 4 4 * @author Robert DeSonia, MHPCC 5 5 * 6 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $7 * @date $Date: 2007- 01-23 22:47:23$6 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-10-19 23:52:39 $ 8 8 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 21 21 #include "psMetadata.h" 22 22 #include "psImage.h" 23 24 /// Return the dimensions and type of the FITS image 25 bool psFitsImageSize(int *numCols, int *numRows, ///< Size of image 26 psElemType *type, ///< Type of image 27 const psFits *fits, ///< FITS file pointer 28 psRegion region ///< Region in the FITS image to read 29 ); 23 30 24 31 /** Reads an image, given the desired region and z-plane.
Note:
See TracChangeset
for help on using the changeset viewer.
