source: trunk/src/FitsIO/WriteArray.hh

Last change on this file was 1354, checked in by MatthewWhiting, 10 years ago

#209 - Changing default bitpix for masks to SHORT_IMG. Also making front-end functions to the writing of arrays. These reside in WriteArray?, and cover float (with blank pixel handling), int and long. Masks can use long if there are lots (>32K) of objects.

File size: 1.1 KB
Line 
1#ifndef DUCHAMP_WRITE_ARRAY_HH_
2#define DUCHAMP_WRITE_ARRAY_HH_
3
4#include <duchamp/duchamp.hh>
5#include <duchamp/Cubes/cubes.hh>
6#include <fitsio.h>
7
8namespace duchamp {
9
10  class WriteArray
11  {
12  public:
13    WriteArray();
14    WriteArray(Cube *cube);
15    WriteArray(Cube *cube, int bitpix);
16    WriteArray(const WriteArray& other);
17    WriteArray& operator= (const WriteArray& other);
18    virtual ~WriteArray(){};
19
20    void setCube(Cube *cube){itsCube=cube;};
21    void setBitpix(int bitpix){itsBitpix = bitpix;};
22    void setFilename(std::string filename){itsFilename=filename;};
23    void setFITSptr(fitsfile *fptr){itsFptr=fptr;};
24    void set2D(bool b){itsFlag2D=b;};
25
26    OUTCOME openFile();
27    OUTCOME writeBasicHeader();
28    virtual OUTCOME writeHeader() = 0;
29    virtual OUTCOME writeData() = 0;
30    OUTCOME closeFile();
31
32    OUTCOME write();
33
34  protected:
35     
36      OUTCOME writeToFITS_flt(size_t size, float *array);
37      OUTCOME writeToFITS_int(size_t size, int *array);
38      OUTCOME writeToFITS_long(size_t size, long *array);
39     
40    Cube *itsCube;
41    std::string itsFilename;
42    int itsBitpix;
43    bool itsFlag2D;
44    fitsfile *itsFptr;
45  };
46
47}
48
49#endif
Note: See TracBrowser for help on using the repository browser.