LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Attributes | List of all members
lsst::ip::isr::LookupTableReplace< ImageT > Class Template Reference

#include <isr.h>

Public Types

typedef
lsst::afw::image::MaskedImage
< ImageT >::x_iterator 
x_iterator
 
typedef
lsst::afw::image::MaskedImage
< ImageT >::Pixel 
PixelT
 

Public Member Functions

 LookupTableReplace (std::vector< double > table)
 
virtual ~LookupTableReplace ()
 
void apply (lsst::afw::image::MaskedImage< ImageT > &image, float gain=1.0) const
 
std::vector< double > getTable () const
 

Private Attributes

std::vector< double > _table
 
int _max
 

Detailed Description

template<typename ImageT>
class lsst::ip::isr::LookupTableReplace< ImageT >

Linearization lookup table with replacement

Definition at line 144 of file isr.h.

Member Typedef Documentation

template<typename ImageT >
typedef lsst::afw::image::MaskedImage<ImageT>::Pixel lsst::ip::isr::LookupTableReplace< ImageT >::PixelT

Definition at line 147 of file isr.h.

template<typename ImageT >
typedef lsst::afw::image::MaskedImage<ImageT>::x_iterator lsst::ip::isr::LookupTableReplace< ImageT >::x_iterator

Definition at line 146 of file isr.h.

Constructor & Destructor Documentation

template<typename ImageT >
lsst::ip::isr::LookupTableReplace< ImageT >::LookupTableReplace ( std::vector< double >  table)
inline

Definition at line 149 of file isr.h.

149  :
150  _table(table), _max(table.size()) {};
std::vector< double > _table
Definition: isr.h:158
template<typename ImageT >
virtual lsst::ip::isr::LookupTableReplace< ImageT >::~LookupTableReplace ( )
inlinevirtual

Definition at line 151 of file isr.h.

151 {};

Member Function Documentation

template<typename ImageT >
void lsst::ip::isr::LookupTableReplace< ImageT >::apply ( lsst::afw::image::MaskedImage< ImageT > &  image,
float  gain = 1.0 
) const

Definition at line 35 of file Isr.cc.

35  {
36  double igain = 1.0 / gain;
37  int nPixTooHigh = 0;
38  int nPixTooLow = 0;
39  for (int y = 0; y != image.getHeight(); ++y) {
40  for (x_iterator ptr = image.row_begin(y), end = image.row_end(y); ptr != end; ++ptr) {
41  int ind = static_cast<int>(ptr.image() + 0.5); // Rounded pixel value
42  if (ind < 0) {
43  ind = 0;
44  ++nPixTooLow;
45  } else if (ind >= _max) {
46  ind = _max - 1;
47  ++nPixTooHigh;
48  }
49  PixelT p = PixelT(_table[ind], (*ptr).mask(), _table[ind] * igain);
50  *ptr = p;
51  }
52  }
53  if ((nPixTooHigh > 0) || (nPixTooLow > 0)) {
54  // log message
55  pex::logging::TTrace<1>("lsst.ip.isr.LookupTableReplace.apply",
56  "Data truncated; %d pixels were < 0; %d pixels were >= %d", nPixTooLow, nPixTooHigh, _max);
57  }
58 }
int y
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Definition: MaskedImage.cc:742
std::vector< double > _table
Definition: isr.h:158
int getHeight() const
Return the number of rows in the image.
Definition: MaskedImage.h:903
x_iterator row_end(int y) const
Return an x_iterator to the end of the image.
Definition: MaskedImage.cc:752
lsst::afw::image::MaskedImage< ImageT >::Pixel PixelT
Definition: isr.h:147
lsst::afw::image::MaskedImage< ImageT >::x_iterator x_iterator
Definition: isr.h:146
template<typename ImageT >
std::vector<double> lsst::ip::isr::LookupTableReplace< ImageT >::getTable ( ) const
inline

Definition at line 156 of file isr.h.

156 { return _table; }
std::vector< double > _table
Definition: isr.h:158

Member Data Documentation

template<typename ImageT >
int lsst::ip::isr::LookupTableReplace< ImageT >::_max
private

Definition at line 159 of file isr.h.

template<typename ImageT >
std::vector<double> lsst::ip::isr::LookupTableReplace< ImageT >::_table
private

Definition at line 158 of file isr.h.


The documentation for this class was generated from the following files: