Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Arroyo::pixel_array< T > Class Template Reference

#include <pixel_array.h>

Inheritance diagram for Arroyo::pixel_array< T >:

Arroyo::arroyo_least_squares_reconstructor< T > Arroyo::pixel_phase_array< T > Arroyo::refractive_atmospheric_layer< T > List of all members.

Public Member Functions

 pixel_array ()
 pixel_array (const pixel_array< T > &pixarr)
template<class U>
 pixel_array (const pixel_array< U > &pixarr, const vector< long > &pixel_limits)
 pixel_array (const vector< long > &in_axes, const T *data=NULL, const float *wts=NULL)
 ~pixel_array ()
pixel_array< T > & operator= (const pixel_array< T > &pixarr)
virtual void read (const iofits &iof)
virtual void write (iofits &iof) const
void write_to_ppm (double min, double max, bool logscale, bool colorbar, colormap *cmap, const char *filename, long min_dimen=-1) const
int total_space () const
bool weights_allocated () const
vector< long > get_axes () const
template<class U>
void copyfrom (const pixel_array< U > &pixarr)
void print_axes (ostream &os) const
data (long n) const
void set_data (long n, T val) const
float wt (long elem) const
void min_and_max (double &min, double &max) const
void min_and_max (double &min, vector< int > &minpixel, double &max, vector< int > &maxpixel) const
void min_and_max (double &min, vector< int > &minpixel, double &max, vector< int > &maxpixel, vector< int > axis_0_limits, vector< int > axis_1_limits) const
void flip_x ()
void flip_y ()
void flip_xy ()
void flip_45 ()
void pad_array (int npad, double value=0)
void clip_array (int nclip)
void shift_by_fft (double dx, double dy)
void rotate_by_fft (double angle, bool window=true)
void rotate_and_shift_by_fft (double dx, double dy, double angle, bool window=true)
void owen_makedon_rotate_and_shift_by_fft (double dx, double dy, double angle)
pixel_array< T > cross_correlate (const pixel_array< T > &pixarr) const
void offset (const pixel_array< T > &pixarr, vector< double > &offsets, long range=-1) const
virtual pixel_array< T > & operator+= (const double &fac)
virtual pixel_array< T > & operator-= (const double &fac)
virtual pixel_array< T > & operator *= (const double &fac)
virtual pixel_array< T > & operator/= (const double &fac)

Static Public Attributes

int verbose_level = 0
 Verbose level.

Protected Member Functions

void set_axes (const vector< long > &in_axes)
void allocate_weights (double wt)
void deallocate_weights ()
double normalize_by_wts ()
void decimate (int nadd)
template<class U>
void flag_zero_wts (const pixel_array< U > &pixarr)
void mask ()
template<class U>
void mask (const pixel_array< U > *pixarr)
 pixel_array (const iofits &iof)

Protected Attributes

vector< long > axes
 axes of underlying array
T * pixeldata
 pointer to the data
float * pixelwts
 pointer to the weights

Friends

template<class U, class V>
pixel_array< U > & operator+= (pixel_array< U > &lhs, const pixel_array< V > &rhs)
template<class U, class V>
pixel_array< U > & operator-= (pixel_array< U > &lhs, const pixel_array< V > &rhs)
template<class U, class V>
pixel_array< U > & operator *= (pixel_array< U > &lhs, const pixel_array< V > &rhs)
template<class U, class V>
pixel_array< U > & operator/= (pixel_array< U > &lhs, const pixel_array< V > &rhs)
bool operator== (const pixel_array< T > &p1, const pixel_array< T > &p2)

Detailed Description

template<class T>
class Arroyo::pixel_array< T >

A class to hold and manipulate rectangular images. Template parameter specifies storage type of data - e.g. double, float, int.


Constructor & Destructor Documentation

template<class T>
Arroyo::pixel_array< T >::pixel_array const iofits iof  )  [protected]
 

Construct from iofits object

template<class T>
Arroyo::pixel_array< T >::pixel_array  ) 
 

Null constructor

template<class T>
Arroyo::pixel_array< T >::pixel_array const pixel_array< T > &  pixarr  ) 
 

Copy constructor template<class U> - there is not yet an operator = for different template types

template<class T>
template<class U>
Arroyo::pixel_array< T >::pixel_array const pixel_array< U > &  pixarr,
const vector< long > &  pixel_limits
 

Construct an instance with pixel limits given by pixel_limits These limits must be contained by pixarr's arrays

The array pixel_limits has 4 elements: xmin, xmax, ymin, ymax

So far this has only been coded for 2d pixel_arrays

template<class T>
Arroyo::pixel_array< T >::pixel_array const vector< long > &  in_axes,
const T *  data = NULL,
const float *  wts = NULL
 

