#include <ImageInterface.h>
The various image classes seemed too fragmented and individually speciallized for easy use, so this class attempts to unify and abstract some of the common functions into one class. This class uses the Singleton pattern, so there's only ever one of them. You must use getInterface() to get a pointer the the interface.
Definition at line 21 of file ImageInterface.h.
Public Member Functions | |
~ImageInterface () | |
std::vector< double > * | getCubeLatLong (double lat1, double lon1, int z1, double lat2, double lon2, int z2) |
std::vector<double> getCubeLatLong(double lat1, double lon1, int z1, double lat2, double lon2, int z2); double lat1 - the lower lattitude double lon1 - the lower longitude int z1 - the lowest band double lat2 - the highest lattitude double lon2 - the highest longitude int z2 - the higest band return a vector of doubles of the values from the image. | |
std::vector< double > * | getCube (int x1, int y1, int z1, int x2, int y2, int z2) |
std::vector<double> getCube(int x1, int y1, int z1, int x2, int y2, int z2) int x1 - the beginning x value of the footprint of the cube int y1 - the beginning y value of the footprint of the cube int z1 - the upper or lowest layer to include int x2 - the ending x value of the footprint of the cube int y2 - the ending y value of the footprint of the cube int z2 - the upper or lower (opposite of z1) layer to include returns a vector of doubles representing a cube from the image. | |
std::vector< double > * | getCubeAllBands (int x1, int y1, int x2, int y2) |
std::vector<double> getCubeAllBands(int x1, int y1, int x2, int y2) int x1 - an x value for the footprint int y1 - a y value for the footprint int x2 - the other x value for the footprint int y2 - the other y value for the footprint returns a vector of doubles from the image. | |
std::vector< double > * | getSlice (int x1, int y1, int z1, int x2, int y2, int z2) |
std::vector<double> getSlice(int x1, int y1, int z1, int x2, int y2, int z2); int x1 - x value of fisrt corner int y1 - y value of fisrt corner int z1 - laver of first corner int x2 - x value of corner diagnal accross plane int y2 - y value of corner diagnal accross plane int z2 - z value of corner diagnal accross plane returns a vector of double from the image. | |
std::vector< double > * | getSliceScaled (int x1, int y1, int z1, int x2, int y2, int z2) |
std::vector<double> getSliceScaled(int x1, int y1, int z1, int x2, int y2, int z2); int x1 - x value of fisrt corner int y1 - y value of fisrt corner int z1 - laver of first corner int x2 - x value of corner diagnal accross plane int y2 - y value of corner diagnal accross plane int z2 - z value of corner diagnal accross plane returns a vector of double from the image. | |
std::vector< double > * | getPoint (int x1, int y1, int z1) |
std::vector<double> getPoint(int x1, int y1, int z1) int x1 - x value of the point int y1 - y value of the point int z1 - z value of the point returns a double of the value at a single point in the image. | |
int | getBands () |
int getBands() returns the number of layers (bands) in the image | |
int | getHeight () |
int getHeight() returns the number of pixels in the y direction | |
int | getWidth () |
int getWidth() return the number of pixels in the x direction | |
char * | getPath () |
char* getPath() returns the file path to the image (I hope) | |
QImage * | getQImage (int neww, int newh) |
QImage getQImage(int neww, int newh) int neww - the width of the returned image int newy - the height of the returned image returns a QImage of the specified height. | |
QImage * | getQImageArea (int x, int y, int w, int h, int neww, int newh) |
QImage* getQImageArea(int x, int y, int w, int h, int neww, int newh) int x - lowest x value int y - lowest y value int w - width in original image int h - height in original image int neww - width of returned image int newh - height of returned image returns a QImage that is a subsection of the original image. | |
std::vector< std::string > | getBandNames () |
std::vector<std::string> getBandNames() returns a vector of the band names in order | |
void | getLL (int band, double &x, double &y) |
void getLL( int band, &double x, &double y) int band - the band to use for lat/lon referance &double x - the input x, will be output lat &double y - the input y, will be output lon Accesor for ImageFormat::getLL. | |
void | getXY (int band, double &lat, double &lon) |
void getXY( int band, &double lat, &double lon) int band - the band to use for lat/lon referance &double lat - the input lat, will be output x &double lon - the input lon, will be output y Accesor for ImageFormat::getXY. | |
std::string | runDriverTest () |
std::string runDriverTest() runs a driver that creates test ImageInterface and adds values to them. | |
Static Public Member Functions | |
static ImageInterface * | getInterface (GLIMSProject *proj) |
static ImageInterface* getInterface(GLIMSProject* proj) GLIMSProject* proj - the project to be associated with this class will return a pointer to the instance of the ImageInterface. | |
static void | destroyInterface () |
Protected Member Functions | |
ImageInterface (GLIMSProject *proj) | |
ImageInterface( GLIMSProject * proj) GLIMSProject* proj - the GLIMSProject this class is attached too creates an ImageInterface. | |
Image * | getImage () |
Image* getImage() get the Image associated with this project, this is needed to to the translation of functions. | |
ImageFormat * | getImageFormat () |
ImageFormat* getImageFormat() the ImageFormat is needed for info about the image. | |
std::vector< double > * | getValueAsDouble (void *vals, int bandnum, int width) |
std::vector<double> getValueAsDouble(void* vals, int bandnum, int width); void* vals - a pointer to an array of values in any format int bandnum - the band (layer) that these values are taken from int width - the length of the array vals returns a vector of double values representing an area in the image. | |
Protected Attributes | |
GLIMSProject * | mProj |
Static Protected Attributes | |
static bool | instanceFlag = false |
static ImageInterface * | instance = NULL |
ImageInterface::ImageInterface | ( | GLIMSProject * | proj | ) | [protected] |
ImageInterface( GLIMSProject * proj) GLIMSProject* proj - the GLIMSProject this class is attached too creates an ImageInterface.
Definition at line 34 of file ImageInterface.cpp.
References mProj.
Referenced by getInterface().
ImageInterface::~ImageInterface | ( | ) |
Definition at line 30 of file ImageInterface.cpp.
Image * ImageInterface::getImage | ( | ) | [protected] |
Image* getImage() get the Image associated with this project, this is needed to to the translation of functions.
Definition at line 38 of file ImageInterface.cpp.
References GLIMSProject::getImage(), and mProj.
Referenced by getBandNames(), getHeight(), getQImage(), getQImageArea(), getSliceScaled(), getValueAsDouble(), and getWidth().
ImageFormat * ImageInterface::getImageFormat | ( | ) | [protected] |
ImageFormat* getImageFormat() the ImageFormat is needed for info about the image.
Definition at line 42 of file ImageInterface.cpp.
References GLIMSProject::getImage(), and mProj.
Referenced by getBands(), getCube(), getCubeAllBands(), getCubeLatLong(), getLL(), getPoint(), getSlice(), getSliceScaled(), and getXY().
std::vector< double > * ImageInterface::getValueAsDouble | ( | void * | vals, | |
int | bandnum, | |||
int | width | |||
) | [protected] |
std::vector<double> getValueAsDouble(void* vals, int bandnum, int width); void* vals - a pointer to an array of values in any format int bandnum - the band (layer) that these values are taken from int width - the length of the array vals returns a vector of double values representing an area in the image.
all data types are translated to doubles to provide a unified face to the data. This pointer is created with new, so you must ensure that it is properly destroyed.
Definition at line 400 of file ImageInterface.cpp.
References Image::getBandInfSet(), getImage(), ImageFormat::INT16, ImageFormat::INT32, ImageFormat::INT64, ImageFormat::INT8, ImageFormat::UINT16, ImageFormat::UINT32, ImageFormat::UINT64, and ImageFormat::UINT8.
Referenced by getCube(), getCubeLatLong(), getPoint(), getSlice(), and getSliceScaled().
ImageInterface * ImageInterface::getInterface | ( | GLIMSProject * | proj | ) | [static] |
static ImageInterface* getInterface(GLIMSProject* proj) GLIMSProject* proj - the project to be associated with this class will return a pointer to the instance of the ImageInterface.
If no ImageInterface has been created, it creates one and returns a pointer.
Definition at line 8 of file ImageInterface.cpp.
References ImageInterface(), instance, and instanceFlag.
Referenced by ImageCalculatorDialog::buildDialog(), GtoSConverter::GtoSConverter(), and ImageCalculator::ImageCalculator().
void ImageInterface::destroyInterface | ( | ) | [static] |
Definition at line 23 of file ImageInterface.cpp.
References instance, and instanceFlag.
Referenced by GtoSConverter::~GtoSConverter().
std::vector< double > * ImageInterface::getCubeLatLong | ( | double | lat1, | |
double | lon1, | |||
int | z1, | |||
double | lat2, | |||
double | lon2, | |||
int | z2 | |||
) |
std::vector<double> getCubeLatLong(double lat1, double lon1, int z1, double lat2, double lon2, int z2); double lat1 - the lower lattitude double lon1 - the lower longitude int z1 - the lowest band double lat2 - the highest lattitude double lon2 - the highest longitude int z2 - the higest band return a vector of doubles of the values from the image.
Exactly like getCube, except uses lat/lon instead of x/y. This pointer is created with new, so you must ensure that it is destroyed properly.
Definition at line 47 of file ImageInterface.cpp.
References ImageFormat::getBand(), getImageFormat(), getValueAsDouble(), ImageFormat::getXY(), and ImageFormat::SCALE_NN.
Referenced by GtoSConverter::getSelectedShapes().
std::vector< double > * ImageInterface::getCube | ( | int | x1, | |
int | y1, | |||
int | z1, | |||
int | x2, | |||
int | y2, | |||
int | z2 | |||
) |
std::vector<double> getCube(int x1, int y1, int z1, int x2, int y2, int z2) int x1 - the beginning x value of the footprint of the cube int y1 - the beginning y value of the footprint of the cube int z1 - the upper or lowest layer to include int x2 - the ending x value of the footprint of the cube int y2 - the ending y value of the footprint of the cube int z2 - the upper or lower (opposite of z1) layer to include returns a vector of doubles representing a cube from the image.
the x and y values are used to determine a retangular footprint, while the z values determine the layer to use. This pointer is created with new, so you must ensure that it is destroyed properly.
Definition at line 153 of file ImageInterface.cpp.
References getImageFormat(), ImageFormat::getLL(), getValueAsDouble(), ImageFormat::getXY(), and ImageFormat::SCALE_NN.
Referenced by getCubeAllBands(), getSlice(), and getSliceScaled().
std::vector< double > * ImageInterface::getCubeAllBands | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2 | |||
) |
std::vector<double> getCubeAllBands(int x1, int y1, int x2, int y2) int x1 - an x value for the footprint int y1 - a y value for the footprint int x2 - the other x value for the footprint int y2 - the other y value for the footprint returns a vector of doubles from the image.
the x and y values determine an rectangular footprint, and all layers are returned. This pointer is created with new, so you must ensure that it is destroyed properly.
Definition at line 233 of file ImageInterface.cpp.
References getCube(), and getImageFormat().
Referenced by ImageCube::ImageCube().
std::vector< double > * ImageInterface::getSlice | ( | int | x1, | |
int | y1, | |||
int | z1, | |||
int | x2, | |||
int | y2, | |||
int | z2 | |||
) |
std::vector<double> getSlice(int x1, int y1, int z1, int x2, int y2, int z2); int x1 - x value of fisrt corner int y1 - y value of fisrt corner int z1 - laver of first corner int x2 - x value of corner diagnal accross plane int y2 - y value of corner diagnal accross plane int z2 - z value of corner diagnal accross plane returns a vector of double from the image.
The values are from a slice (or plane) of any size in any major direction (i.e. you can do slice along any of the x, y, or z axis), but not diagonal. This pointer is created with new, so you must ensure that it is destroyed properly.
Definition at line 237 of file ImageInterface.cpp.
References getCube(), getImageFormat(), getValueAsDouble(), and ImageFormat::SCALE_NN.
Referenced by runDriverTest().
std::vector< double > * ImageInterface::getSliceScaled | ( | int | x1, | |
int | y1, | |||
int | z1, | |||
int | x2, | |||
int | y2, | |||
int | z2 | |||
) |
std::vector<double> getSliceScaled(int x1, int y1, int z1, int x2, int y2, int z2); int x1 - x value of fisrt corner int y1 - y value of fisrt corner int z1 - laver of first corner int x2 - x value of corner diagnal accross plane int y2 - y value of corner diagnal accross plane int z2 - z value of corner diagnal accross plane returns a vector of double from the image.
The values are from a slice (or plane) of any size in any major direction (i.e. you can do slice along any of the x, y, or z axis), but not diagonal. If this slice lies on a layer that is not the same size as the first layer the slice is scaled to the size of the first layer. This pointer is created with new, so you must ensure that it is destroyed properly.
Definition at line 285 of file ImageInterface.cpp.
References Image::getBandInfSet(), getCube(), getImage(), getImageFormat(), ImageFormat::getLL(), getValueAsDouble(), ImageFormat::getXY(), and ImageFormat::SCALE_NN.
Referenced by ImageCalculator::calculate().
std::vector< double > * ImageInterface::getPoint | ( | int | x1, | |
int | y1, | |||
int | z1 | |||
) |
std::vector<double> getPoint(int x1, int y1, int z1) int x1 - x value of the point int y1 - y value of the point int z1 - z value of the point returns a double of the value at a single point in the image.
Definition at line 375 of file ImageInterface.cpp.
References getImageFormat(), and getValueAsDouble().
int ImageInterface::getBands | ( | ) |
int getBands() returns the number of layers (bands) in the image
Definition at line 379 of file ImageInterface.cpp.
References getImageFormat(), and ImageFormat::getNumBands().
Referenced by ImageCalculator::calculate(), getBandNames(), GtoSConverter::getConversion(), and ImageCube::ImageCube().
int ImageInterface::getHeight | ( | ) |
int getHeight() returns the number of pixels in the y direction
Definition at line 382 of file ImageInterface.cpp.
References getImage(), and Image::height().
Referenced by ImageCalculator::calculate(), getQImage(), and GtoSConverter::getSelectedShapes().
int ImageInterface::getWidth | ( | ) |
int getWidth() return the number of pixels in the x direction
Definition at line 385 of file ImageInterface.cpp.
References getImage(), and Image::width().
Referenced by ImageCalculator::calculate(), getQImage(), and GtoSConverter::getSelectedShapes().
char * ImageInterface::getPath | ( | ) |
char* getPath() returns the file path to the image (I hope)
Definition at line 388 of file ImageInterface.cpp.
QImage * ImageInterface::getQImage | ( | int | neww, | |
int | newh | |||
) |
QImage getQImage(int neww, int newh) int neww - the width of the returned image int newy - the height of the returned image returns a QImage of the specified height.
If the specified height is different from the original height, the image is scaled accordingly.
Definition at line 392 of file ImageInterface.cpp.
References getHeight(), getImage(), Image::getRect(), and getWidth().
QImage * ImageInterface::getQImageArea | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h, | |||
int | neww, | |||
int | newh | |||
) |
QImage* getQImageArea(int x, int y, int w, int h, int neww, int newh) int x - lowest x value int y - lowest y value int w - width in original image int h - height in original image int neww - width of returned image int newh - height of returned image returns a QImage that is a subsection of the original image.
the subsection starts at x, y, and is (w x h) pixels. If neww and newh are different from w and h, then the image is scaled accordingly.
Definition at line 396 of file ImageInterface.cpp.
References getImage(), and Image::getRect().
std::vector< std::string > ImageInterface::getBandNames | ( | ) |
std::vector<std::string> getBandNames() returns a vector of the band names in order
Definition at line 455 of file ImageInterface.cpp.
References Image::getBandInfSet(), getBands(), and getImage().
Referenced by ImageCalculatorDialog::buildDialog(), and GtoSConverter::getConversion().
void ImageInterface::getLL | ( | int | band, | |
double & | x, | |||
double & | y | |||
) |
void getLL( int band, &double x, &double y) int band - the band to use for lat/lon referance &double x - the input x, will be output lat &double y - the input y, will be output lon Accesor for ImageFormat::getLL.
Translates the input XY values into the corresponding Lat/Lon
Definition at line 468 of file ImageInterface.cpp.
References getImageFormat(), and ImageFormat::getLL().
Referenced by ImageCalculator::calculate().
void ImageInterface::getXY | ( | int | band, | |
double & | lat, | |||
double & | lon | |||
) |
void getXY( int band, &double lat, &double lon) int band - the band to use for lat/lon referance &double lat - the input lat, will be output x &double lon - the input lon, will be output y Accesor for ImageFormat::getXY.
Translates the input Lat/Lon values into the corresponding XY
Definition at line 472 of file ImageInterface.cpp.
References getImageFormat(), and ImageFormat::getXY().
std::string ImageInterface::runDriverTest | ( | ) |
std::string runDriverTest() runs a driver that creates test ImageInterface and adds values to them.
The returned string are results used to deterine proper function.
Definition at line 476 of file ImageInterface.cpp.
References getSlice().
bool ImageInterface::instanceFlag = false [static, protected] |
Definition at line 25 of file ImageInterface.h.
Referenced by destroyInterface(), and getInterface().
ImageInterface * ImageInterface::instance = NULL [static, protected] |
Definition at line 26 of file ImageInterface.h.
Referenced by destroyInterface(), and getInterface().
GLIMSProject* ImageInterface::mProj [protected] |
Definition at line 35 of file ImageInterface.h.
Referenced by getImage(), getImageFormat(), and ImageInterface().
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |