Changeset 1771 in Sophya for trunk/SophyaExt/FitsIOServer/fitsfile.cc
- Timestamp:
- Nov 16, 2001, 11:26:58 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsfile.cc
r1752 r1771 350 350 else hdunum_++; 351 351 } 352 getHeader ();352 getHeaderWithSophyaObject(); 353 353 if ( hdutype_ == FitsExtensionType_NULL ) 354 354 { … … 356 356 { 357 357 hdunum_++; 358 getHeader ();358 getHeaderWithSophyaObject(); 359 359 } 360 360 else … … 425 425 } 426 426 427 void FitsInFile::GetKeywordsFromHeader (int hdunum, list<FitsKeyword>& mots_cles) const 428 { 429 int status = 0; 430 int hdutype; 431 fits_movabs_hdu(fptr_,hdunum,&hdutype,&status); 432 if( status ) fits_report_error(stderr,status); 433 434 // get number of keywords 435 int nkeys,keypos; 436 fits_get_hdrpos(fptr_, &nkeys, &keypos,&status); 437 if( status ) fits_report_error(stderr,status); 438 // shift with the number of mandatory keywords 439 int num= 0; 440 // if primary header 441 if (hdunum == 1) 442 { 443 // read NAXIS 444 int naxis=0; 445 fits_read_key(fptr_,TINT,"NAXIS",&naxis,NULL,&status); 446 // number of mandatory keywords 447 num = naxis+3; 448 } 449 // extensions 450 else 451 { 452 if (hdutype == IMAGE_HDU) 453 { 454 // read NAXIS 455 int naxis=0; 456 fits_read_key(fptr_,TINT,"NAXIS",&naxis,NULL,&status); 457 // number of mandatory keywords 458 num = naxis+5; 459 } 460 else 461 if(hdutype == ASCII_TBL || hdutype == BINARY_TBL) 462 { 463 // number of mandatory keywords 464 num = 8; 465 } 466 } 467 int j; 468 char keyname[LEN_KEYWORD]; 469 char value[FLEN_VALUE]; 470 char comment[FLEN_COMMENT]; 471 for(j = num+1; j <= nkeys; j++) 472 { 473 char dtype; 474 fits_read_keyn(fptr_,j,keyname,value,comment,&status); 475 if(status) 476 { 477 fits_report_error(stderr,status); 478 status=0; 479 } 480 string kn(keyname); 481 string cm(comment); 482 string val(value); 483 FitsKeyword kw(kn, val, cm); 484 mots_cles.push_back(kw); 485 } 486 if (hdunum_ > 0) fits_movabs_hdu(fptr_,hdunum_,&hdutype,&status); 487 488 } 427 489 void FitsInFile::GetImageParameters (fitsfile* fileptr,FitsDataType& dataType,int& naxis,vector<int>& naxisn) 428 490 { … … 482 544 } 483 545 484 void FitsInFile::getHeader ()546 void FitsInFile::getHeaderWithSophyaObject() 485 547 { 486 548 // si hdunum_ > 1 lit le header correspondant … … 526 588 else 527 589 { 528 cout << "WARNING (FitsInFile::getHeader ) : error during movabs" << endl;590 cout << "WARNING (FitsInFile::getHeaderWithSophyaObject) : error during movabs" << endl; 529 591 hdutype_= FitsExtensionType_ERROR; 530 592 status =0; … … 567 629 int status = 0; 568 630 hdunum_++; 569 getHeader ();631 getHeaderWithSophyaObject(); 570 632 if ( hdutype_ == FitsExtensionType_NULL ) 571 633 { … … 1928 1990 void FitsOutFile::appendInputHeader(FitsInFile& infits, int hdunum) 1929 1991 { 1992 1993 infits.GetKeywordsFromHeader(hdunum, mots_cles_); 1994 /* 1930 1995 int status = 0; 1931 1996 int hdutype; … … 1986 2051 mots_cles_.push_back(kw); 1987 2052 } 2053 */ 1988 2054 } 1989 2055 void FitsOutFile::writeAppendedHeaderOnFits()
Note:
See TracChangeset
for help on using the changeset viewer.