USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::Pixel Class Reference

Store and/or manipulate pixel values. More...

#include <Pixel.h>

Inheritance diagram for Isis::Pixel:
Inheritance graph
Collaboration diagram for Isis::Pixel:
Collaboration graph

Public Member Functions

 Pixel ()
 Constructs an empty Pixel.
 Pixel (int sample, int line, int band, double DN)
 Constructs a Pixel given a line, sample, band, and DN.
 Pixel (const Pixel &pixel)
 Constructs a Pixel, given a Pixel.
virtual ~Pixel ()
 Default destructor.
Pixeloperator= (const Pixel &other)
 Copy assignment operator.
int line () const
 Returns the line coordinate of the Pixel.
int sample () const
 Returns the sample coordinate of the Pixel.
int band () const
 Returns the band coordinate of the Pixel.
double DN () const
 Returns the DN of the Pixel.
unsigned char To8Bit ()
 Converts internal pixel value to an unsigned char pixel with special pixel translations.
short int To16Bit ()
 Converts internal pixel value to a short int pixel with special pixel translations.
float To32Bit ()
 Converts internal pixel value to float with special pixel translations.
double ToDouble ()
 Converts stored pixel value to a double.
float ToFloat ()
 Converts internal pixel value to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)
std::string ToString ()
 Returns the name of the pixel type as a string.
bool IsSpecial ()
 Returns true if the input pixel is special.
bool IsValid ()
 Returns true if the input pixel is valid.
bool IsNull ()
 Returns true if the input pixel is null.
bool IsHigh ()
 Returns true if the input pixel is one of the high saturation types.
bool IsLow ()
 Returns true if the input pixel is one of the low saturation types.
bool IsHrs ()
 Returns true if the input pixel is high representation saturation.
bool IsHis ()
 Returns true if the input pixel is high instrument saturation.
bool IsLis ()
 Returns true if the input pixel is low instrument saturation.
bool IsLrs ()
 Returns true if the input pixel is low representation saturation.

Static Public Member Functions

static unsigned char To8Bit (const double d)
 Converts double pixels to unsigned char pixels with special pixel translations.
static short int To16Bit (const double d)
 Converts double pixels to short int pixels with special pixel translations.
static float To32Bit (const double d)
 Converts double pixels to float pixels with special pixel translations.
static double ToDouble (const unsigned char t)
 Converts unsigned char pixels to double pixels with special pixel translations.
static double ToDouble (const short int t)
 Converts short int pixels to double pixels with special pixel translations.
static double ToDouble (const float t)
 Converts float pixels to double pixels with special pixel translations.
static float ToFloat (const unsigned char d)
 Converts unsigned char to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)
static float ToFloat (const short int d)
 Converts short int to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)
static float ToFloat (const double d)
 Converts double to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)
static std::string ToString (double d)
 Takes a double pixel value and returns the name of the pixel type as a string.
static bool IsSpecial (const double d)
 Returns true if the input pixel is special.
static bool IsSpecial (const float f)
 Returns true if the input pixel is special.
static bool IsValid (const double d)
 Returns true if the input pixel is valid.
static bool IsNull (const double d)
 Returns true if the input pixel is null.
static bool IsHigh (const double d)
 Returns true if the input pixel is one of the high saturation types.
static bool IsLow (const double d)
 Returns true if the input pixel is one of the low saturation types.
static bool IsHrs (const double d)
 Returns true if the input pixel is high representation saturation.
static bool IsHis (const double d)
 Returns true if the input pixel is high instrument saturation.
static bool IsLis (const double d)
 Returns true if the input pixel is low instrument saturation.
static bool IsLrs (const double d)
 Returns true if the input pixel is low representation saturation.

Private Attributes

int m_line
 line coordinate of pixel
int m_sample
 sample coordinate of pixel
int m_band
 band coordinate of pixel
double m_DN
 DN of pixel.

Detailed Description

Store and/or manipulate pixel values.

This class can store pixel information and also contains utility methods for testing and modifying pixel and special pixel values that can be used without instanteating the class.

Author
2002-04-11 Kris Becker
History:
2003-02-11 Jeff Anderson - Wrote unitTest and documentation
History:
2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...
History:
2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen documentation
History:
2005-05-18 Jeff Anderson - Changed long to int for 64-bit port
History:
2006-06-21 Elizabeth Miller - Copied SpecialPixel methods into into the Pixel class for easy refactoring later and added several conversion methods
History:
2009-02-03 Travis Addair - Modified documentation for clarity
History:
2015-05-11 Kristin Berry - Added ability to store pixel information/made class instantiatable and updated funtionality to use this information when available.
History:
2015-08-05 Kristin Berry - Added empty constructor, copy constructor, copy assignement operator, and virutal destructor. Also updated to comply with Isiscoding standards.

Definition at line 62 of file Pixel.h.

Constructor & Destructor Documentation

Isis::Pixel::Pixel ( )

