WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
WXP::Image Class Reference

This class defines an image. More...

#include "../include/Image.h"

Public Types

enum  Query { ALL , INQ }
 
enum  Type { UNK , IMG , GINI , AREA }
 
enum  ByteOrder { LSB , MSB }
 
enum  ColorType { TRUECOL , INDEX , VALUE }
 

Public Member Functions

int initClass ()
 
int init ()
 
 Image ()
 
 Image (const Image &image)
 
 ~Image ()
 
int copy (Image &image)
 
int copyInfo (Image &image)
 
int copyData (Image &image)
 
Image operator= (const Image &image)
 
int set (int rwidth, int rheight, int rdepth)
 
int set (Domain &rdomain, int rdepth)
 
int set (DomainVal &rdv, int rdepth)
 
int allocData ()
 
int clearData ()
 
bool validData ()
 
int allocColors (int num)
 
int hasColors ()
 
int setSource (int val)
 
int setType (int val)
 
int setDate (int secs)
 
int setDate (DateVal &dv)
 
int setDate (Date &d)
 
int getDate (Date &rdate)
 
Date getDate ()
 
int setDatim (const char *str)
 
int setDatim (String &str)
 
char * getDatim ()
 
int setInfo (const char *str)
 
int setInfo (String &str)
 
char * getInfo ()
 
int setDomain (DomainVal &val)
 
int setDomain (Domain &dom)
 
int getDomainProj ()
 
Domain getDomain ()
 
int getDomain (Domain &dom)
 
DomainVal getDomainVal ()
 
float getPLat ()
 
float getPLon ()
 
int getWidth ()
 
int getHeight ()
 
int getDepth ()
 
int getBytes ()
 
int getBytesLine ()
 
int getColorType ()
 
int getNumColors ()
 
float getRed (int ind)
 
float getGrn (int ind)
 
float getBlu (int ind)
 
int setWidth (int val)
 
int setHeight (int val)
 
int setDepth (int val)
 
int setBitsPixel (int val)
 
int setBytesLine (int val)
 
int setBytesLine ()
 
int setColorType (int val)
 
int setByteOrder (int val)
 
int setRedMask (unsigned long)
 
unsigned int getRedMask ()
 
int setGrnMask (unsigned long)
 
unsigned int getGrnMask ()
 
int setBluMask (unsigned long)
 
unsigned int getBluMask ()
 
int setRed (int ind, float val)
 
int setGrn (int ind, float val)
 
int setBlu (int ind, float val)
 
int setColor (int ind, float r, float g, float b)
 
int setColor (int ind, RGB &rgb)
 
int setRGB (int ind, RGB &rgb)
 
int getRGB (int ind, RGB &rgb)
 
int setTransColor (int clr)
 
bool hasTransColor ()
 
int getTransColor ()
 
int setColorVal (int ind, int val)
 
int getColorVal (int ind)
 
int setPixAve (bool val)
 
int setCutBase (int val)
 
int setCutoff (int ind, int val)
 
int setCutoff (char *str)
 
bool hasCutoff ()
 
int getCutBase ()
 
int getCutoff (int i)
 
int getNumCut ()
 
int print ()
 
int printInt ()
 
int printValues ()
 
int printColors ()
 
int printHist ()
 
int printData (EarthPoint &ept)
 
int getPixel (int x, int y)
 
int getVal (int x, int y)
 
bool isPixelTrans (int x, int y)
 
int getRGB (int x, int y, RGB &rgb)
 
int getRow (int row, unsigned char *odata)
 
const unsigned char * getData ()
 
int getPixel (float x, float y)
 
int getPixel (GridPoint gpt)
 
int getPixel (EarthPoint ept)
 
int getPixel (Point pt)
 
int allocValues ()
 
bool hasValues ()
 
int setValue (int ind, float val)
 
int setValues (FloatArray &array)
 
float getValue (int ind)
 
int getIndex (float val)
 
float getValue (int x, int y)
 
float getValue (float x, float y)
 
float getValue (Point &pt)
 
float getValue (GridPoint &gpt)
 
float getValue (EarthPoint &ept)
 
int getVal (EarthPoint &ept)
 
int setPixel (int x, int y, int val)
 
int setPixel (int val)
 
int setPixel (GridPoint gpt, int val)
 
int setValue (int x, int y, float val)
 
Rect getLimits ()
 
int getProj ()
 
int tran (EarthPoint ept, Point &pt)
 
int tran (Point pt, EarthPoint &ept)
 
int tran (GridPoint gpt, Point &pt)
 