Construct from arrays If wts == NULL, weights will not be allocated If data == NULL && wts == NULL data will be allocated and initialized to zero

template<class T>
Arroyo::pixel_array< T >::~pixel_array  ) 
 

Destructor


Member Function Documentation

template<class T>
void Arroyo::pixel_array< T >::allocate_weights double  wt  )  [protected]
 

Allocate weights. If weights have already been allocated, they are reinitialized to wt If pixeldata == NULL, pixelwts is set to NULL

template<class T>
void Arroyo::pixel_array< T >::clip_array int  nclip  ) 
 

Clip each edge of the array by nclip pixels

template<class T>
template<class U>
void Arroyo::pixel_array< T >::copyfrom const pixel_array< U > &  pixarr  ) 
 

Function to copy pixel array This function performs template conversions through implicit casts.

template<class T>
pixel_array< T > Arroyo::pixel_array< T >::cross_correlate const pixel_array< T > &  pixarr  )  const
 

Function to cross-correlate with another pixel_array Cross correlation performed via fft

template<class T>
T Arroyo::pixel_array< T >::data long  n  )  const [inline]
 

Get nth data element

The data is indexed as n = i*axes[0]+j, where

0 <= i < axes[1]

0 <= j < axes[0]

template<class T>
void Arroyo::pixel_array< T >::deallocate_weights  )  [protected]
 

Deallocate weights

template<class T>
void Arroyo::pixel_array< T >::decimate int  nadd  )  [protected]
 

Function to bin together n amplitudes So far this has only been coded for 2d pixel_arrays

Reimplemented in Arroyo::pixel_phase_array< T >, and Arroyo::pixel_phase_array< precision >.

template<class T>
template<class U>
void Arroyo::pixel_array< T >::flag_zero_wts const pixel_array< U > &  pixarr  )  [protected]
 

Function to flag weights that are zero in arg

template<class T>
void Arroyo::pixel_array< T >::flip_45  ) 
 

Flip data about 45 degree line

template<class T>
void Arroyo::pixel_array< T >::flip_x  ) 
 

Flip data about x axis

template<class T>
void Arroyo::pixel_array< T >::flip_xy  ) 
 

Flip data about x and y axis

template<class T>
void Arroyo::pixel_array< T >::flip_y  ) 
 

Flip data about y axis

template<class T>
vector<long> Arroyo::pixel_array< T >::get_axes void   )  const [inline]
 

Function to set the axes

Reimplemented in Arroyo::refractive_atmospheric_layer< T >, and Arroyo::structure_function.

template<class T>
template<class U>
void Arroyo::pixel_array< T >::mask const pixel_array< U > *  pixarr  )  [protected]
 

Function to apply a mask

template<class T>
void Arroyo::pixel_array< T >::mask  )  [protected]
 

Function to make this pixel_array into a mask of 1s and 0s based on the value of the pixeldata

template<class T>
void Arroyo::pixel_array< T >::min_and_max double &  min,
vector< int > &  minpixel,
double &  max,
vector< int > &  maxpixel,
vector< int >  axis_0_limits,
vector< int >  axis_1_limits
const
 

Find min and max within limits

template<class T>
void Arroyo::pixel_array< T >::min_and_max double &  min,
vector< int > &  minpixel,
double &  max,
vector< int > &  maxpixel
const
 

Find min and max of pixel array

template<class T>
void Arroyo::pixel_array< T >::min_and_max double &  min,
double &  max
const
 

Find min and max of pixel array

template<class T>
double Arroyo::pixel_array< T >::normalize_by_wts  )  [protected]
 

Function to normalize data by weights

template<class T>
void Arroyo::pixel_array< T >::offset const pixel_array< T > &  pixarr,
vector< double > &  offsets,
long  range = -1
const
 

Function to fit the offset between the two pixel arrays. The computation is performed using a shift by fft This function returns the number of pixels you have to shift "this" by in order to optimally align it with "pixarr"

template<class T>
pixel_array< T > & Arroyo::pixel_array< T >::operator *= const double &  fac  )  [virtual]
 

Operator *= for doubles

template<class T>
pixel_array< T > & Arroyo::pixel_array< T >::operator+= const double &  fac  )  [virtual]
 

Operator += for doubles

template<class T>
pixel_array< T > & Arroyo::pixel_array< T >::operator-= const double &  fac  )  [virtual]
 

Operator -= for doubles

template<class T>
pixel_array< T > & Arroyo::pixel_array< T >::operator/= const double &  fac  )  [virtual]
 

Operator /= for doubles

template<class T>
pixel_array< T > & Arroyo::pixel_array< T >::operator= const pixel_array< T > &  pixarr  ) 
 

Operator =

