Changeset 3493 in Sophya for trunk/SophyaExt


Ignore:
Timestamp:
Apr 30, 2008, 3:12:10 PM (17 years ago)
Author:
ansari
Message:

1/ Ajout methodes FitsArrayHandler<T>::ReadAtOffset() WriteAtOffset() pour lecture/ecriture de tableaux <> HDU IMAGE par morceaux
2/ Ajout entete commentaire avec copyright LAL+DAPNIA dans les fichiers .h

Reza 30/04/2008

Location:
trunk/SophyaExt/FitsIOServer
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/FitsIOServer/fabtcolread.h

    r3188 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2001
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16/* Interface Fits BINARY/ASCII Table Column Reader    cmv 26/09/2001 */
    27#ifndef FABTCOLREAD_H_SEEN
  • trunk/SophyaExt/FitsIOServer/fabtwriter.h

    r3128 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2001
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16/* Interface Fits BINARY/ASCII Table Writer    cmv 26/09/2001 */
    27#ifndef FABTWRITER_H_SEEN
  • trunk/SophyaExt/FitsIOServer/fboloread.h

    r3128 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2001
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16/* Interface Fits pour bolometre    cmv 29/09/2001 */
    27#ifndef FBOLOREAD_H_SEEN
  • trunk/SophyaExt/FitsIOServer/fbtntintf.h

    r3166 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2001
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16/* Interface Fits BINARY/ASCII Table     cmv 21/05/2001 */
    27#ifndef FBTNTINTF_H_SEEN
  • trunk/SophyaExt/FitsIOServer/fiosinit.cc

    r3452 r3493  
    2626int FitsIOServerInitiator::FgInit = 0;
    2727
     28// ---> Reporter ce numero de version ds fitsinoutfile.h (methode Version())
    2829// Module version number - 2.0 , Jul 2006
    2930// Module version number - 2.1 , Fev 2007 (version ll (LONGLONG) de cfitsio)
    30 #define MOD_VERS   2.1
     31// Module version number - 2.12 , Avr 2008 (Lecture-ecriture tableaux avec offset)
     32
     33#define MOD_VERS   2.12
    3134
    3235FitsIOServerInitiator::FitsIOServerInitiator()
  • trunk/SophyaExt/FitsIOServer/fiosinit.h

    r2864 r3493  
    1 // This may look like C code, but it is really -*- C++ -*-
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur, R. Ansari , 2000-2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    26// Classe d'initialiseur du module FitsIOServer
    37
     
    610
    711
    8 // Classe d''initialisation pour les modules de PEIDA++
     12// Classe d''initialisation pour les modules de SOPHYA
    913#include "sophyainit.h"
    1014
  • trunk/SophyaExt/FitsIOServer/fitsarrhand.h

    r3167 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005-2008
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSARRHAND_H
    27#define FITSARRHAND_H
     
    6469
    6570  //----- Ecriture
     71  //! Writes the complete array as an IMAGE HDU
    6672  virtual void     Write(FitsInOutFile& os)
    6773    {
    68       if ( dobj == NULL)
    69         throw NullPtrError("FitsArrayHandler<T>::Write() dobj=NULL ");
     74      if (( dobj == NULL) || (dobj->Size() < 1)) 
     75          throw NullPtrError("FitsArrayHandler<T>::Write() dobj=NULL or dobj->Size()=0");
     76       
    7077      LONGLONG naxes[BASEARRAY_MAXNDIMS] = {0,0,0,0,0};
    7178      for(int_4 id=0; id<dobj->NbDimensions(); id++)
     
    8188
    8289  //----- Lecture
     90  //! Resize the array and reads the complete IMAGE HDU to the array
    8391  virtual void     Read(FitsInOutFile& is)
    8492    {
     
    97105      }
    98106      sa_size_t sz[BASEARRAY_MAXNDIMS];
    99       if (naxis > BASEARRAY_MAXNDIMS) naxis = BASEARRAY_MAXNDIMS;
     107      if (naxis > BASEARRAY_MAXNDIMS) {
     108        cerr << "FitsArrayHandler<T>::Read()/Warning FITS NAXIS=" << naxis
     109                 << " > BASEARRAY_MAXNDIMS=" << BASEARRAY_MAXNDIMS << endl;
     110        naxis = BASEARRAY_MAXNDIMS;
     111      }
    100112      for(int_4 id=0; id<naxis; id++) sz[id] = naxes[id];
    101113      dobj->SetSize(naxis, sz, 1, false);
    102114      FitsBlockRW<T>::ReadImageData(is, dobj->Data(), dobj->Size());
    103115      is.GetHeaderRecords(dobj->Info());
     116    }
     117
     118  //----- Lecture avec specification d'offset et taille donnee par le tableau
     119  /*!  \brief Reads from the fits file into the array, at the specified offset
     120 
     121     The array should be allocated and its size is used to define the number of
     122     pixels to be read.
     123     \warning The offset should be specified with SOPHYA/C array index convention
     124     (starting at zero) - and NOT the cfitsio/fortran convention.
     125     The offset should contain as many elements as the fits NAXIS keyword.
     126  */
     127  virtual void     ReadAtOffset(FitsInOutFile& is, sa_size_t* offset)
     128    {
     129    if (( dobj == NULL) || (dobj->Size() < 1)) 
     130          throw NullPtrError("FitsArrayHandler<T>::ReadAtOffset() dobj=NULL or dobj->Size()=0");
     131       
     132    LONGLONG naxes[BASEARRAY_MAXNDIMS];
     133    int naxis=BASEARRAY_MAXNDIMS;
     134    is.GetImageHDUInfo(naxis, naxes);
     135    LONGLONG fpix[15];
     136    int namx = (naxis < 15) ? naxis : 15;
     137    for(int i=0; i<namx; i++) fpix[i] = offset[i]+1;
     138    FitsBlockRW<T>::ReadImageData(is, dobj->Data(), dobj->Size(), fpix);
     139    is.GetHeaderRecords(dobj->Info());
     140    }
     141
     142  //----- Ecriture avec specification d'offset et taille donnee par le tableau
     143  /*!  \brief Writes the array to the fits file, at the specified offset
     144 
     145     The array should be allocated and its size is used to define the number of
     146     pixels to be read.
     147     \warning The offset should be specified with SOPHYA/C array index convention
     148     (starting at zero) - and NOT the cfitsio/fortran convention.
     149     The offset should contain as many elements as the fits NAXIS keyword.
     150     \warning The IMAGE HDU should be already created using FitsInOutFile::CreateImageHDU().
     151  */
     152  virtual void     WriteAtOffset(FitsInOutFile& os, sa_size_t* offset)
     153    {
     154    if (( dobj == NULL) || (dobj->Size() < 1)) 
     155          throw NullPtrError("FitsArrayHandler<T>::ReadAtOffset() dobj=NULL or dobj->Size()=0");
     156
     157    LONGLONG naxes[BASEARRAY_MAXNDIMS];
     158    int naxis=BASEARRAY_MAXNDIMS;
     159    os.GetImageHDUInfo(naxis, naxes);
     160    LONGLONG fpix[15];
     161    int namx = (naxis < 15) ? naxis : 15;
     162    for(int i=0; i<namx; i++) fpix[i] = offset[i]+1;
     163    FitsBlockRW<T>::WriteImageData(os, dobj->Data(), dobj->Size(), fpix);       
    104164    }
    105165
     
    110170
    111171
     172//! operator << overload to write a TArray<T> to a fits IMAGE HDU
    112173template <class T>
    113174inline FitsInOutFile& operator << (FitsInOutFile& os, TArray<T> const & obj)
    114175{ FitsArrayHandler<T> fio(const_cast< TArray<T> &>(obj));  fio.Write(os);  return os; }
    115176
     177//! operator >> overload to read a TArray<T> from a fits IMAGE HDU
    116178template <class T>
    117179inline FitsInOutFile& operator >> (FitsInOutFile& is, TArray<T> & obj)
  • trunk/SophyaExt/FitsIOServer/fitsblkrw.h

    r3167 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005-2008
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSBLKRW_H
    27#define FITSBLKRW_H
     
    2025{
    2126  int status = 0;
    22   LONGLONG fpix[5] = {1,1,1,1,1};
     27  LONGLONG fpix[15] = {1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1};
    2328  if (fpixel == NULL) fpixel = fpix;
    2429  T * ncd = const_cast<T *>(d);
     
    4045{
    4146  int status = 0;
    42   LONGLONG fpix[5] = {1,1,1,1,1};
     47  LONGLONG fpix[15] = {1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1};
    4348  if (fpixel == NULL) fpixel = fpix;
    4449  int anynul = 0;
  • trunk/SophyaExt/FitsIOServer/fitsfile.h

    r2907 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur 09/2000    R. Ansari , 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSFILE_H
    27#define FITSFILE_H
  • trunk/SophyaExt/FitsIOServer/fitsgenedata.h

    r3063 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSGENDATAHAND_H
    27#define FITSGENDATAHAND_H
  • trunk/SophyaExt/FitsIOServer/fitshandler.h

    r2932 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari, 2005
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSHANDLER_H
    27#define FITSHANDLER_H
  • trunk/SophyaExt/FitsIOServer/fitshdtable.h

    r3047 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSDTABLEHAND_H
    27#define FITSDTABLEHAND_H
  • trunk/SophyaExt/FitsIOServer/fitshisterr.h

    r3123 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2007
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSHISTERRHAND_H
    27#define FITSHISTERRHAND_H
  • trunk/SophyaExt/FitsIOServer/fitshistos.h

    r3123 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   C. Magneville, 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSHISTOHAND_H
    27#define FITSHISTOHAND_H
  • trunk/SophyaExt/FitsIOServer/fitsinoutfile.h

    r3452 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005-2008
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSINOUTFILE_H
    27#define FITSINOUTFILE_H
     
    98103 static float      cfitsioVersion();
    99104 //! Return the SOPHYA FitsIOServer version
    100  static float      Version() { return 2.0; }
     105 static float      Version() { return 2.12; }
    101106
    102107 //! Return the file name as specified in the constructor (or Open)
  • trunk/SophyaExt/FitsIOServer/fitsioserver.h

    r3054 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari, C. Magneville, 2000-2008
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSIOSERVER_SEEN
    27#define FITSIOSERVER_SEEN
  • trunk/SophyaExt/FitsIOServer/fitslocalmap.h

    r3047 r3493  
    1 // Guy Le Meur 08/2000
    2 
    3 
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur 08/2000    R. Ansari , 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    46#ifndef FITSLOCALMAP_SEEN
    57#define FITSLOCALMAP_SEEN
  • trunk/SophyaExt/FitsIOServer/fitsmanager.h

    r2898 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSMANAGER_H
    27#define FITSMANAGER_H
  • trunk/SophyaExt/FitsIOServer/fitsntuple.h

    r3047 r3493  
    1 // Guy Le Meur 03/2000
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur 03/2000    R. Ansari , 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    26
    37
  • trunk/SophyaExt/FitsIOServer/fitsspherehealpix.h

    r3047 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur 03/2000    R. Ansari , 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSSPHEREHEALPIX_SEEN
    27#define FITSSPHEREHEALPIX_SEEN
    38
    4 
    5 // Guy Le Meur 03/2000
    69
    710
  • trunk/SophyaExt/FitsIOServer/fitsspherethetaphi.h

    r3047 r3493  
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   Guy Le Meur 10/2001     R. Ansari , 2006
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    16#ifndef FITSSPHERETHETAPHI_SEEN
    27#define FITSSPHERETHETAPHI_SEEN
    3 
    4 
    5 // Guy Le Meur 10/2001
    68
    79
  • trunk/SophyaExt/FitsIOServer/fitsswapper.h

    r3167 r3493  
    1 // This may look like C code, but it is really -*- C++ -*-
    2 // Gestion de block de donnees swapable
    3 //          C. Magneville R. Ansari  Mai 2005
    4 // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari,  C. Magneville,   Mai 2005
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    56#ifndef FITSSWAPPER_H
    67#define FITSSWAPPER_H
  • trunk/SophyaExt/FitsIOServer/swfitsdtable.h

    r3395 r3493  
    1 // This may look like C code, but it is really -*- C++ -*-
    2 // Class DataTable  (Row-Column data table in memory)
    3 //   R. Ansari -  Avril 2005
    4 //   (C)  LAL-IN2P3/CNRS    CEA-DAPNIA 
     1/*   
     2   --- SOPHYA software - FitsIOServer module ---
     3   R. Ansari , 2005-2008
     4   (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA
     5*/
    56
    67#ifndef SWFITSDTABLE_H_SEEN
     
    1516namespace SOPHYA {
    1617
    17 //! An implementation of BaseDataTable with using FITS files as swap space.
     18//! An implementation of BaseDataTable using FITS files as swap space.
    1819class SwFitsDataTable : public BaseDataTable {
    1920public:
Note: See TracChangeset for help on using the changeset viewer.