int tran (Point pt, GridPoint &gpt)
 
int tran (EarthPoint ept, GridPoint &gpt)
 
int tran (GridPoint gpt, EarthPoint &ept)
 
float getDx ()
 

Static Public Member Functions

static int copyInfo (Image &image1, const Image &image2)
 
static int copyData (Image &image1, const Image &image2)
 
static int copy (Image &image1, const Image &image2)
 

Friends

class ImageMath
 

Detailed Description

This class defines an image.

Author
Dan Vietor

Constructor & Destructor Documentation

◆ Image() [1/2]

Image::Image ( )

Constructor. Initializes class values

References init().

◆ Image() [2/2]

Image::Image ( const Image image)

Copy constructor for the image class

Parameters
imageImage class to copy from

◆ ~Image()

Image::~Image ( )

Destructor. Frees allocated data

Member Function Documentation

◆ allocColors()

int Image::allocColors ( int  num)

Allocates the color table for the image

Parameters
numNumber of colors in color table

Referenced by WXP::ImageTool::addColor(), WXP::GifFile::read(), WXP::LZWComp::read(), WXP::PngFile::read(), WXP::ImageMath::toGray(), WXP::ImageMath::toIndex(), and WXP::ImageMath::toIndex().

◆ allocData()

int Image::allocData ( )

◆ clearData()

int Image::clearData ( )

Resets all values back to 0

◆ copy()

int Image::copy ( Image image1,
const Image image2 
)
static

Copies one image to another allocating data where appropriate

Parameters
image1Image to copy to
image2Image to copy from

◆ getDx()

float Image::getDx ( )

Gets the X grid/pixel spacing of the image

Returns
X grid/pixel spacing of image

References WXP::Domain::getDx().

Referenced by WXP::NidsImage::addSite(), and WXP::NidsImage::setImage().

◆ getLimits()

Rect Image::getLimits ( )

Gets the domain limits (domain space) of the image

Returns
Rect class with the domain limits

References WXP::Domain::getLimits().

Referenced by WXP::ImageMath::merge(), WXP::ImageMath::remap(), and WXP::ImageMath::scale().

◆ getPixel() [1/3]

int Image::getPixel ( float  x,
float  y 
)

Gets the pixel value at a location in the image. Will interpolate between pixel locations.

Parameters
xThe X location
yThe Y location
Returns
Pixel value

References hasColors().

◆ getPixel() [2/3]

int Image::getPixel ( GridPoint  gpt)

Gets the pixel value at a location in the image. Will interpolate between pixel locations.

Parameters
gptGridPoint location
Returns
Pixel value

References getPixel().

◆ getPixel() [3/3]

int Image::getPixel ( int  x,
int  y 
)

◆ getRGB()

int Image::getRGB ( int  x,
int  y,
RGB rgb 
)

Gets the RGB values at a specific location

Parameters
xThe X location
yThe Y location
Return values
rgbThe output RGB class

References WXP::ImageColor::b, WXP::RGB::blu, WXP::ImageColor::g, getVal(), WXP::RGB::grn, WXP::ImageColor::r, and WXP::RGB::red.

◆ getRow()

int Image::getRow ( int  row,
unsigned char *  odata 
)

Gets a row of pixel data from the image

Parameters
rowRow of image to get data from
Return values
odataBuffer to put data into (preallocated)
Returns
Number of bytes transfered

Referenced by WXP::PngFile::write().

◆ getVal()

int Image::getVal ( int  x,
int  y 
)

Gets the raw pixel value at a specific location (integral, exact location)

Parameters
xThe X location
yThe Y location

Referenced by WXP::NidsImage::applyMask(), WXP::ImageMath::compressColor(), WXP::MdrPlot::draw(), getRGB(), WXP::ImageMath::toTrueColor(), WXP::GifFile::write(), and WXP::LZWComp::write().

◆ hasColors()

int WXP::Image::hasColors ( )
inline

Returns if image has colormap with it

Referenced by WXP::ImageTool::addColor(), and getPixel().

◆ init()

int Image::init ( )

◆ operator=()

Image Image::operator= ( const Image image)

Assignment operator. Used to overload copying

Parameters
stringsString class to copy from

◆ print()

int Image::print ( )

Prints image values to standard output

References WXP::Const::MISS, WXP::Date::print(), and WXP::Domain::print().

Referenced by WXP::RcmPlot::draw().

◆ set() [1/3]

int Image::set ( Domain rdomain,
int  rdepth 
)

Sets basic image parameters

Parameters
rdomainDomain of image (sets size from nx, ny domain parameters)
rdepthBit depth of image

