GLIMSView Source Code Documentation

ImageSelectionCube Class Reference

#include <ImageSelectionCube.h>

Inheritance diagram for ImageSelectionCube:

Inheritance graph
[legend]

List of all members.


Detailed Description

ImageSelectionCube is a specialized ImageCube that deals with a selected shape.

The Cube holds a cube of data, as well as the pixels contatined in the selection. The selected shape doesn't need to be rectangular, and could be a point, line or polygon. This class also handles translation of the selected shape from vector to pixels, or pixels to vector.

NOTE: This class is not entierly complete. While is will translate vector to pixel and pixel to vector, not all fields are populated during the translation. Specifically the borderPixels are not populated in vector to pixels, and the selectionPixels are not populated in pixels to vector. Feel free to add this functionality if you need it.

Author:
Erica Liszewski 2006-04-25

Definition at line 24 of file ImageSelectionCube.h.


Public Member Functions

 ImageSelectionCube (int x1, int y1, int w1, int h1, ImageInterface *theimage)
 ImageSelectionCube (int x1, int y1, int w1, int h1)
 ImageSelectionCube(int x1, int y1, int w1, int h1); int x1 - lowest x value int y1 - lowest y value int w1 - width in pixels int h1 - height in pixels Creates an ImageSelection Cube the spcified location, width and height.
 ~ImageSelectionCube ()
 ~ImageSelectionCube() destructor
void setSelection (std::vector< ThreeDPoint > points)
 void setSelection(std::vector<ThreeDPoint> points); std::vector<ThreeDPoint> points - the points that define the actual selection Sets the actual selection shape via a vector of points.
void setSelection (std::vector< Pixel > pixs)
 void setSelection(std::vector<Pixels> pixs); std::vector<Pixels> pixs - the pixels that define the actual selection Sets the actual selection shape via a vector of pixels.
std::string getAsString ()
 std::string getAsString(); returns a string list of each pixel and it's value through the layers.
std::string getAsString (std::string delim)
 std::string getAsString(std::string delim) std::string delim - the desired Delimiter same as above, but you can specify the Delimiter
std::string getAsString (std::string delim, std::ofstream &f)
std::vector< ThreeDPointgetPoints ()
 std::vector<ThreeDPoint> getPoints() returns a vector containing the points that define the vector outline of the selected shape.
std::vector< PixelgetPixels ()
 std::vector<Pixel> getPixels() returns a vector containing the pixels contained in the selected shape.
std::vector< double > * getValuesOf (int z)
 int z - z index (band or layer) returns the value for layer (band) z