template<class T>
void Arroyo::pixel_array< T >::owen_makedon_rotate_and_shift_by_fft double  dx,
double  dy,
double  angle
 

Implementation of the rotate_and_shift_by_fft function, based on an incomprehensible technical report by owen and makedon.

template<class T>
void Arroyo::pixel_array< T >::pad_array int  npad,
double  value = 0
 

Pad each edge of the array by npad pixels and initialize to the specified value

template<class T>
void Arroyo::pixel_array< T >::print_axes ostream &  os  )  const
 

Function to print the axes

template<class T>
void Arroyo::pixel_array< T >::read const iofits iof  )  [virtual]
 

Function to read data from iofits

Reimplemented in Arroyo::refractive_atmospheric_layer< T >, and Arroyo::structure_function.

template<class T>
void Arroyo::pixel_array< T >::rotate_and_shift_by_fft double  dx,
double  dy,
double  angle,
bool  window = true
 

Rotate pixel_array by an angle and shift by dx and dy

The resulting pixel array may be larger than the original, so as to be able to include the corners that have rotated outside the original array bounds.

This function does not yet support non-zero shifts

template<class T>
void Arroyo::pixel_array< T >::rotate_by_fft double  angle,
bool  window = true
 

Rotate pixel_array by an angle

The resulting pixel array may be larger than the original, so as to be able to include the corners that have rotated outside the original array bounds.

Reimplemented in Arroyo::refractive_atmospheric_layer< T >.

template<class T>
void Arroyo::pixel_array< T >::set_axes const vector< long > &  in_axes  )  [protected]
 

Reallocate memory for this pixel_array pixeldata is allocated with in_axes elements and initialized to zero if pixelwts is null it remains so, otherwise it is allocated and initialized to zero

Reimplemented in Arroyo::refractive_atmospheric_layer< T >, and Arroyo::structure_function.

template<class T>
void Arroyo::pixel_array< T >::set_data long  n,
val
const [inline]
 

Set nth data element to val

The data is indexed as n = i*axes[0]+j, where

0 <= i < axes[1]

0 <= j < axes[0]

template<class T>
void Arroyo::pixel_array< T >::shift_by_fft double  dx,
double  dy
 

Shift a pixel_array by dx and dy

template<class T>
int Arroyo::pixel_array< T >::total_space  )  const [inline]
 

Function to compute total number of elements in array

template<class T>
bool Arroyo::pixel_array< T >::weights_allocated  )  const
 

Function to report whether weights are allocated

template<class T>
void Arroyo::pixel_array< T >::write iofits iof  )  const [virtual]
 

Function to write data to iofits

Reimplemented in Arroyo::refractive_atmospheric_layer< T >, and Arroyo::structure_function.

template<class T>
void Arroyo::pixel_array< T >::write_to_ppm double  min,
double  max,
bool  logscale,
bool  colorbar,
colormap cmap,
const char *  filename,
long  min_dimen = -1
const
 

Function to write data to a ppm file

template<class T>
float Arroyo::pixel_array< T >::wt long  elem  )  const [inline]
 

Function to return weight element


Friends And Related Function Documentation

template<class T>
template<class U, class V>
pixel_array<U>& operator *= pixel_array< U > &  lhs,
const pixel_array< V > &  rhs
[friend]
 

Friend declaration for operator *= for pixel_arrays

template<class T>
template<class U, class V>
pixel_array<U>& operator+= pixel_array< U > &  lhs,
const pixel_array< V > &  rhs
[friend]
 

Friend declaration for operator += for pixel_arrays

template<class T>
template<class U, class V>
pixel_array<U>& operator-= pixel_array< U > &  lhs,
const pixel_array< V > &  rhs
[friend]
 

Friend declaration for operator -= for pixel_arrays

template<class T>
template<class U, class V>
pixel_array<U>& operator/= pixel_array< U > &  lhs,
const pixel_array< V > &  rhs
[friend]
 

Friend declaration for operator /= for pixel_arrays

template<class T>
bool operator== const pixel_array< T > &  p1,
const pixel_array< T > &  p2
[friend]
 

Friend operator == for pixel_array


Member Data Documentation

template<class T>
vector<long> Arroyo::pixel_array< T >::axes [protected]
 

axes of underlying array

template<class T>
T* Arroyo::pixel_array< T >::pixeldata [protected]
 

pointer to the data

template<class T>
float* Arroyo::pixel_array< T >::pixelwts [protected]
 

pointer to the weights

template<class T>
int Arroyo::pixel_array< T >::verbose_level = 0 [static]
 

Verbose level.

Reimplemented in Arroyo::Shack_Hartmann_centroids.


The documentation for this class was generated from the following file:
Generated on Thu Nov 29 17:16:35 2007 for arroyo by  doxygen 1.3.9.1