Constructs an empty Pixel.

Author
2015-08-05 Kristin Berry

Definition at line 34 of file Pixel.cpp.

References Isis::Null.

Isis::Pixel::Pixel ( int  sample,
int  line,
int  band,
double  DN 
)

Constructs a Pixel given a line, sample, band, and DN.

Author
2015-05-08 Kristin Berry
Parameters
lineline coordinate
samplesample coordinate
bandband coordinate
DNdata value for the pixel

Definition at line 52 of file Pixel.cpp.

Isis::Pixel::Pixel ( const Pixel pixel)

Constructs a Pixel, given a Pixel.

Author
2015-08-05 Kristin Berry
Parameters
pixelPixel to copy

Definition at line 67 of file Pixel.cpp.

References band(), DN(), line(), and sample().

Isis::Pixel::~Pixel ( )
virtual

Default destructor.

Definition at line 86 of file Pixel.cpp.

Member Function Documentation

int Isis::Pixel::band ( ) const

Returns the band coordinate of the Pixel.

Definition at line 102 of file Pixel.cpp.

Referenced by operator=(), and Pixel().

double Isis::Pixel::DN ( ) const

Returns the DN of the Pixel.

Definition at line 108 of file Pixel.cpp.

Referenced by operator=(), and Pixel().

static bool Isis::Pixel::IsHigh ( const double  d)
inlinestatic

Returns true if the input pixel is one of the high saturation types.

Parameters
dPixel value to test
Returns
bool

Definition at line 180 of file Pixel.h.

bool Isis::Pixel::IsHigh ( )
inline

Returns true if the input pixel is one of the high saturation types.

Returns
bool

Definition at line 189 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsHis ( const double  d)
inlinestatic

Returns true if the input pixel is high instrument saturation.

Parameters
dPixel value to test
Returns
bool

Definition at line 242 of file Pixel.h.

bool Isis::Pixel::IsHis ( )
inline

Returns true if the input pixel is high instrument saturation.

Returns
bool

Definition at line 251 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsHrs ( const double  d)
inlinestatic

Returns true if the input pixel is high representation saturation.

Parameters
dPixel value to test
Returns
bool

Definition at line 222 of file Pixel.h.

bool Isis::Pixel::IsHrs ( )
inline

Returns true if the input pixel is high representation saturation.

Returns
bool

Definition at line 231 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsLis ( const double  d)
inlinestatic

Returns true if the input pixel is low instrument saturation.

Parameters
dPixel value to test
Returns
bool

Definition at line 262 of file Pixel.h.

bool Isis::Pixel::IsLis ( )
inline

Returns true if the input pixel is low instrument saturation.

Returns
bool

Definition at line 271 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsLow ( const double  d)
inlinestatic

Returns true if the input pixel is one of the low saturation types.

Parameters
dPixel value to test
Returns
bool

Definition at line 200 of file Pixel.h.

bool Isis::Pixel::IsLow ( )
inline

Returns true if the input pixel is one of the low saturation types.

Parameters
dPixel value to test
Returns
bool

Definition at line 211 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsLrs ( const double  d)
inlinestatic

Returns true if the input pixel is low representation saturation.

Parameters
dPixel value to test
Returns
bool

Definition at line 282 of file Pixel.h.

bool Isis::Pixel::IsLrs ( )
inline

Returns true if the input pixel is low representation saturation.

Returns
bool

Definition at line 291 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsNull ( const double  d)
inlinestatic

Returns true if the input pixel is null.

Parameters
dPixel value to test
Returns
bool

Definition at line 160 of file Pixel.h.

bool Isis::Pixel::IsNull ( )
inline

Returns true if the input pixel is null.

Returns
bool

Definition at line 169 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsSpecial ( const double  d)
inlinestatic

Returns true if the input pixel is special.

Not special implies it is valid to use in computations.

Parameters
dPixel value to test
Returns
bool

Definition at line 104 of file Pixel.h.

bool Isis::Pixel::IsSpecial ( )
inline

Returns true if the input pixel is special.

Not special implies it is valid to use in computations.

Returns
bool

Definition at line 114 of file Pixel.h.

References m_DN.

static bool Isis::Pixel::IsSpecial ( const float  f)
inlinestatic

Returns true if the input pixel is special.

Not special implies it is valid to use in computations. This method applies to a 4-byte floating point rather than an 8-byte double.

Parameters
fPixel value to test
Returns
bool

Definition at line 127 of file Pixel.h.

static bool Isis::Pixel::IsValid ( const double  d)
inlinestatic

Returns true if the input pixel is valid.

Valid implies the pixel is neither hrs, lrs, his, lis, nor null.

Parameters
dPixel value to test
Returns
bool

Definition at line 139 of file Pixel.h.

bool Isis::Pixel::IsValid ( )
inline

Returns true if the input pixel is valid.

Valid implies the pixel is neither hrs, lrs, his, lis, nor null.

Returns
bool

