Changeset 3047 in Sophya
- Timestamp:
- Aug 11, 2006, 10:42:10 AM (19 years ago)
- Location:
- trunk/SophyaExt/FitsIOServer
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitshdtable.h
r2864 r3047 21 21 22 22 inline FitsInOutFile& operator >> (FitsInOutFile& is, BaseDataTable & obj) 23 { FitsHandler<BaseDataTable> fio(obj); fio.Read(is); is.MoveToNextHDU(); return(is); } 23 { FitsHandler<BaseDataTable> fio(obj); is.SkipEmptyFirstHDU(); 24 fio.Read(is); is.MoveToNextHDU(); return(is); } 24 25 25 26 -
trunk/SophyaExt/FitsIOServer/fitsinoutfile.cc
r2937 r3047 322 322 return MoveRelToHDU(1); 323 323 else return -1; 324 } 325 326 /*-- Methode --*/ 327 /*! 328 Skip HDU 1 if NAXIS=0 (no data), on a file opened for reading. 329 return true if moved to HDU No 2 330 */ 331 bool FitsInOutFile::SkipEmptyFirstHDU() 332 { 333 if (fptr_ == NULL) return false; 334 if (mode_ == Fits_Create) return false; 335 if (CurrentHDU() != 1) return false; 336 int naxis = 2; 337 long naxes[2]; 338 GetImageHDUInfo(naxis, naxes); 339 if ((naxis == 0) && (NbHDUs() > 1)) { 340 MoveRelToHDU(1); 341 return true; 342 } 343 return false; 324 344 } 325 345 -
trunk/SophyaExt/FitsIOServer/fitsinoutfile.h
r2974 r3047 112 112 //! Move to the next HDU specified by relhdu. Returns the newly opened HDU type (<0 at EOF) 113 113 int MoveToNextHDU(); 114 //! Skip the first HDU if it contains no data. 115 bool SkipEmptyFirstHDU(); 114 116 115 117 //---- IMAGE_HDU manipulation methods -
trunk/SophyaExt/FitsIOServer/fitslocalmap.cc
r2898 r3047 81 81 int FITS_LocalMap<T>::CheckReadability(FitsInOutFile& is) 82 82 { 83 if (is.CurrentHDUType() != BINARY_TBL) return 0;83 if (is.CurrentHDUType() != IMAGE_HDU ) return 0; 84 84 string key; 85 85 key = "Content"; 86 86 string clsnm = is.KeyValue(key); 87 87 if (clsnm != "LocalMap") return 0; 88 89 vector<string> colnames; 90 vector<int> coltypes; 91 vector<long> repcnt; 92 vector<long> width; 93 long ncols = is.GetColInfo(colnames, coltypes, repcnt, width); 94 if (ncols < 1) return 0; 88 89 long naxes[2]; 90 int naxis=2; 91 int imgtyp = is.GetImageHDUInfo(naxis, naxes); 92 if (naxis != 2) return 0; 93 95 94 T x = 0; 96 if ( coltypes[0] == FitsTypes::DataType(x)) return 2 ;95 if (imgtyp == FitsTypes::ImageType(x)) return 2 ; 97 96 else return 1; 98 97 } … … 132 131 // 133 132 if (!is.IsFitsImage()) 134 { 135 throw PException("ReadFromFits: the fits file seems not to be an image"); 136 } 133 throw PException("ReadFromFits: the fits file seems not to be an image"); 137 134 int dimension = is.nbDimOfImage(); 138 135 if (dimension != 2 ) 139 { 140 cout << " WARNING::ReadFromFits: the fits image seems not to be a matrix" << endl; 141 } 136 cout << " WARNING::ReadFromFits: the fits image seems not to be a matrix" << endl; 137 142 138 nbentries = is.nbOfImageData(); 143 139 // … … 149 145 int_4 nPix = dvl.GetI("NPIX"); 150 146 if (nPix != nbentries) 151 { 152 throw IOExc("longueur datablock incompatible avec nPix"); 153 } 147 throw IOExc("longueur datablock incompatible avec nPix"); 154 148 dobj_->ReSize(nSzX, nSzY); 155 149 int_4 localMappingDone = dvl.GetI("LCMP"); -
trunk/SophyaExt/FitsIOServer/fitslocalmap.h
r3035 r3047 52 52 template <class T> 53 53 inline FitsInOutFile& operator >> (FitsInOutFile& fiis, LocalMap<T> & lm) 54 { FITS_LocalMap<T> fih(&lm); fih.Read(fiis); return (fiis); } 54 { FITS_LocalMap<T> fih(&lm); fih.Read(fiis); 55 fiis.MoveToNextHDU(); return (fiis); } 55 56 56 57 } // Fin du namespace -
trunk/SophyaExt/FitsIOServer/fitsntuple.h
r3035 r3047 81 81 82 82 inline FitsInOutFile& operator >> (FitsInOutFile& fiis, NTuple & nt) 83 { FITS_NTuple fih(&nt); fih.Read(fiis); return (fiis); } 83 { FITS_NTuple fih(&nt); fiis.SkipEmptyFirstHDU(); 84 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); } 84 85 85 86 -
trunk/SophyaExt/FitsIOServer/fitsspherehealpix.cc
r2979 r3047 172 172 void FITS_SphereHEALPix<T>::ReadFromFits(FitsInFile& is) 173 173 { 174 if(dobj_ == NULL) 175 { 176 dobj_= new SphereHEALPix<T>; 177 ownobj_= true; 178 } 174 if (is.CurrentHDUType() != BINARY_TBL ) 175 throw FitsIOException("FITS_SphereHEALPix<T>::ReadFromFits Not a binary table HDU"); 176 177 if(dobj_ == NULL) { 178 dobj_= new SphereHEALPix<T>; 179 ownobj_= true; 180 } 179 181 int nbcols, nbentries; 180 182 // -
trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h
r3035 r3047 56 56 template <class T> 57 57 inline FitsInOutFile& operator >> (FitsInOutFile& fiis, SphereHEALPix<T> & sph) 58 { FITS_SphereHEALPix<T> fih(&sph); fih.Read(fiis); return (fiis); } 58 { FITS_SphereHEALPix<T> fih(&sph); fiis.SkipEmptyFirstHDU(); 59 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); } 59 60 60 61 -
trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h
r3035 r3047 58 58 template <class T> 59 59 inline FitsInOutFile& operator >> (FitsInOutFile& fiis, SphereThetaPhi<T> & sph) 60 { FITS_SphereThetaPhi<T> fih(&sph); fih.Read(fiis); return (fiis); } 60 { FITS_SphereThetaPhi<T> fih(&sph); fiis.SkipEmptyFirstHDU(); 61 fih.Read(fiis); fiis.MoveToNextHDU(); return (fiis); } 61 62 62 63
Note:
See TracChangeset
for help on using the changeset viewer.