Main Page | Modules | Alphabetical List | Class List | File List | Class Members | File Members

fitshandle Class Reference
[FITS-related functionality]

#include <fitshandle.h>

List of all members.

Public Types

enum  openmethod { CREATE, OPEN }

Public Member Functions

File-level access and manipulation.
 fitshandle ()
 fitshandle (const std::string &fname, openmethod mode=OPEN, int rwmode=READONLY)
 fitshandle (const std::string &fname, int hdunum, int rwmode=READONLY)
 ~fitshandle ()
void open (const std::string &fname, int rwmode=READONLY)
void create (const std::string &fname)
void close ()
void goto_hdu (int hdu)
void assert_pdmtype (const std::string &pdmtype)
void insert_bintab (const std::vector< fitscolumn > &cols)
void insert_asctab (const std::vector< fitscolumn > &cols)
void insert_image (int btpx, const std::vector< long > &Axes)
template<typename T>
void insert_image (int btpx, const arr2< T > &data)
Information about the current HDU
int bitpix () const
int hdutype () const
const std::vector< long > & axes () const
const std::string & colname (int i) const
const std::string & colunit (int i) const
long repcount (int i) const
int coltype (int i) const
int ncols () const
int nrows () const
long nelems (int i) const
Keyword-handling methods
void copy_header (const fitshandle &orig)
void copy_historified_header (const fitshandle &orig)
template<typename T>
void add_key (const std::string &name, const T &value, const std::string &comment="")
template<typename T>
void update_key (const std::string &name, const T &value, const std::string &comment="")
void delete_key (const std::string &name)
void add_comment (const std::string &comment)
template<typename T>
void get_key (const std::string &name, T &value)
template<typename T>
get_key (const std::string &name)
bool key_present (const std::string &name)
Methods for table data I/O
template<typename T>
void read_column_raw (int colnum, T *data, long num, long offset=0)
template<typename T>
void read_column (int colnum, arr< T > &data, long offset=0)
template<typename T>
void read_column (int colnum, T &data, long offset=0)
template<typename T>
void write_column_raw (int colnum, const T *data, long num, long offset=0)
template<typename T>
void write_column (int colnum, const arr< T > &data, long offset=0)
template<typename T>
void write_column (int colnum, const T &data, long offset=0)
Methods for image data I/O
template<typename T>
void read_image (arr2< T > &data)
template<typename T>
void read_subimage (arr2< T > &data, int xl, int yl)
template<typename T>
void read_subimage (arr< T > &data, long offset=0)
template<typename T>
void write_image (const arr2< T > &data)
template<typename T>
void write_subimage (const arr< T > &data, long offset=0)


Detailed Description

Class for performing I/O from/to FITS files.

Definition at line 82 of file fitshandle.h.


Member Enumeration Documentation

enum fitshandle::openmethod
 

the list of modes in which a fitshandle can be opened.

Enumeration values:
CREATE  the file must not yet exist
OPEN  the file must already exist

Definition at line 130 of file fitshandle.h.


Constructor & Destructor Documentation

fitshandle::fitshandle  )  [inline]
 

Creates an unconnected fitshandle.

Definition at line 138 of file fitshandle.h.

fitshandle::fitshandle const std::string &  fname,
openmethod  mode = OPEN,
int  rwmode = READONLY
[inline]
 

Creates a fitshandle connected to file fname. If rwmode == READONLY, no writing access is permitted; if it is READWRITE, reading and writing can be performed.

Definition at line 143 of file fitshandle.h.

fitshandle::fitshandle const std::string &  fname,
int  hdunum,
int  rwmode = READONLY
[inline]
 

Creates a fitshandle connected to file fname and jumps directly to the HDU with the number hdunum. If rwmode == READONLY, no writing access is permitted; if it is READWRITE, reading and writing can be performed.

Definition at line 156 of file fitshandle.h.

fitshandle::~fitshandle  )  [inline]
 

Performs all necessary cleanups.

Definition at line 164 of file fitshandle.h.


Member Function Documentation

void fitshandle::open const std::string &  fname,
int  rwmode = READONLY
 

Connects to the file fname. If rwmode == READONLY, no writing access is permitted; if it is READWRITE, reading and writing can be performed.

Definition at line 185 of file fitshandle.cc.

void fitshandle::create const std::string &  fname  ) 
 

Creates the file fname and connects to it.

Definition at line 192 of file fitshandle.cc.

void fitshandle::close  )  [inline]
 

Closes the current file.

Definition at line 173 of file fitshandle.h.

void fitshandle::goto_hdu int  hdu  ) 
 

Jumps to the HDU with the absolute number hdu.

Definition at line 201 of file fitshandle.cc.

void fitshandle::assert_pdmtype const std::string &  pdmtype  ) 
 

Asserts that the PDMTYPE of the current HDU is pdmtype.

Definition at line 510 of file fitshandle.cc.

void fitshandle::insert_bintab const std::vector< fitscolumn > &  cols  ) 
 

Inserts a binary table described by cols.

Definition at line 209 of file fitshandle.cc.

void fitshandle::insert_asctab const std::vector< fitscolumn > &  cols  ) 
 

Inserts an ASCII table described by cols. The width of the columns is chosen automatically, in a way that avoids truncation.

Definition at line 230 of file fitshandle.cc.

void fitshandle::insert_image int  btpx,
const std::vector< long > &  Axes
 

Inserts a FITS image with the type given by btpx and dimensions given by Axes.

Definition at line 259 of file fitshandle.cc.

template<typename T>
void fitshandle::insert_image int  btpx,
const arr2< T > &  data
 

Inserts a 2D FITS image with the type given by btpx, whose contents are given in data.

Definition at line 272 of file fitshandle.cc.

int fitshandle::bitpix  )  const [inline]
 