double getValueAtLocal (int x, int y, int z)
 Uses a local reference (i.e.
double getValueAtOverall (int x, int y, int z)
 Location is specified in terms of the original image.
ThreeDPoint getLowestPoint ()
ThreeDPoint getHighestPoint ()
bool addBand (std::vector< double > *vals)
 adds a layer to the end of the current "stack" of layers
bool addBand (std::vector< double > *vals, int layernum)
 add a layer in to a specific location
bool addBands (std::vector< double > *vals)
 adds several layers in consecutive order.

Protected Member Functions

std::vector< ThreeDPointgenerateFullLine (ThreeDPoint s, ThreeDPoint f)
 std::vector<ThreeDPoint> generateFullLine(ThreeDPoint s, ThreeDPoint f) ThreeDPoint s - the starting point ThreeDPoint f - the ending point returns a vector of all pixels along a straight two-point line.
std::vector< ThreeDPointgenerateLine (ThreeDPoint s, ThreeDPoint f)
 std::vector<ThreeDPoint> generateLine(ThreeDPoint s, ThreeDPoint f) ThreeDPoint s - the starting point ThreeDPoint f - the ending point generates all pixels along the line in the y direction.
std::vector< ThreeDPointcombineSortedVectors (std::vector< ThreeDPoint > a, std::vector< ThreeDPoint > b)
 std::vector<ThreeDPoint> combineSortedVectors(std::vector<ThreeDPoint> a, std::vector<ThreeDPoint> b); std::vector<ThreeDPoint> a - a vector to be combined std::vector<ThreeDPoint> b - another vector to be combined Combined two sorted vectors into one sorted array.
std::vector< ThreeDPointremoveDuplicates (std::vector< ThreeDPoint > theVec)
 std::vector<ThreeDPoint> removeDuplicates(std::vector<ThreeDPoints> vec); std::vector<ThreeDPoints> vec - the vector in which duplicates are removed runs through a vector and removes any duplicate values.
std::vector< ThreeDPointgeneratePoints (std::vector< Pixel > pixs)
 std::vector<ThreeDPoint> generatePoints(std::vector<Pixel> pixs) std::vector<Pixel> pixs - vector of border pixels translates the input border pixels to an output of vector points
std::vector< double > getAngles (std::vector< ImageCube::Pixel > points)
 std::vector<double> getAngles(std::vector<ImageCube::Pixel> points) std::vector<ImageCube::Pixel> points - list of pixels to get angles from calculated the angles between border pixels, retuns a vector of these angles.
std::vector
< ImageCube::ThreeDPoint
getPointsFromAngles (std::vector< double > angles)
 std::vector<ImageCube::ThreeDPoint> getPointsFromAngles(std::vector<double> angles); std::vector<double> angles - vector of angles between pixels Uses the input angles to find max curvature and inflection points and make these into vector points.

Protected Attributes

std::vector< ThreeDPointselectionPoints
std::vector< Pixel > borderPixels
std::vector< Pixel > selectionPixels
PixelArray pixelArray
ImageInterfaceimage
int width
 width of the cube
int height
 height of the cube
int layers
 number of layers in the cube
ThreeDPoint lowestPoint
 where (0,0,0) falls in the original image
ThreeDPoint highestPoint
 where the opposite corner falls in original image
std::vector< LayertheCube
 holds all the layers, effectivly the cube

Constructor & Destructor Documentation

ImageSelectionCube::ImageSelectionCube ( int  x1,
int  y1,
int  w1,
int  h1,
ImageInterface theimage 
)

Definition at line 4 of file ImageSelectionCube.cpp.

ImageSelectionCube::ImageSelectionCube ( int  x1,
int  y1,
int  w1,
int  h1 
)

ImageSelectionCube(int x1, int y1, int w1, int h1); int x1 - lowest x value int y1 - lowest y value int w1 - width in pixels int h1 - height in pixels Creates an ImageSelection Cube the spcified location, width and height.

Definition at line 7 of file ImageSelectionCube.cpp.

ImageSelectionCube::~ImageSelectionCube (  ) 

~ImageSelectionCube() destructor

Definition at line 10 of file ImageSelectionCube.cpp.

References ImageCube::theCube.


Member Function Documentation

void ImageSelectionCube::setSelection ( std::vector< ThreeDPoint points  ) 

void setSelection(std::vector<ThreeDPoint> points); std::vector<ThreeDPoint> points - the points that define the actual selection Sets the actual selection shape via a vector of points.

The selected pixels are determined at this time.

Referenced by GtoSConverter::getSelectedShapes(), ImageShapeFinder::handleLine(), ImageShapeFinder::handlePoint(), and ImageShapeFinder::handlePoly().

void ImageSelectionCube::setSelection ( std::vector< Pixel >  pixs  ) 

void setSelection(std::vector<Pixels> pixs); std::vector<Pixels> pixs - the pixels that define the actual selection Sets the actual selection shape via a vector of pixels.

The vector outlines are determined at this time.

std::string ImageSelectionCube::getAsString (  ) 

std::string getAsString(); returns a string list of each pixel and it's value through the layers.

Definition at line 133 of file ImageSelectionCube.cpp.

std::string ImageSelectionCube::getAsString ( std::string  delim  ) 

std::string getAsString(std::string delim) std::string delim - the desired Delimiter same as above, but you can specify the Delimiter

Definition at line 178 of file ImageSelectionCube.cpp.

References PixelProfile::add(), PixelArray::add(), PixelArray::clearAll(), PixelArray::getAsString(), PixelArray::getPixel(), ImageCube::getValueAtOverall(), ImageCube::layers, pixelArray, and selectionPixels.

Here is the call graph for this function:

std::string ImageSelectionCube::getAsString ( std::string  delim,
std::ofstream &  f 
)

std::vector< ImageCube::ThreeDPoint > ImageSelectionCube::getPoints (  ) 

std::vector<ThreeDPoint> getPoints() returns a vector containing the points that define the vector outline of the selected shape.

Definition at line 210 of file ImageSelectionCube.cpp.

References selectionPoints.

std::vector< ImageCube::Pixel > ImageSelectionCube::getPixels (  ) 

std::vector<Pixel> getPixels() returns a vector containing the pixels contained in the selected shape.

Definition at line 215 of file ImageSelectionCube.cpp.

References selectionPixels.

std::vector< ImageCube::ThreeDPoint > ImageSelectionCube::generateFullLine ( ImageCube::ThreeDPoint  s,
ImageCube::ThreeDPoint  f 
) [protected]

std::vector<ThreeDPoint> generateFullLine(ThreeDPoint s, ThreeDPoint f) ThreeDPoint s - the starting point ThreeDPoint f - the ending point returns a vector of all pixels along a straight two-point line.

This differs from generateLine because it returns all pixels in the line istead of just the y-borders. This is used for straight lines, not polys.

Definition at line 220 of file ImageSelectionCube.cpp.

References generateLine(), ImageCube::ThreeDPoint::x, ImageCube::ThreeDPoint::y, and ImageCube::ThreeDPoint::z.

Here is the call graph for this function:

std::vector< ImageCube::ThreeDPoint > ImageSelectionCube::generateLine ( ImageCube::ThreeDPoint  s,
ImageCube::ThreeDPoint  f 
) [protected]

std::vector<ThreeDPoint> generateLine(ThreeDPoint s, ThreeDPoint f) ThreeDPoint s - the starting point ThreeDPoint f - the ending point generates all pixels along the line in the y direction.

i.e. X's are generated (note this shows the whole shape not just a single line.)

              000000XXX000000
              000X000000X0000
              X00000000000X00
              0X000000000000X
              000X000000000X0
              00000XXXXXXX000
 
the returned vector contains all these edge pixels in order of top->bottom, left->right.

Definition at line 332 of file ImageSelectionCube.cpp.

References ImageCube::ThreeDPoint::x, ImageCube::ThreeDPoint::y, and ImageCube::ThreeDPoint::z.

Referenced by generateFullLine().

std::vector<ThreeDPoint> ImageSelectionCube::combineSortedVectors ( std::vector< ThreeDPoint a,
std::vector< ThreeDPoint b 
) [protected]

std::vector<ThreeDPoint> combineSortedVectors(std::vector<ThreeDPoint> a, std::vector<ThreeDPoint> b); std::vector<ThreeDPoint> a - a vector to be combined std::vector<ThreeDPoint> b - another vector to be combined Combined two sorted vectors into one sorted array.

(Basically a the merge part of a merge-sort). Returned array is sorted top->bottom, left->right.

std::vector<ThreeDPoint> ImageSelectionCube::removeDuplicates ( std::vector< ThreeDPoint theVec  )  [protected]

std::vector<ThreeDPoint> removeDuplicates(std::vector<ThreeDPoints> vec); std::vector<ThreeDPoints> vec - the vector in which duplicates are removed runs through a vector and removes any duplicate values.

..this is needed because I found some duplicate values where slipping in to my lists.

std::vector<ThreeDPoint> ImageSelectionCube::generatePoints ( std::vector< Pixel >  pixs  )  [protected]

std::vector<ThreeDPoint> generatePoints(std::vector<Pixel> pixs) std::vector<Pixel> pixs - vector of border pixels translates the input border pixels to an output of vector points

std::vector<double> ImageSelectionCube::getAngles ( std::vector< ImageCube::Pixel points  )  [protected]

std::vector<double> getAngles(std::vector<ImageCube::Pixel> points) std::vector<ImageCube::Pixel> points - list of pixels to get angles from calculated the angles between border pixels, retuns a vector of these angles.

std::vector< ImageCube::ThreeDPoint > ImageSelectionCube::getPointsFromAngles ( std::vector< double >  angles  )  [protected]

std::vector<ImageCube::ThreeDPoint> getPointsFromAngles(std::vector<double> angles); std::vector<double> angles - vector of angles between pixels Uses the input angles to find max curvature and inflection points and make these into vector points.

Definition at line 617 of file ImageSelectionCube.cpp.

References ImageCube::ThreeDPoint::x, and ImageCube::ThreeDPoint::y.

std::vector< double > * ImageCube::getValuesOf ( int  z  )  [inherited]

int z - z index (band or layer) returns the value for layer (band) z

Definition at line 48 of file ImageCube.cpp.

References ImageCube::theCube.

double ImageCube::getValueAtLocal ( int  x,
int  y,
int  z 
) [inherited]

Uses a local reference (i.e.

starts at 0,0).

Parameters:
[in] x int x index
[in] y int y index
[in] z int z index
Returns:
double the value at the location specified.

Definition at line 53 of file ImageCube.cpp.

References ImageCube::theCube, and ImageCube::width.

Referenced by ImageCube::getValueAtOverall().

double ImageCube::getValueAtOverall ( int  x,
int  y,
int  z 
) [inherited]

Location is specified in terms of the original image.

Parameters:
[in] x int x index
[in] y int y index
[in] z int z index
Returns:
double the value at the location specified,

Definition at line 74 of file ImageCube.cpp.

References ImageCube::getValueAtLocal(), ImageCube::lowestPoint, ImageCube::ThreeDPoint::x, and ImageCube::ThreeDPoint::y.

Referenced by getAsString().

Here is the call graph for this function:

ImageCube::ThreeDPoint ImageCube::getLowestPoint (  )  [inherited]

Returns:
ThreeDPoint corresponds to where the lowest point in this cube is in the original image.

Definition at line 80 of file ImageCube.cpp.

References ImageCube::lowestPoint.

ImageCube::ThreeDPoint ImageCube::getHighestPoint (  )  [inherited]

Returns:
ThreeDPoint corresponds to where the highest point in this cube is in the original image.

Definition at line 84 of file ImageCube.cpp.

References ImageCube::highestPoint.

bool ImageCube::addBand ( std::vector< double > *  vals  )  [inherited]

adds a layer to the end of the current "stack" of layers

Parameters:
[in] vals std::vector<double> the values to form the layer
Returns:
boolean true if successful, and false if not

Definition at line 88 of file ImageCube.cpp.

References ImageCube::Layer::layernum, ImageCube::layers, ImageCube::theCube, and ImageCube::Layer::values.

Referenced by ImageCube::addBands().

bool ImageCube::addBand ( std::vector< double > *  vals,
int  layernum 
) [inherited]

add a layer in to a specific location

Parameters:
[in] vals std::vector<double> the values to form the layer
[in] layernum int the location of the layer
Returns:
boolean true if successful, and false if not

Definition at line 99 of file ImageCube.cpp.

References ImageCube::Layer::layernum, ImageCube::layers, ImageCube::theCube, and ImageCube::Layer::values.

bool ImageCube::addBands ( std::vector< double > *  vals  )  [inherited]

adds several layers in consecutive order.

The size of the cube is determined when initialized, so we can determine each layer from the next based on size

Parameters:
[in] vals std::vector<double> the values to form the layer
Returns:
boolean true if successful, and false if not

Definition at line 125 of file ImageCube.cpp.

References ImageCube::addBand(), ImageCube::height, and ImageCube::width.

Referenced by GtoSConverter::getSelectedShapes(), ImageCube::ImageCube(), and ImageCalculator::testDriver().

Here is the call graph for this function:


Member Data Documentation

Definition at line 92 of file ImageSelectionCube.h.

Referenced by getPoints().

std::vector<Pixel> ImageSelectionCube::borderPixels [protected]

Definition at line 93 of file ImageSelectionCube.h.

std::vector<Pixel> ImageSelectionCube::selectionPixels [protected]

Definition at line 95 of file ImageSelectionCube.h.

Referenced by getAsString(), and getPixels().

Definition at line 96 of file ImageSelectionCube.h.

Referenced by getAsString().

ImageInterface* ImageCube::image [protected, inherited]

Definition at line 42 of file ImageCube.h.

Referenced by ImageCube::ImageCube().

int ImageCube::width [protected, inherited]

int ImageCube::height [protected, inherited]

height of the cube

Definition at line 44 of file ImageCube.h.

Referenced by ImageCube::addBands(), ImageArithmaticCube::calculate(), and ImageCube::ImageCube().

int ImageCube::layers [protected, inherited]

number of layers in the cube

Definition at line 45 of file ImageCube.h.

Referenced by ImageCube::addBand(), ImageArithmaticCube::calculate(), getAsString(), and ImageCube::ImageCube().

ThreeDPoint ImageCube::lowestPoint [protected, inherited]

where (0,0,0) falls in the original image

Definition at line 46 of file ImageCube.h.

Referenced by ImageCube::getLowestPoint(), ImageCube::getValueAtOverall(), and ImageCube::ImageCube().

ThreeDPoint ImageCube::highestPoint [protected, inherited]

where the opposite corner falls in original image

Definition at line 47 of file ImageCube.h.

Referenced by ImageCube::getHighestPoint(), and ImageCube::ImageCube().

std::vector<Layer> ImageCube::theCube [protected, inherited]


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

Home | Search | Disclaimers & Privacy | Contact Us
GLIMSView Maintainer: dsoltesz@usgs.gov