LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
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 }
x_iterator row_begin(int y) const
Return an x_iterator to the start of the image.
Definition: MaskedImage.cc:693
int y
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:703
lsst::afw::image::MaskedImage< ImageT >::Pixel PixelT
Definition: isr.h:147
lsst::afw::image::MaskedImage< ImageT >::x_iterator x_iterator
Definition: isr.h:146
std::vector< double > _table
Definition: isr.h:158
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: