geirs2Panic  Richard J. Mathar
Fits header keyword batch editor
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Public Attributes | List of all members
PixImage Class Reference

A rectangular 2-dimensional array of pixels with individual values. More...

#include <PixImage.h>

Collaboration diagram for PixImage:
Collaboration graph

Public Member Functions

 PixImage (const int ncols, const int nrows)
 Create an empty image with all values set to zero. More...
 
 PixImage ()
 Create an image of zero size (without pixels). More...
 
 PixImage (FITS &fit, int slic=0)
 Read the pixel values from a slice of a FITS cube. More...
 
 ~PixImage ()
 
 operator Bbox2D () const
 Generate the bounding box of this pixel array. More...
 
FITS * toFits (const char *foutname) const
 Generate a FITS file with this image as the primary HDU. More...
 
PixImageapply (const RotTrans2D &rt) const
 
double at (const int row, const int col) const
 Read/get the value of the intensity at a specific pixel. More...
 
int idx (const int row, const int col) const
 Obtain the flat index of a (x,y) pair of indices. More...
 
Square2D hull (const RotTrans2D &rt, const int row, const int col, int idxReg[2][2], const Bbox2D &bbrot) const
 

Public Attributes

valarray< double > vals
 The values (intensities) within the pixels. More...
 
int rows
 Number of rows. More...
 
int cols
 Number of columns. More...
 

Detailed Description

A rectangular 2-dimensional array of pixels with individual values.

Since
2013-07-04
Author
Richard J. Mathar

Constructor & Destructor Documentation

PixImage::PixImage ( const int  ncols,
const int  nrows 
)

Create an empty image with all values set to zero.


Parameters
[in]ncolsThe number of columns in the image. The same as the number of pixels along x.
[out]nrowsThe number of rows in the image. The same as the number of pixels along y.
PixImage::PixImage ( )

Create an image of zero size (without pixels).


PixImage::PixImage ( FITS &  fit,
int  slic = 0 
)

Read the pixel values from a slice of a FITS cube.


Parameters
fitThe FITS object with at least one image plane in the Primary HDU.
slicThe 0-based index into the FITS cube.
PixImage::~PixImage ( )

Destructor. Release the allocated memory areas.

Member Function Documentation

PixImage::operator Bbox2D ( ) const

Generate the bounding box of this pixel array.


Returns
The quadrangular bounding box.
FITS * PixImage::toFits ( const char *  foutname) const

Generate a FITS file with this image as the primary HDU.


Parameters
[in]foutname
Returns
The FITS file with a dummy header.
Since
2013-07-06
PixImage * PixImage::apply ( const RotTrans2D rt) const

Generate a quadrangle of pixels by rotation and translation of a indexed pixel.

Todo:
Carry over NaN pixel values (BLANK) to the result.
Since
2013-07-06
double PixImage::at ( const int  row,
const int  col 
) const

Read/get the value of the intensity at a specific pixel.


Parameters
[in]row
[in]col
Returns
The current contents at that pixel
int PixImage::idx ( const int  row,
const int  col 
) const

Obtain the flat index of a (x,y) pair of indices.


Parameters
[in]row
[in]col
Returns
The 0-based index col+(number of columns)*row.
Since
2013-07-06
Square2D PixImage::hull ( const RotTrans2D rt,
const int  row,
const int  col,
int  idxReg[2][2],
const Bbox2D bbrot 
) const

Generate a hull (an encompassing integer rectangle) of the image of a pixel

Parameters
[in]rtThe rotation-translation to be applied to the pixel.
[in]rowThe row index of the pixel.
[in]colThe column index of the pixel.
[in]bbrotThe boundary box of the rotated entire original array.
[out]idxRegThe index region of the image of the pixel under the operation. idxReg[0][] refers to the lower left corner, idxReg[1][] to the upper right. idxReg[][0] refers to the x coordinates, idxReg[][1] to the y coordinates. idx[1][] is non-incluse (as usual in C/C++/Java): The pixel (row,col) will cover parts of idxReg[0][0]..idxReg[0][1]-1 along x and idxReg[1][0]..idxRe[1][1]-1 along y after rotation.
Returns
The rotated pixel in the original coordinate system.

Member Data Documentation

valarray<double> PixImage::vals

The values (intensities) within the pixels.

int PixImage::rows

Number of rows.

int PixImage::cols

Number of columns.