Changeset 861 in Sophya for trunk/SophyaExt/FitsIOServer/fitsfile.cc
- Timestamp:
- Apr 10, 2000, 3:30:31 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsfile.cc
r839 r861 147 147 } 148 148 } 149 void FitsFile::makeHeaderImageOnFits(char type, int naxis1,int naxis2,int naxis3) const 150 { 151 int status = 0; 152 long naxis = 3; 153 if (naxis3 <=1) 154 { 155 naxis--; 156 if (naxis2 <=1) naxis--; 157 } 158 long naxes[3]; 159 naxes[0]= naxis1; 160 naxes[1]= naxis2; 161 naxes[2]= naxis3; 149 void FitsFile::makeHeaderImageOnFits(char type, int nbdim, int* naxisn) const 150 { 151 int status = 0; 152 long naxis = nbdim; 153 long* naxes = new long[nbdim]; 154 for (int k=0; k< nbdim; k++) naxes[k] = (long)naxisn[k]; 162 155 if (type == 'D') 163 156 fits_create_img(fptr_,DOUBLE_IMG,naxis,naxes,&status); … … 173 166 throw PException("FitsFile:::makeHeaderImageOnFits:unprogrammed type of data "); 174 167 } 168 delete [] naxes; 175 169 if( status ) printerror( status ); 176 170 … … 221 215 222 216 // read the NAXIS1 and NAXIS2 keyword to get image size 223 long naxes[3]= {0,0,0};217 long* naxes = new long[naxis_] ; 224 218 int nfound; 225 219 fits_read_keys_lng(fptr_,"NAXIS",1,naxis_,naxes,&nfound,&status); 226 220 if( status ) printerror( status ); 227 228 naxis1_ = (int)naxes[0]; 229 naxis2_ = (int)naxes[1]; 230 naxis3_ = (int)naxes[2]; 231 232 if(naxis_ == 3 && naxis3_ > 1) 233 { 234 cout << "multi-dimensional image =" << naxis << endl; 235 cout << "length Z axis = " << naxis3_ << endl; 236 throw IOExc("FitsFile::put_fits_image %%Expected 1-D data or 2-D data"); 237 } 238 239 nbData_ = naxis1_; 240 if(naxis >= 2) nbData_*= naxis2_; 241 if(naxis == 3) nbData_*= naxis3_; 242 } 243 244 int FitsFile::nbDimOfImage() const 245 { 246 int ndim=3; 247 if (naxis_ <3 || naxis3_ <= 1) ndim-- ; 248 if (naxis_ <2 || (naxis3_ <= 1 && naxis2_ <= 1) ) ndim--; 249 return ndim; 250 } 221 if (nfound != naxis_ ) 222 cout << " WARNING : " << nfound << " axes found, expexted naxis= " << naxis_ << endl; 223 int lastSize = naxes[naxis_-1]; 224 while (lastSize <= 1) 225 { 226 naxis_--; 227 lastSize = naxes[naxis_-1]; 228 } 229 230 nbData_ = 1; 231 for (int k=0; k<naxis_; k++) 232 { 233 naxisn_.push_back( (int)naxes[k] ); 234 if (naxisn_[k] > 0) nbData_ *= naxisn_[k]; 235 236 } 237 delete [] naxes; 238 } 239 251 240 252 241 void FitsFile::GetBinTabFCol(double* valeurs,int nentries, int NoCol) const
Note:
See TracChangeset
for help on using the changeset viewer.