References WXP::Domain::get(), WXP::DomainVal::nx, and WXP::DomainVal::ny.

◆ set() [2/3]

int Image::set ( DomainVal rdv,
int  rdepth 
)

Sets basic image parameters

Parameters
rdvDomain of image (sets size from nx, ny domain parameters)
rdepthBit depth of image

References WXP::Domain::set(), and set().

◆ set() [3/3]

int Image::set ( int  rwidth,
int  rheight,
int  rdepth 
)

Sets basic image parameters

Parameters
rwidthWidth of image
rheightHeight of image
rdepthBit depth of image

Referenced by WXP::NidsImage::addSite(), WXP::MdrImage::addSite(), WXP::KavradFile::read(), WXP::NowradFile::read(), WXP::ImgWxpFile::readHeader(), set(), and WXP::NidsImage::setImage().

◆ setBlu()

int Image::setBlu ( int  ind,
float  val 
)

Sets the blue color value in the color table

Parameters
indIndex in color table
valBlue color value (0-1)

References WXP::ImageColor::b.

Referenced by WXP::GifFile::read(), WXP::LZWComp::read(), and WXP::PngFile::read().

◆ setColorVal()

int Image::setColorVal ( int  ind,
int  val 
)

Sets the device specific color value in color table

Parameters
indIndex in color table
valDevice specific color value

References WXP::ImageColor::val.

Referenced by WXP::XWindow::drawImage(), and WXP::XWindow::drawImage().

◆ setCutoff()

int Image::setCutoff ( char *  str)

Sets the cutoff values for pixel interpolation.

Parameters
strString containing cutoff values.

◆ setGrn()

int Image::setGrn ( int  ind,
float  val 
)

Sets the green color value in the color table

Parameters
indIndex in color table
valGreen color value (0-1)

References WXP::ImageColor::g.

Referenced by WXP::GifFile::read(), WXP::LZWComp::read(), and WXP::PngFile::read().

◆ setPixAve()

int Image::setPixAve ( bool  val)

Sets whether pixel interpolation is using averaging or nearest value

Parameters
valtrue=average, false=nearest value

Referenced by WXP::ImagePlot::drawImage().

◆ setPixel() [1/2]

int Image::setPixel ( GridPoint  gpt,
int  val 
)

Sets the value of a pixel in the image

Parameters
gptGridPoint location of pixel
valPixel value to set

References setPixel().

◆ setPixel() [2/2]

int Image::setPixel ( int  x,
int  y,
int  val 
)

◆ setRed()

int Image::setRed ( int  ind,
float  val 
)

Sets the red color value in the color table

Parameters
indIndex in color table
valRed color value (0-1)

References WXP::ImageColor::r.

Referenced by WXP::GifFile::read(), WXP::LZWComp::read(), and WXP::PngFile::read().

◆ setValue()

int Image::setValue ( int  x,
int  y,
float  val 
)

Sets the pixel in the image from a float value

Parameters
xX location in image
yY location in image
valValue to set

References setPixel().

◆ tran() [1/6]

int Image::tran ( EarthPoint  ept,
GridPoint gpt 
)

Translates coordinates given the domain of the grid

Parameters
eptInput earth point
Return values
gptOutput grid point

References WXP::Domain::tran().

◆ tran() [2/6]

int Image::tran ( EarthPoint  ept,
Point pt 
)

◆ tran() [3/6]

int Image::tran ( GridPoint  gpt,
EarthPoint ept 
)

Translates coordinates given the domain of the grid

Parameters
gptInput grid point
Return values
eptOutput earth point

References WXP::Domain::tran().

◆ tran() [4/6]

int Image::tran ( GridPoint  gpt,
Point pt 
)

Translates coordinates given the domain of the grid

Parameters
gptInput grid point
Return values
ptOutput point on projection plane

References WXP::Domain::tran().

◆ tran() [5/6]

int Image::tran ( Point  pt,
EarthPoint ept 
)

Translates coordinates given the domain of the grid

Parameters
ptInput point on projection plane
Return values
eptOutput earth point

References WXP::Domain::tran().

◆ tran() [6/6]

int Image::tran ( Point  pt,
GridPoint gpt 
)

Translates coordinates given the domain of the grid

Parameters
ptInput point on projection plane
Return values
gptOutput grid point

References WXP::Domain::tran().

◆ validData()

bool Image::validData ( )

Determines whether the image has valid data

Returns
true if valid

Referenced by WXP::XWindow::drawImage(), and WXP::XWindow::drawImage().


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