Last change
on this file since 177 was
159,
checked in by Matthew Whiting, 18 years ago
|
Trying to improve the FITS-I/O, to be more robust about the ordering of the
axes. Not quite there yet, but do a commit to make sure the work is saved.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[159] | 1 | #include <iostream> |
---|
| 2 | #include <string> |
---|
| 3 | #include <string.h> |
---|
| 4 | #include <wcs.h> |
---|
| 5 | #include <wcshdr.h> |
---|
| 6 | #include <fitshdr.h> |
---|
| 7 | #include <wcsfix.h> |
---|
| 8 | #include <wcsunits.h> |
---|
| 9 | #define WCSLIB_GETWCSTAB // define this so that we don't try and redefine |
---|
| 10 | // wtbarr (this is a problem when using gcc v.4+ |
---|
| 11 | #include <fitsio.h> |
---|
| 12 | #include <math.h> |
---|
| 13 | #include <duchamp.hh> |
---|
| 14 | #include <Cubes/cubes.hh> |
---|
| 15 | |
---|
| 16 | int Cube::getFITSdata(string fname) |
---|
| 17 | { |
---|
| 18 | /** |
---|
| 19 | * Cube::getFITSdata(string fname) |
---|
| 20 | * |
---|
| 21 | * This routine will read in the data from the FITS file. |
---|
| 22 | * It will initialise the cube, set the dim and data arrays, |
---|
| 23 | * and make sure that the order of the axes are correct. |
---|
| 24 | * |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | fitsfile *fptr; |
---|
| 28 | int bitpix,numAxes; |
---|
| 29 | int noComments = 1; //so that fits_hdr2str will ignore COMMENT, HISTORY etc |
---|
| 30 | int nExc = 0,nkeys; |
---|
| 31 | char *hdr; |
---|
| 32 | int status = 0; |
---|
| 33 | if( fits_open_file(&fptr,fname.c_str(),READONLY,&status) ){ |
---|
| 34 | fits_report_error(stderr, status); |
---|
| 35 | return FAILURE; |
---|
| 36 | } |
---|
| 37 | status = 0; |
---|
| 38 | if(fits_get_img_dim(fptr, &numAxes, &status)){ |
---|
| 39 | fits_report_error(stderr, status); |
---|
| 40 | return FAILURE; |
---|
| 41 | } |
---|
| 42 | long *dimAxes = new long[numAxes]; |
---|
| 43 | for(int i=0;i<numAxes;i++) dimAxes[i]=1; |
---|
| 44 | status = 0; |
---|
| 45 | if(fits_get_img_size(fptr, numAxes, dimAxes, &status)){ |
---|
| 46 | fits_report_error(stderr, status); |
---|
| 47 | return FAILURE; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | } |
---|
| 54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.