Definition at line 149 of file Pixel.h.

References m_DN.

int Isis::Pixel::line ( ) const

Returns the line coordinate of the Pixel.

Definition at line 90 of file Pixel.cpp.

Referenced by operator=(), and Pixel().

Pixel & Isis::Pixel::operator= ( const Pixel other)

Copy assignment operator.

Definition at line 76 of file Pixel.cpp.

References band(), DN(), line(), and sample().

int Isis::Pixel::sample ( ) const

Returns the sample coordinate of the Pixel.

Definition at line 96 of file Pixel.cpp.

Referenced by operator=(), and Pixel().

short int Isis::Pixel::To16Bit ( const double  d)
static

Converts double pixels to short int pixels with special pixel translations.

Parameters
dDouble pixel value to be converted to a double
Returns
short int The short int pixel value

Definition at line 162 of file Pixel.cpp.

short int Isis::Pixel::To16Bit ( )

Converts internal pixel value to a short int pixel with special pixel translations.

Returns
short int The short int pixel value

Definition at line 199 of file Pixel.cpp.

float Isis::Pixel::To32Bit ( const double  d)
static

Converts double pixels to float pixels with special pixel translations.

Parameters
dDouble pixel value to be converted to a double
Returns
float The float pixel value

Definition at line 211 of file Pixel.cpp.

float Isis::Pixel::To32Bit ( )

Converts internal pixel value to float with special pixel translations.

Returns
float The float pixel value

Definition at line 230 of file Pixel.cpp.

unsigned char Isis::Pixel::To8Bit ( const double  d)
static

Converts double pixels to unsigned char pixels with special pixel translations.

Parameters
dDouble pixel value to be converted to a double
Returns
unsigned char The unsigned char pixel value

Definition at line 121 of file Pixel.cpp.

unsigned char Isis::Pixel::To8Bit ( )

Converts internal pixel value to an unsigned char pixel with special pixel translations.

Returns
unsigned char The unsigned char pixel value

Definition at line 150 of file Pixel.cpp.

double Isis::Pixel::ToDouble ( const unsigned char  d)
static

Converts unsigned char pixels to double pixels with special pixel translations.

Parameters
dUnsigned char pixel value to be converted to a double
Returns
double The double pixel value

Definition at line 243 of file Pixel.cpp.

double Isis::Pixel::ToDouble ( const short int  d)
static

Converts short int pixels to double pixels with special pixel translations.

Parameters
dShort int pixel value to be converted to a double
Returns
double The double pixel value

Definition at line 264 of file Pixel.cpp.

double Isis::Pixel::ToDouble ( const float  d)
static

Converts float pixels to double pixels with special pixel translations.

Parameters
dFloat pixel value to be converted to a double
Returns
double The double pixel value

Definition at line 284 of file Pixel.cpp.

double Isis::Pixel::ToDouble ( )

Converts stored pixel value to a double.

Returns
double The double pixel value

Definition at line 303 of file Pixel.cpp.

float Isis::Pixel::ToFloat ( const unsigned char  t)
static

Converts unsigned char to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)

Parameters
tUnsigned char pixel value to be converted to a float
Returns
float The float pixel value

Definition at line 318 of file Pixel.cpp.

float Isis::Pixel::ToFloat ( const short int  t)
static

Converts short int to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)

Parameters
tShort int pixel value to be converted to a float
Returns
float The float pixel value

Definition at line 339 of file Pixel.cpp.

float Isis::Pixel::ToFloat ( const double  t)
static

Converts double to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)

Parameters
tDouble pixel value to be converted to a float
Returns
float The float pixel value

Definition at line 360 of file Pixel.cpp.

float Isis::Pixel::ToFloat ( )

Converts internal pixel value to float with pixel translations and care for overflows (underflows are assumed to cast to 0!)

Returns
float The float pixel value

Definition at line 380 of file Pixel.cpp.

string Isis::Pixel::ToString ( double  d)
static

Takes a double pixel value and returns the name of the pixel type as a string.

Parameters
dPixel value
Returns
string The name of the pixel type

Definition at line 392 of file Pixel.cpp.

References Isis::IsSpecial().

string Isis::Pixel::ToString ( )

Returns the name of the pixel type as a string.

Returns
string The name of the pixel type

Definition at line 411 of file Pixel.cpp.

Member Data Documentation

int Isis::Pixel::m_band
private

band coordinate of pixel

Definition at line 303 of file Pixel.h.

double Isis::Pixel::m_DN
private

DN of pixel.

Definition at line 306 of file Pixel.h.

Referenced by IsHigh(), IsHis(), IsHrs(), IsLis(), IsLow(), IsLrs(), IsNull(), IsSpecial(), and IsValid().

int Isis::Pixel::m_line
private

line coordinate of pixel

Definition at line 297 of file Pixel.h.

int Isis::Pixel::m_sample
private

sample coordinate of pixel

Definition at line 300 of file Pixel.h.


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