Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Compound Members   Related Pages  

CCfits::PHDU Class Reference

class representing the primary HDU for a FITS file. More...

#include <PHDU.h>

Inheritance diagram for CCfits::PHDU::

Inheritance diagram
CCfits::HDU List of all members.

Public Methods

virtual PHDU* clone (FITSBase *p) const=0
virtual void zero (double value)
virtual double zero () const
virtual double scale () const
template<typename S> void write (const std::vector< long > &first, long nElements, const std::valarray< S > &data, S *nullValue)
template<typename S> void write (long first, long nElements, const std::valarray< S > &data, S *nullValue)
template<typename S> void write (const std::vector< long > &first, long nElements, const std::valarray< S > &data)
template<typename S> void write (long first, long nElements, const std::valarray< S > &data)
template<typename S> void write (const std::vector< long > &firstVertex, const std::vector< long > &lastVertex, const std::valarray< S > &data)
template<typename S> void read (std::valarray< S > &image, long first, long nElements)
template<typename S> void read (std::valarray< S > &image, long first, long nElements, S *nullValue)
template<typename S> void read (std::valarray< S > &image, const std::vector< long > &first, long nElements)
template<typename S> void read (std::valarray< S > &image, const std::vector< long > &first, long nElements, S *nullValue)
template<typename S> void read (std::valarray< S > &image, const std::vector< long > &firstVertex, const std::vector< long > &lastVertex, const std::vector< long > &stride)
template<typename S> void read (std::valarray< S > &image, const std::vector< long > &firstVertex, const std::vector< long > &lastVertex, const std::vector< long > &stride, S *nullValue)

Protected Methods

 PHDU (const PHDU &right)
 PHDU (FITSBase *p, int bpix, int naxis, const std::vector< long > &axes)
 PHDU (FITSBase *p=0)

Detailed Description

class representing the primary HDU for a FITS file.

A PHDU object is automatically instantiated and added to a FITS object when a FITS file is accessed in any way. If a new file is created without specifying the data type for the header, CCfits assumes that the file is to be used for table extensions and creates a dummy header. PHDU instances are only created by FITS ctors. In the first release of CCfits, the Primary cannot be changed once declared.

PHDU and ExtHDU provide the same interface to writing images: multiple overloads of the templated PHDU::read and PHDU::write operations provide for (a) writing image data specified in a number of ways [C-array, std::vector, std::valarray] and with input location specified by initial pixel, by n-tuple, and by rectangular subset [generalized slice]; (b) reading image data specified similarly to the write options into a std::valarray.

Todo:
Implement functions that allow replacement of the primary image


Constructor & Destructor Documentation

CCfits::PHDU::PHDU ( const PHDU & right ) [protected]
 

copy constructor.

required for cloning primary HDUs when copying FITS files.

CCfits::PHDU::PHDU ( FITSBase * p,
int bpix,
int naxis,
const std::vector< long > & axes ) [protected]
 

Writing Primary HDU constructor, called by PrimaryHDU<T> class.

Constructor used for creating new PHDU (i.e. for writing data to FITS). also doubles as default constructor since all arguments have default values, which are passed to the HDU constructor

CCfits::PHDU::PHDU ( FITSBase * p = 0 ) [protected]
 

Reading Primary HDU constructor.

Constructor used when reading the primary HDU from an existing file. Does nothing except initialize, with the real work done by the subclass PrimaryHDU<T>.


Member Function Documentation

PHDU * CCfits::PHDU::clone ( FITSBase * p ) const [pure virtual]
 

virtual copy constructor, to be implemented in subclasses.

Reimplemented from CCfits::HDU.

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
const std::vector< long > & firstVertex,
const std::vector< long > & lastVertex,
const std::vector< long > & stride,
S * nullValue )
 

read an image subset into valarray image, processing null values.

The image subset is defined by two vertices and a stride indicating the 'denseness' of the values to be picked in each dimension (a stride = (1,1,1,...) means picking every pixel in every dimension, whereas stride = (2,2,2,...) means picking every other value in each dimension.

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
const std::vector< long > & firstVertex,
const std::vector< long > & lastVertex,
const std::vector< long > & stride )
 

read an image subset.

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
const std::vector< long > & first,
long nElements,
S * nullValue )
 

read part of an image array, processing null values.

As above except for

Parameters:
first   a vector<long> representing an n-tuple giving the coordinates in the image of the first pixel.

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
const std::vector< long > & first,
long nElements )
 

read an image section starting at a location specified by an n-tuple.

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
long first,
long nElements,
S * nullValue )
 

read part of an image array, processing null values.

Implicit data conversion is supported (i.e. user does not need to know the type of the data stored. A WrongExtensionType extension is thrown if *this is not an image.

Parameters:
image   The receiving container, a std::valarray reference
first   The first pixel from the array to read [a long value]
nElements   The number of values to read
nullValue   A pointer containing the value in the table to be considered as undefined. See cfitsio for details

template<typename S>
void CCfits::PHDU::read ( std::valarray< S > & image,
long first,
long nElements )
 

read an image section starting at a specified pixel.

double CCfits::PHDU::scale ( ) const [virtual]
 

return the BSCALE keyword value.

Reimplemented from CCfits::HDU.

template<typename S>
void CCfits::PHDU::write ( const std::vector< long > & firstVertex,
const std::vector< long > & lastVertex,
const std::valarray< S > & data )
 

write a subset (generalize slice) of data to the image.

A generalized slice/subset is a subset of the image (e.g. one plane of a data cube of size <= the dimension of the cube). It is specified by two opposite vertices. The equivalent cfitsio call does not support undefined data processing so there is no version that allows a null value to be specified.

Parameters:
firstVertex   the coordinates specifying lower and upper vertices of the n-dimensional slice
lastVertex  
data   The data to be written

template<typename S>
void CCfits::PHDU::write ( long first,
long nElements,
const std::valarray< S > & data )
 

write array starting from specified pixel number, without undefined data processing.

template<typename S>
void CCfits::PHDU::write ( const std::vector< long > & first,
long nElements,
const std::valarray< S > & data )
 

write array starting from specified n-tuple, without undefined data processing.

template<typename S>
void CCfits::PHDU::write ( long first,
long nElements,
const std::valarray< S > & data,
S * nullValue )
 

write array to image starting with a specified pixel and allowing undefined data to be processed.

parameters after the first are as for version with n-tuple specifying first element. these two version are equivalent, except that it is possible for the first pixel number to exceed the range of 32-bit integers, which is how long datatype is commonly implemented.

template<typename S>
void CCfits::PHDU::write ( const std::vector< long > & first,
long nElements,
const std::valarray< S > & data,
S * nullValue )
 

Write a set of pixels to an image extension with the first pixel specified by an n-tuple, processing undefined data.

All the overloaded versions of PHDU::write perform operations on *this if it is an image and throw a WrongExtensionType exception if not. Where appropriate, alternate versions allow undefined data to be processed

Parameters:
first   an n-tuple of dimension equal to the image dimension specifying the first pixel in the range to be written
nElements   number of pixels to be written
data   array of data to be written
pointer   to null value (data with this value written as undefined; needs the BLANK keyword to have been specified).

double CCfits::PHDU::zero ( ) const [virtual]
 

return the BZERO keyword value.

Reimplemented from CCfits::HDU.

void CCfits::PHDU::zero ( double value ) [virtual]
 

Private: called by ctor.

Reimplemented from CCfits::HDU.


The documentation for this class was generated from the following files:
Generated at Fri Apr 11 16:05:12 2003 for CCfits by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001