If the current HDU is an image, returns the BITPIX parameter of that image, else throws an exception.

Definition at line 198 of file fitshandle.h.

int fitshandle::hdutype  )  const [inline]
 

Returns the FITS type code for the current HDU.

Definition at line 204 of file fitshandle.h.

const std::vector<long>& fitshandle::axes  )  const [inline]
 

Returns the dimensions of the current image.

Definition at line 206 of file fitshandle.h.

const std::string& fitshandle::colname int  i  )  const [inline]
 

Returns the name of column #i.

Definition at line 212 of file fitshandle.h.

const std::string& fitshandle::colunit int  i  )  const [inline]
 

Returns the unit of column #i.

Definition at line 218 of file fitshandle.h.

long fitshandle::repcount int  i  )  const [inline]
 

Returns repetition count of column #i.

Definition at line 224 of file fitshandle.h.

int fitshandle::coltype int  i  )  const [inline]
 

Returns the FITS type code for column #i.

Definition at line 230 of file fitshandle.h.

int fitshandle::ncols  )  const [inline]
 

Returns the number of columns in the current table.

Definition at line 236 of file fitshandle.h.

int fitshandle::nrows  )  const [inline]
 

Returns the number of rows in the current table.

Definition at line 242 of file fitshandle.h.

long fitshandle::nelems int  i  )  const [inline]
 

Returns the total number of elements (nrows*repcount) in column #i.

Definition at line 249 of file fitshandle.h.

void fitshandle::copy_header const fitshandle orig  ) 
 

Copies all header keywords from the current HDU of orig to the current HDU of *this.

Definition at line 334 of file fitshandle.cc.

void fitshandle::copy_historified_header const fitshandle orig  ) 
 

Copies all header keywords from the current HDU of orig to the current HDU of *this, prepending a HISTORY keyword to every line.

Definition at line 292 of file fitshandle.cc.

template<typename T>
void fitshandle::add_key const std::string &  name,
const T &  value,
const std::string &  comment = ""
 

Adds a new header line consisting of key, value and comment.

Definition at line 373 of file fitshandle.cc.

template<typename T>
void fitshandle::update_key const std::string &  name,
const T &  value,
const std::string &  comment = ""
 

Updates key with value and comment.

Definition at line 413 of file fitshandle.cc.

void fitshandle::delete_key const std::string &  name  ) 
 

Deletes key from the header.

Definition at line 450 of file fitshandle.cc.

void fitshandle::add_comment const std::string &  comment  ) 
 

Adds comment as a comment line.

Definition at line 457 of file fitshandle.cc.

template<typename T>
void fitshandle::get_key const std::string &  name,
T &  value
 

Reads the value belonging to key and returns it in value.

Definition at line 464 of file fitshandle.cc.

template<typename T>
T fitshandle::get_key const std::string &  name  )  [inline]
 

Returms the value belonging to key.

Definition at line 283 of file fitshandle.h.

bool fitshandle::key_present const std::string &  name  ) 
 

Returns true if key is present, else false.

Definition at line 500 of file fitshandle.cc.

template<typename T>
void fitshandle::read_column_raw int  colnum,
T *  data,
long  num,
long  offset = 0
[inline]
 

Copies num elements from column colnum to the memory pointed to by data, starting at offset offset in the column.

Definition at line 298 of file fitshandle.h.

template<typename T>
void fitshandle::read_column int  colnum,
arr< T > &  data,
long  offset = 0
[inline]
 

Fills data with elements from column colnum, starting at offset offset in the column.

Definition at line 303 of file fitshandle.h.

template<typename T>
void fitshandle::read_column int  colnum,
T &  data,
long  offset = 0
[inline]
 

Reads the element #offset from column colnum into data.

Definition at line 307 of file fitshandle.h.

template<typename T>
void fitshandle::write_column_raw int  colnum,
const T *  data,
long  num,
long  offset = 0
[inline]
 

Copies num elements from the memory pointed to by data to the column colnum, starting at offset offset in the column.

Definition at line 320 of file fitshandle.h.

template<typename T>
void fitshandle::write_column int  colnum,
const arr< T > &  data,
long  offset = 0
[inline]
 

Copies all elements from data to the column colnum, starting at offset offset in the column.

Definition at line 325 of file fitshandle.h.

template<typename T>
void fitshandle::write_column int  colnum,
const T &  data,
long  offset = 0
[inline]
 

Copies data to the column colnum, at the position offset.

Definition at line 329 of file fitshandle.h.

template<typename T>
void fitshandle::read_image arr2< T > &  data  ) 
 

Reads the current image into data, which is resized accordingly.

Definition at line 610 of file fitshandle.cc.

template<typename T>
void fitshandle::read_subimage arr2< T > &  data,
int  xl,
int  yl
 

Reads a partial image, whose dimensions are given by the dimensions of data, into data. The starting pixel indices are given by xl and yl.

Definition at line 625 of file fitshandle.cc.

template<typename T>
void fitshandle::read_subimage arr< T > &  data,
long  offset = 0
 

Fills data with values from the image, starting at the offset offset in the image. The image is treated as a one-dimensional array.

Definition at line 639 of file fitshandle.cc.

template<typename T>
void fitshandle::write_image const arr2< T > &  data  ) 
 

Writes data into the current image. data must have the same dimensions as specified in the HDU.

Definition at line 580 of file fitshandle.cc.

template<typename T>
void fitshandle::write_subimage const arr< T > &  data,
long  offset = 0
 

Copies data to the image, starting at the offset offset in the image. The image is treated as a one-dimensional array.

Definition at line 597 of file fitshandle.cc.


The documentation for this class was generated from the following files:
Generated on Fri Jul 8 09:37:14 2005 for LevelS C++ support library