Isis 3 Programmer Reference
Isis::ImagePolygon Class Reference

Create cube polygons, read/write polygons to blobs. More...

#include <ImagePolygon.h>

Inheritance diagram for Isis::ImagePolygon:
Inheritance graph
Collaboration diagram for Isis::ImagePolygon:
Collaboration graph

Public Member Functions

 ImagePolygon ()
 Constructs a Polygon object, setting the polygon name. More...
 
 ~ImagePolygon ()
 Destroys the Polygon object. More...
 
void Create (Cube &cube, int sinc=1, int linc=1, int ss=1, int sl=1, int ns=0, int nl=0, int band=1, bool increasePrecision=false)
 Create a Polygon from given cube. More...
 
CamerainitCube (Cube &cube, int ss=1, int sl=1, int ns=0, int nl=0, int band=1)
 Create a Polygon from given cube. More...
 
void Emission (double emission)
 Set the maximum emission angle ( light refleted to camera ) More...
 
void Incidence (double incidence)
 Set the maximum incidence angle ( light contacting the planet ) More...
 
void EllipsoidLimb (bool ellip)
 If a limb is detected, use un ellipsoid shape model if true. More...
 
void SubpixelAccuracy (int div)
 The subpixel accuracy to use. More...
 
geos::geom::MultiPolygon * Polys ()
 Return a geos Multipolygon. More...
 
double validSampleDim ()
 Retuns the maximum valid sample width of the cube set with either initCube() or Create() More...
 
double validLineDim ()
 Retuns the maximum valid line width of the cube set with either initCube() or Create() More...
 
int getSinc () const
 Return the sample increment used the create this polygon. More...
 
int getLinc () const
 Return the line increment used the create this polygon. More...
 
QString Type () const
 Accessor method that returns a string containing the Blob type. More...
 
QString Name () const
 Accessor method that returns a string containing the Blob name. More...
 
int Size () const
 Accessor method that returns the number of bytes in the blob data. More...
 
PvlObjectLabel ()
 Accessor method that returns a PvlObject containing the Blob label. More...
 
void Read (const QString &file)
 This method reads Pvl values from a specified file. More...
 
void Read (const QString &file, const Pvl &pvlLabels)
 This method reads the given a file and labels. More...
 
virtual void Read (const Pvl &pvl, std::istream &is)
 This method reads the Blob data from an open input file stream. More...
 
void Write (const QString &file)
 Write the blob data out to a file. More...
 
void Write (Pvl &pvl, std::fstream &stm, const QString &detachedFileName="")
 Write the blob data out to a Pvl object. More...
 

Protected Member Functions

void ReadData (std::istream &is)
 Reads Multipolygon from cube blob. More...
 
void WriteInit ()
 Initializes for writing polygon to cube blob. More...
 
void WriteData (std::fstream &os)
 Writes polygon to cube blob. More...
 
void Find (const Pvl &pvl)
 This method searches the given Pvl for the Blob by the Blob's type and name. More...
 
virtual void ReadInit ()
 This virtual method for classes that inherit Blob. More...
 

Protected Attributes

PvlObject p_blobPvl
 Pvl Blob object. More...
 
QString p_blobName
 Name of the Blob object. More...
 
char * p_buffer
 Buffer blob data is stored in. More...
 
BigInt p_startByte
 Byte blob data starts at in buffer. More...
 
int p_nbytes
 Size of blob data (in bytes) More...
 
QString p_type
 Type of data stored in the buffer. More...
 
QString p_detached
 Used for reading detached blobs. More...
 
QString p_labelFile
 The file containing the labels. More...
 

Private Member Functions

bool SetImage (const double sample, const double line)
 Sets the sample/line values of the cube to get lat/lon values. More...
 
geos::geom::Coordinate FindFirstPoint ()
 Finds the first point that projects in an image. More...
 
void WalkPoly ()
 Walks the image finding its lon lat polygon and stores it to p_pts. More...
 
geos::geom::Coordinate FindNextPoint (geos::geom::Coordinate *currentPoint, geos::geom::Coordinate lastPoint, int recursionDepth=0)
 Finds the next point on the image using a left hand rule walking algorithm. More...
 
double DistanceSquared (const geos::geom::Coordinate *p1, const geos::geom::Coordinate *p2)
 Calculates the distance squared between two coordinates. More...
 
void MoveBackInsideImage (double &sample, double &line, double sinc, double linc)
 This method ensures sample/line after sinc/linc have been applied is inside the image. More...
 
bool InsideImage (double sample, double line)
 This returns true if sample/line are inside the cube. More...
 
void Fix360Poly ()
 If the cube crosses the 0/360 boundary and does not include a pole, the polygon is separated into multiple polygons, usually one on each side of the boundary. More...
 
void FixPolePoly (std::vector< geos::geom::Coordinate > *crossingPoints)
 If the cube crosses the 0/360 boundary and contains a pole, Some points are added to allow the polygon to unwrap properly. More...
 
bool IsLimb ()
 Returns True when the input image is a limb image. More...
 
geos::geom::Coordinate FindBestPoint (geos::geom::Coordinate *currentPoint, geos::geom::Coordinate newPoint, geos::geom::Coordinate lastPoint)
 While walking the image in sample/line space, this function finds the best valid point between the first valid point found and the last point which failed its validity test using a linear search. More...
 
geos::geom::Coordinate FixCornerSkip (geos::geom::Coordinate *currentPoint, geos::geom::Coordinate newPoint)
 Looks at the next possible point relative to the lasts and attempts to adjust the point outward to grab valid corner data. More...
 
void FindSubpixel (std::vector< geos::geom::Coordinate > &points)
 Takes p_polygons in sample/line space and finds its subpixel accuracy. More...
 
void calcImageBorderCoordinates ()
 Calculates the four border points, particularly for validSampleDim() and validLineDim() More...
 

Private Attributes

Cubep_cube
 The cube provided. More...
 
bool p_isProjected
 True when the provided cube is projected. More...
 
Brickp_brick
 Used to check for valid DNs. More...
 
geos::geom::CoordinateSequence * p_pts
 The sequence of coordinates that compose the boundry of the image. More...
 
geos::geom::MultiPolygon * p_polygons
 The multipolygon of the image. More...
 
std::string p_polyStr
 The string representation of the polygon. More...
 
UniversalGroundMapp_gMap
 The cube's ground map. More...
 
geos::geom::Coordinate * m_leftCoord
 The cube's left-most valid coord. More...
 
geos::geom::Coordinate * m_rightCoord
 The cube's right-most valid coord. More...
 
geos::geom::Coordinate * m_topCoord
 The cube's top-most valid coord. More...
 
geos::geom::Coordinate * m_botCoord
 The cube's bot-most valid coord. More...
 
int p_cubeStartSamp
 The the sample of the first valid point in the cube. More...
 
int p_cubeStartLine
 The the line of the first valid point in the cube. More...
 
int p_cubeSamps
 The number of samples in the cube. More...
 
int p_cubeLines
 The number of lines in the cube. More...
 
int p_sampinc
 The increment for walking along the polygon in the sample direction. More...
 
int p_lineinc
 The increment for walking along the polygon in the line direcction. More...
 
double p_emission
 The maximum emission angle to consider valid. More...
 
double p_incidence
 The maximum incidence angle to consider valid. More...
 
bool p_ellipsoid
 Uses an ellipsoid if a limb is detected. More...
 
int p_subpixelAccuracy
 The subpixel accuracy to use. More...
 

Detailed Description

Create cube polygons, read/write polygons to blobs.

This class creates polygons defining an image boundary, reads the polygon from a cube blob, and writes a polygon to a cube blob. The GEOS (Geometry Engine Open Source) package is used to create and manipulate the polygons. See http://geos.refractions.net for information about this package.

Author
2005-11-22 Tracie Sucharski
History:

2006-05-17 Stuart Sides Renamed from PolygonTools and moved the geos::GeometryFactory to the new PolygonTools

2007-01-04 Tracie Sucharski, Fixed bug in Fix360Poly, on non-pole images after splitting at the 360 boundary, wasn't insuring that start and end points of polygon were the same.

2007-01-05 Tracie Sucharski, Made a change to the SetImage method. Cannot make the assumption that if a sample/line returns a lat/lon, that the lat/lon will return a sample/line. This was found using a Moc WA, global image, sample 1, line 1 returned a lat/lon, but entering that lat/lon does not return a valid sample/line.

2007-01-08 Tracie Sucharski, Fixed bugs in the ToImage and ToGround class for images that contain a pole.

2007-02-06 Tracie Sucharski, Added band parameter to Create method and call UniversalGroundMap::SetBand.

2007-05-04 Robert Sucharski, with Jeff, Stuart, and Tracie's blessing, moved the WKT method to the PolygonTools class.

2007-07-26 Tracie Sucharski, Added ss,sl,ns,nl to constructor for sub-poly creation.

2007-11-09 Tracie Sucharski, Remove WKT method since the geos package know has a method to return a WKT string

2008-03-17 Tracie Sucharski, Added try/catch block to Create and Fix360Poly to catch geos exceptions.

2008-08-18 Steven Lambright - Updated to work with geos3.0.0 instead of geos2. Mostly namespace changes.

2008-12-10 Steven Koechle - Split pole code into seperate function, chanded the way FixPoly360 did its intersection to handle a multipolygon being returned.

2008-12-10 Steven Lambright - Fixed logical problem which could happen when the limb of the planet was on the left and was the first thing found in the FindPoly method.

2009-01-06 Steven Koechle - Changed Constructor, removed backwards compatibility for footprint name.

2009-01-28 Steven Lambright - Fixed memory leaks

2009-02-20 Steven Koechle - Fixed Fix360Poly to use the PolygonTools Intersect method.

2009-04-17 Steven Koechle - Rewrote most of the class. Implemented a left-hand rule AI walking algotithm in the walkpoly method. Pole and 360 boundary logic was more integrated and simplified. Method of finding the first point was seperated into its own method.

2009-05-06 Steven Koechle - Fixed Error where a NULL polygon was being written.

2009-05-28 Steven Lambright - This program will no longer generate invalid polygons and should use despike as a correction algorithm if it is necessary.

2009-05-28 Stuart Sides - Added a new argument to Create for controling the quality of the polygon.

2009-05-28 Steven Lambright - Moved the quality parameter in the argument list, improved speed and the edges of files (and subareas) should be checked if the algorithm reaches them now. Fixed the sub-area capabilities.

2009-06-16 Christopher Austin - Fixed WalkPoly() to catch large pixel increments that ( though snapping ) skip over the starting point. Also skip the first left turn in FindNextPoint() to prevent double point checking as well as errors with snapping.

2009-06-17 Christopher Austin - Removed p_name. Uses parent Name()

2009-06-18 Christopher Austin - Changes starting point skipping solution to a snap. Added fix for polygons that form self-intersecting polygons due to this first point snapping.

2009-06-19 Christopher Austin - Temporarily reverted for backport, fixed truthdata for SpiceRotation, re-commited with all updates

2009-07-01 Christopher Austin - Added Emission and Phase Angle tolerences.

2009-07-09 Christopher Austin - Fixed range error in FixPolePoly() when no points cross, an overflow exception, as well as emission and incidence handling of poles.

2009-07-21 Christopher Austin - Added limb snapping along with internal corner searching. Fixed lat/lon crossing when samp/line does not cross. Removed the SetUniversalGround call in SetImage(). Limbs are now detected and handled using an ellipsoid shape model if p_ellipsoid is true.

2009-07-28 Christopher Austin - Changed qualitiy increment to sample/line increment to remove unnecessary points from the polygon.

2009-08-05 Christopher Austin - Added pole meridian proper polygon division.

2009-08-20 Christopher Austin - Added meridian walking and subpixel accuracy.

2009-08-28 Christopher Austin - Fixed a memory bounds error.

2010-02-08 Christopher Austin - Fixed an infinite loop which revisited the starting point, and added 360 meridian crossing

2010-02-17 Christopher Austin - Fixed two more infinite looping issues, including a cycle fix which occured during Emission Angle and Incidence Angle restrictions

2011-05-11 Steven Lambright - Now works with projected images.

2011-05-12 Christopher Austin - Added validSample/LineDim() functionality.

2011-07-01 Travis Addair - Added outlier check to FindFirstPoint() to avoid choosing a first point without any valid neighbors (i.e., an outlier).

2012-05-14 Steven Lambright - Added safety to the calcImageBorderCoordinates method, along with the validSampleDim and validLineDim methods. This fixes seg faults. Fixes #686.

2012-07-16 Steven Lambright - Fixed a bug in WalkPoly() that caused crashing periodically due to accessing a vector outside of it's bounds (negative indices). This was in the 'triangle' (loop) detection code. Fixes #994.

History:
2007-01-19 Tracie Sucharski, Comment out the ToGround method.
History:
2007-01-31 Tracie Sucharski, Add WKT method to return WKT polygon as a string.
History:
2008-06-18 Stuart Sides - Fixed doc error

Definition at line 167 of file ImagePolygon.h.

Constructor & Destructor Documentation

◆ ImagePolygon()

Isis::ImagePolygon::ImagePolygon ( )

Constructs a Polygon object, setting the polygon name.

Definition at line 56 of file ImagePolygon.cpp.

References m_botCoord, m_leftCoord, m_rightCoord, m_topCoord, p_cube, p_cubeStartLine, p_cubeStartSamp, p_ellipsoid, p_emission, p_incidence, p_polygons, and p_subpixelAccuracy.

◆ ~ImagePolygon()

Isis::ImagePolygon::~ImagePolygon ( )

Destroys the Polygon object.

Definition at line 79 of file ImagePolygon.cpp.

References m_botCoord, m_leftCoord, m_rightCoord, m_topCoord, p_cube, and p_polygons.

Member Function Documentation

◆ calcImageBorderCoordinates()

void Isis::ImagePolygon::calcImageBorderCoordinates ( )
private

Calculates the four border points, particularly for validSampleDim() and validLineDim()

History:
2011-05-16 Tracie Sucharski - Fixed typo from p_cubeSamples to p_cubeSamps in ASSERT.

Definition at line 563 of file ImagePolygon.cpp.

References Isis::Cube::lineCount(), m_botCoord, m_leftCoord, m_rightCoord, m_topCoord, p_cube, p_cubeLines, p_cubeSamps, p_cubeStartLine, p_cubeStartSamp, and SetImage().

Referenced by validLineDim(), and validSampleDim().

◆ Create()

void Isis::ImagePolygon::Create ( Cube cube,
int  sinc = 1,
int  linc = 1,
int  ss = 1,
int  sl = 1,
int  ns = 0,
int  nl = 0,
int  band = 1,
bool  increasePrecision = false 
)

Create a Polygon from given cube.

Parameters
[in]cube(Cube &) Cube used to create polygon
[in]sinc(Default=1) (in) Pixel increment to define the granularity of the resulting polygon in the sample direction
[in]linc(Default=1) (in) Pixel increment to define the granularity of the resulting polygon in the line direction
[in]ss(Default=1) (in) Starting sample number
[in]sl(Default=1) (in) Starting Line number
[in]ns(Default=0) (in) Number of samples used to create the polygon. Default of 0 will cause ns to be set to the number of samples in the cube.
[in]nl(Default=0) (in) Number of lines used to create the polygon. Default of 0 will cause nl to be set to the number of lines in the cube.
[in]band(Default=1) (in) Image band number
increasePrecisionIteratively refine sinc and linc (defaults to false)
History:

2008-04-28 Tracie Sucharski, When calculating p_pixInc, set to 1 if values calculated is 0.

2008-12-30 Tracie Sucharski - If ground map returns pole make sure it is actually on the image.

2009-05-28 Stuart Sides - Added the quality argument.

Definition at line 210 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::Camera::BasicMapping(), Isis::UniversalGroundMap::Camera(), Isis::Cube::fileName(), Fix360Poly(), Isis::Sensor::IgnoreElevationModel(), initCube(), p_brick, p_gMap, p_lineinc, p_pts, p_sampinc, Isis::IException::print(), Isis::IException::User, and WalkPoly().

Referenced by Isis::Shape::createFootprint(), and Isis::Image::createFootprint().

◆ DistanceSquared()

double Isis::ImagePolygon::DistanceSquared ( const geos::geom::Coordinate *  p1,
const geos::geom::Coordinate *  p2 
)
private

Calculates the distance squared between two coordinates.

Parameters
p1The first Coordinate for the calculation
p2The second Coordinate for the calculation

return The distance squared between the Coordinates

Definition at line 1390 of file ImagePolygon.cpp.

Referenced by FixPolePoly(), and WalkPoly().

◆ EllipsoidLimb()

void Isis::ImagePolygon::EllipsoidLimb ( bool  ellip)
inline

If a limb is detected, use un ellipsoid shape model if true.

If false, use the default (spiceinit defined) shape model.

Parameters
ellipTrue to use ellipsoid on limb images

Definition at line 203 of file ImagePolygon.h.

References p_ellipsoid.

◆ Emission()

void Isis::ImagePolygon::Emission ( double  emission)
inline

Set the maximum emission angle ( light refleted to camera )

Parameters
emissionThe maximum valid emission angle

Definition at line 185 of file ImagePolygon.h.

References p_emission.

◆ Find()

void Isis::Blob::Find ( const Pvl pvl)
protectedinherited

This method searches the given Pvl for the Blob by the Blob's type and name.

If found, the start byte, number of bytes are read from the Pvl. Also, if a keyword label pointer is found, the filename for the detached blob is stored and the pointer is removed from the blob pvl.

Parameters
pvlThe Pvl to be searched

Definition at line 179 of file Blob.cpp.

References _FILEINFO_, Isis::PvlContainer::isNamed(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::FileName::path().

◆ FindBestPoint()

geos::geom::Coordinate Isis::ImagePolygon::FindBestPoint ( geos::geom::Coordinate *  currentPoint,
geos::geom::Coordinate  newPoint,
geos::geom::Coordinate  lastPoint 
)
private

While walking the image in sample/line space, this function finds the best valid point between the first valid point found and the last point which failed its validity test using a linear search.

Parameters
currentPointThe last point added to the polygon
newPointThe first valid point found for the next step.
lastPointThe last point that was found to be invalid which checking for the next step.
Returns
geos::geom::Coordinate The valid point found via searching between the provided points.

Definition at line 1424 of file ImagePolygon.cpp.

References FixCornerSkip(), p_cubeLines, p_cubeSamps, p_cubeStartLine, p_cubeStartSamp, p_lineinc, p_sampinc, and SetImage().

Referenced by FindNextPoint().

◆ FindFirstPoint()

geos::geom::Coordinate Isis::ImagePolygon::FindFirstPoint ( )
private

Finds the first point that projects in an image.

Returns
geos::geom::Coordinate A starting point that is on the edge of the polygon.

Definition at line 502 of file ImagePolygon.cpp.

References _FILEINFO_, FindNextPoint(), p_cubeLines, p_cubeSamps, p_cubeStartLine, p_cubeStartSamp, SetImage(), and Isis::IException::User.

Referenced by WalkPoly().

◆ FindNextPoint()

geos::geom::Coordinate Isis::ImagePolygon::FindNextPoint ( geos::geom::Coordinate *  currentPoint,
geos::geom::Coordinate  lastPoint,
int  recursionDepth = 0 
)
private

Finds the next point on the image using a left hand rule walking algorithm.

To initiate the walk pass it the same point for both currentPoint and lastPoint.

Parameters
[in]currentPoint(geos::geom::Coordinate *currentPoint) This is the currentPoint in the path. You are looking for its successor.
[in]lastPoint(geos::geom::Coordinate lastPoint) This is the lastPoint in the path, it allows the algorithm to calculate direction.
[in]recursionDepth(int) This optional parameter keeps track of how far it has walked around a point. By default it is zero.

throws Isis::iException::Programmer - Error walking the file

Definition at line 291 of file ImagePolygon.cpp.

References _FILEINFO_, FindBestPoint(), InsideImage(), MoveBackInsideImage(), p_lineinc, p_sampinc, Isis::IException::Programmer, SetImage(), and Isis::IException::Unknown.

Referenced by FindFirstPoint(), and WalkPoly().

◆ FindSubpixel()

void Isis::ImagePolygon::FindSubpixel ( std::vector< geos::geom::Coordinate > &  points)
private

Takes p_polygons in sample/line space and finds its subpixel accuracy.

This algorithm depends on a left-hand-turn algorithm and assumes that the vector of Coordinates provided is not empty.

Parameters
pointsThe vector of Coordinate to set to subpixel accuracy

Definition at line 1545 of file ImagePolygon.cpp.

References InsideImage(), p_lineinc, p_sampinc, p_subpixelAccuracy, and SetImage().

Referenced by WalkPoly().

◆ Fix360Poly()

void Isis::ImagePolygon::Fix360Poly ( )
private

If the cube crosses the 0/360 boundary and does not include a pole, the polygon is separated into multiple polygons, usually one on each side of the boundary.

These polygons are put into a geos Multipolygon. If the cube does not cross the 0/360 boundary then the Multipolygon will be a single Polygon.

Definition at line 1116 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::PolygonTools::Intersect(), Isis::PolygonTools::MakeMultiPolygon(), p_polygons, p_pts, Isis::IException::Unknown, and Isis::IException::what().

Referenced by Create().

◆ FixCornerSkip()

geos::geom::Coordinate Isis::ImagePolygon::FixCornerSkip ( geos::geom::Coordinate *  currentPoint,
geos::geom::Coordinate  newPoint 
)
private

Looks at the next possible point relative to the lasts and attempts to adjust the point outward to grab valid corner data.

Parameters
currentPointThe last valid point added to the polygon
newPointThe new point to be added to the polygon
Returns
geos::geom::Coordinate The new point modified for a better result

Definition at line 1489 of file ImagePolygon.cpp.

References p_cubeLines, p_cubeSamps, p_lineinc, p_sampinc, and SetImage().

Referenced by FindBestPoint().

◆ FixPolePoly()

void Isis::ImagePolygon::FixPolePoly ( std::vector< geos::geom::Coordinate > *  crossingPoints)
private

If the cube crosses the 0/360 boundary and contains a pole, Some points are added to allow the polygon to unwrap properly.

Throws an error if both poles are in the image. Returns if there is no pole in the image.

Parameters
crossingPointsThe coordinate sequence that crosses the 0/360 boundry

Definition at line 810 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::UniversalGroundMap::Camera(), DistanceSquared(), Isis::Sensor::EmissionAngle(), Isis::Sensor::IncidenceAngle(), Isis::Camera::Line(), Isis::Null, p_emission, p_gMap, p_incidence, p_pts, Isis::IException::Programmer, Isis::UniversalGroundMap::Projection(), Isis::Camera::Sample(), Isis::UniversalGroundMap::SetUniversalGround(), Isis::Projection::WorldX(), and Isis::Projection::WorldY().

Referenced by WalkPoly().

◆ getLinc()

int Isis::ImagePolygon::getLinc ( ) const
inline

Return the line increment used the create this polygon.

Definition at line 234 of file ImagePolygon.h.

References p_lineinc.

◆ getSinc()

int Isis::ImagePolygon::getSinc ( ) const
inline

Return the sample increment used the create this polygon.

Definition at line 229 of file ImagePolygon.h.

References p_sampinc.

◆ Incidence()

void Isis::ImagePolygon::Incidence ( double  incidence)
inline

Set the maximum incidence angle ( light contacting the planet )

Parameters
incidenceThe maximum valid incidence angle

Definition at line 193 of file ImagePolygon.h.

References p_incidence.

◆ initCube()

Camera * Isis::ImagePolygon::initCube ( Cube cube,
int  ss = 1,
int  sl = 1,
int  ns = 0,
int  nl = 0,
int  band = 1 
)

Create a Polygon from given cube.

Parameters
[in]cube(Cube &) Cube used to create polygon
[in]ss(Default=1) (in) Starting sample number
[in]sl(Default=1) (in) Starting Line number
[in]ns(Default=0) (in) Number of samples used to create the polygon. Default of 0 will cause ns to be set to the number of samples in the cube.
[in]nl(Default=0) (in) Number of lines used to create the polygon. Default of 0 will cause nl to be set to the number of lines in the cube.
[in]band(Default=1) (in) Image band number

Definition at line 114 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::IException::append(), Isis::UniversalGroundMap::Camera(), Isis::Cube::camera(), Isis::Cube::fileName(), Isis::Camera::HasProjection(), Isis::Sensor::IgnoreElevationModel(), IsLimb(), Isis::Cube::lineCount(), p_brick, p_cube, p_cubeLines, p_cubeSamps, p_cubeStartLine, p_cubeStartSamp, p_ellipsoid, p_gMap, p_isProjected, Isis::Cube::pixelType(), Isis::Cube::projection(), Isis::Cube::sampleCount(), Isis::UniversalGroundMap::SetBand(), and Isis::IException::User.

Referenced by Create().

◆ InsideImage()

bool Isis::ImagePolygon::InsideImage ( double  sample,
double  line 
)
private

This returns true if sample/line are inside the cube.

Parameters
sample
line
Returns
bool

Definition at line 488 of file ImagePolygon.cpp.

References p_cubeLines, p_cubeSamps, p_cubeStartLine, and p_cubeStartSamp.

Referenced by FindNextPoint(), and FindSubpixel().

◆ IsLimb()

bool Isis::ImagePolygon::IsLimb ( )
private

Returns True when the input image is a limb image.

Returns
bool True if any of the 4 corners of the input image cannot be set

Definition at line 1400 of file ImagePolygon.cpp.

References p_cubeLines, p_cubeSamps, and SetImage().

Referenced by initCube().

◆ Label()

◆ MoveBackInsideImage()

void Isis::ImagePolygon::MoveBackInsideImage ( double &  sample,
double &  line,
double  sinc,
double  linc 
)
private

This method ensures sample/line after sinc/linc have been applied is inside the image.

If not, it snaps to the edge of the image - given we didn't start at the edge.

Parameters
sampleSample after sinc applied
lineLine after linc applied
sincSample increment (we can back up at most this much)
lincLine increment (we can back up at most this much)

Definition at line 420 of file ImagePolygon.cpp.

References p_cubeLines, p_cubeSamps, p_cubeStartLine, and p_cubeStartSamp.

Referenced by FindNextPoint().

◆ Name()

QString Isis::Blob::Name ( ) const
inherited

Accessor method that returns a string containing the Blob name.

Returns
string The name of the blob.

Definition at line 149 of file Blob.cpp.

Referenced by Isis::Shape::isFootprintable(), Isis::Image::isFootprintable(), Isis::SpicePosition::LoadCache(), and Isis::Cube::write().

◆ Polys()

geos::geom::MultiPolygon* Isis::ImagePolygon::Polys ( )
inline

◆ Read() [1/3]

void Isis::Blob::Read ( const QString &  file)
inherited

This method reads Pvl values from a specified file.

Parameters
fileThe filename to read from.
Exceptions
iException::Io- Unable to open file
iException::Pvl- Invalid label format

Definition at line 243 of file Blob.cpp.

References _FILEINFO_, and Isis::Pvl::read().

Referenced by Isis::History::History(), Isis::OriginalLabel::OriginalLabel(), Isis::OriginalXmlLabel::OriginalXmlLabel(), Isis::History::Read(), Isis::Cube::read(), and Isis::Table::Table().

◆ Read() [2/3]

void Isis::Blob::Read ( const QString &  file,
const Pvl pvlLabels 
)
inherited

This method reads the given a file and labels.

Parameters
fileThe filename to read from.
pvlLabelsA Pvl containing the label information.
Exceptions
iException::Io- Unable to open file

Definition at line 268 of file Blob.cpp.

References _FILEINFO_, and Isis::Message::FileOpen().

◆ Read() [3/3]

void Isis::Blob::Read ( const Pvl pvl,
std::istream &  istm 
)
virtualinherited

This method reads the Blob data from an open input file stream.

Parameters
pvlA Pvl containing the label information.
istmThe input file stream containing the blob data to be read.
Exceptions
iException::Io- Unable to open file

Reimplemented in Isis::History.

Definition at line 303 of file Blob.cpp.

References _FILEINFO_, and Isis::Message::FileOpen().

◆ ReadData()

void Isis::ImagePolygon::ReadData ( std::istream &  is)
protectedvirtual

Reads Multipolygon from cube blob.

Parameters
[in]is(std::fstream) Input stream to read from

throws Isis::IException::Io - Error reading data from stream

Reimplemented from Isis::Blob.

Definition at line 1323 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::IException::Io, Isis::PolygonTools::MakeMultiPolygon(), Isis::Blob::p_blobName, Isis::Blob::p_nbytes, p_polygons, p_polyStr, Isis::Blob::p_startByte, and Isis::Blob::p_type.

◆ ReadInit()

void Isis::Blob::ReadInit ( )
protectedvirtualinherited

This virtual method for classes that inherit Blob.

It is not defined in the Blob class.

Reimplemented in Isis::Table.

Definition at line 330 of file Blob.cpp.

◆ SetImage()

bool Isis::ImagePolygon::SetImage ( const double  sample,
const double  line 
)
private

Sets the sample/line values of the cube to get lat/lon values.

This method checks whether the image pixel is Null for level 2 images and if so, it is considered an invalid pixel.

Parameters
[in]sample(const double) Sample coordinate of the cube
[in]line(const double) Line coordinate of the cube
Returns
bool Returns true if the image was set successfully and false if it was not or if pixel of level 2 images is NULL.

This check has been removed because it causes push frame cameras to fail inbetween the framelets, resulting in only the first framlet to be walked, leaving out the rest of the image.

This can cause autoseed/jigsaw issues, since they require conversion from lat/lon to samp/line

Definition at line 1054 of file ImagePolygon.cpp.

References Isis::UniversalGroundMap::Camera(), Isis::Sensor::EmissionAngle(), Isis::Sensor::IncidenceAngle(), Isis::IsNullPixel(), p_brick, p_cube, p_emission, p_gMap, p_incidence, p_isProjected, Isis::Cube::read(), Isis::Brick::SetBasePosition(), and Isis::UniversalGroundMap::SetImage().

Referenced by calcImageBorderCoordinates(), FindBestPoint(), FindFirstPoint(), FindNextPoint(), FindSubpixel(), FixCornerSkip(), IsLimb(), and WalkPoly().

◆ Size()

int Isis::Blob::Size ( ) const
inherited

Accessor method that returns the number of bytes in the blob data.

Returns
int Number of bytes in the blob data.

Definition at line 158 of file Blob.cpp.

◆ SubpixelAccuracy()

void Isis::ImagePolygon::SubpixelAccuracy ( int  div)
inline

The subpixel accuracy to use.

This accuracy is the number of binary steps to take to find the subpixel accuracy. A higher number provided gives more accurate results at the cost of runtime.

ImagePolygon's constructor sets a default value of 50

Parameters
divThe subpixel accuracy to use

Definition at line 216 of file ImagePolygon.h.

References p_subpixelAccuracy.

◆ Type()

QString Isis::Blob::Type ( ) const
inherited

Accessor method that returns a string containing the Blob type.

Returns
string Type of blob.

Definition at line 140 of file Blob.cpp.

Referenced by Isis::Shape::isFootprintable(), Isis::Image::isFootprintable(), and Isis::Cube::write().

◆ validLineDim()

double Isis::ImagePolygon::validLineDim ( )

Retuns the maximum valid line width of the cube set with either initCube() or Create()

Definition at line 544 of file ImagePolygon.cpp.

References calcImageBorderCoordinates(), m_botCoord, and m_topCoord.

◆ validSampleDim()

double Isis::ImagePolygon::validSampleDim ( )

Retuns the maximum valid sample width of the cube set with either initCube() or Create()

Definition at line 529 of file ImagePolygon.cpp.

References calcImageBorderCoordinates(), m_leftCoord, and m_rightCoord.

◆ WalkPoly()

void Isis::ImagePolygon::WalkPoly ( )
private

Walks the image finding its lon lat polygon and stores it to p_pts.

WARNING: Very large pixel increments for cubes that have cameras/projections with no data at any of the 4 corners can still fail in this algorithm.

If we have a very large polygon, look for the inability to find the starting point by looking for the first cycle in the polygon

"very large" is defined as 250 points

Definition at line 613 of file ImagePolygon.cpp.

References _FILEINFO_, DistanceSquared(), FindFirstPoint(), FindNextPoint(), FindSubpixel(), FixPolePoly(), p_cubeLines, p_cubeSamps, p_gMap, p_lineinc, p_pts, p_sampinc, Isis::IException::Programmer, SetImage(), Isis::UniversalGroundMap::UniversalLatitude(), and Isis::UniversalGroundMap::UniversalLongitude().

Referenced by Create().

◆ Write() [1/2]

void Isis::Blob::Write ( const QString &  file)
inherited

Write the blob data out to a file.

Parameters
fileThe filename to write to.
Exceptions
IException::Io- Unable to open file
IException::Io- Error preparing to write data to file
IException::Io- Error creating file

Definition at line 369 of file Blob.cpp.

References _FILEINFO_, Isis::PvlObject::addObject(), Isis::PvlObject::findObject(), Isis::toString(), and Isis::Pvl::write().

Referenced by Isis::Cube::write().

◆ Write() [2/2]

void Isis::Blob::Write ( Pvl pvl,
std::fstream &  stm,
const QString &  detachedFileName = "" 
)
inherited

Write the blob data out to a Pvl object.

Parameters
pvlThe pvl object to update
stmstream to write data to
detachedFileNameIf the stream is detached from the labels give the name of the file

Definition at line 418 of file Blob.cpp.

References Isis::PvlObject::addObject(), Isis::PvlContainer::name(), Isis::PvlObject::object(), Isis::PvlObject::objects(), and Isis::toString().

◆ WriteData()

void Isis::ImagePolygon::WriteData ( std::fstream &  os)
protectedvirtual

Writes polygon to cube blob.

Parameters
[in]os(std::fstream &) Output steam blob data will be written to
Exceptions
Isis::iException::Io- Error writing data to stream

Reimplemented from Isis::Blob.

Definition at line 1377 of file ImagePolygon.cpp.

References Isis::Blob::p_nbytes, and p_polyStr.

◆ WriteInit()

void Isis::ImagePolygon::WriteInit ( )
protectedvirtual

Initializes for writing polygon to cube blob.

Reimplemented from Isis::Blob.

Definition at line 1355 of file ImagePolygon.cpp.

References _FILEINFO_, Isis::Blob::p_nbytes, p_polygons, p_polyStr, and Isis::IException::Programmer.

Member Data Documentation

◆ m_botCoord

geos::geom::Coordinate* Isis::ImagePolygon::m_botCoord
private

The cube's bot-most valid coord.

Definition at line 288 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), ImagePolygon(), validLineDim(), and ~ImagePolygon().

◆ m_leftCoord

geos::geom::Coordinate* Isis::ImagePolygon::m_leftCoord
private

The cube's left-most valid coord.

Definition at line 285 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), ImagePolygon(), validSampleDim(), and ~ImagePolygon().

◆ m_rightCoord

geos::geom::Coordinate* Isis::ImagePolygon::m_rightCoord
private

The cube's right-most valid coord.

Definition at line 286 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), ImagePolygon(), validSampleDim(), and ~ImagePolygon().

◆ m_topCoord

geos::geom::Coordinate* Isis::ImagePolygon::m_topCoord
private

The cube's top-most valid coord.

Definition at line 287 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), ImagePolygon(), validLineDim(), and ~ImagePolygon().

◆ p_blobName

QString Isis::Blob::p_blobName
protectedinherited

Name of the Blob object.

Definition at line 95 of file Blob.h.

Referenced by Isis::Blob::Blob(), Isis::Table::operator+=(), Isis::Blob::operator=(), Isis::Table::ReadData(), and ReadData().

◆ p_blobPvl

◆ p_brick

Brick* Isis::ImagePolygon::p_brick
private

Used to check for valid DNs.

Definition at line 275 of file ImagePolygon.h.

Referenced by Create(), initCube(), and SetImage().

◆ p_buffer

◆ p_cube

Cube* Isis::ImagePolygon::p_cube
private

The cube provided.

Definition at line 272 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), ImagePolygon(), initCube(), SetImage(), and ~ImagePolygon().

◆ p_cubeLines

int Isis::ImagePolygon::p_cubeLines
private

◆ p_cubeSamps

int Isis::ImagePolygon::p_cubeSamps
private

The number of samples in the cube.

Definition at line 292 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), FindBestPoint(), FindFirstPoint(), FixCornerSkip(), initCube(), InsideImage(), IsLimb(), MoveBackInsideImage(), and WalkPoly().

◆ p_cubeStartLine

int Isis::ImagePolygon::p_cubeStartLine
private

The the line of the first valid point in the cube.

Definition at line 291 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), FindBestPoint(), FindFirstPoint(), ImagePolygon(), initCube(), InsideImage(), and MoveBackInsideImage().

◆ p_cubeStartSamp

int Isis::ImagePolygon::p_cubeStartSamp
private

The the sample of the first valid point in the cube.

Definition at line 290 of file ImagePolygon.h.

Referenced by calcImageBorderCoordinates(), FindBestPoint(), FindFirstPoint(), ImagePolygon(), initCube(), InsideImage(), and MoveBackInsideImage().

◆ p_detached

QString Isis::Blob::p_detached
protectedinherited

Used for reading detached blobs.

Definition at line 101 of file Blob.h.

Referenced by Isis::Blob::Blob(), and Isis::Blob::operator=().

◆ p_ellipsoid

bool Isis::ImagePolygon::p_ellipsoid
private

Uses an ellipsoid if a limb is detected.

Definition at line 300 of file ImagePolygon.h.

Referenced by EllipsoidLimb(), ImagePolygon(), and initCube().

◆ p_emission

double Isis::ImagePolygon::p_emission
private

The maximum emission angle to consider valid.

Definition at line 298 of file ImagePolygon.h.

Referenced by Emission(), FixPolePoly(), ImagePolygon(), and SetImage().

◆ p_gMap

UniversalGroundMap* Isis::ImagePolygon::p_gMap
private

The cube's ground map.

Definition at line 283 of file ImagePolygon.h.

Referenced by Create(), FixPolePoly(), initCube(), SetImage(), and WalkPoly().

◆ p_incidence

double Isis::ImagePolygon::p_incidence
private

The maximum incidence angle to consider valid.

Definition at line 299 of file ImagePolygon.h.

Referenced by FixPolePoly(), ImagePolygon(), Incidence(), and SetImage().

◆ p_isProjected

bool Isis::ImagePolygon::p_isProjected
private

True when the provided cube is projected.

Definition at line 273 of file ImagePolygon.h.

Referenced by initCube(), and SetImage().

◆ p_labelFile

QString Isis::Blob::p_labelFile
protectedinherited

The file containing the labels.

Definition at line 102 of file Blob.h.

Referenced by Isis::Blob::Blob(), and Isis::Blob::operator=().

◆ p_lineinc

int Isis::ImagePolygon::p_lineinc
private

The increment for walking along the polygon in the line direcction.

Definition at line 296 of file ImagePolygon.h.

Referenced by Create(), FindBestPoint(), FindNextPoint(), FindSubpixel(), FixCornerSkip(), getLinc(), and WalkPoly().

◆ p_nbytes

◆ p_polygons

geos::geom::MultiPolygon* Isis::ImagePolygon::p_polygons
private

The multipolygon of the image.

Definition at line 279 of file ImagePolygon.h.

Referenced by Fix360Poly(), ImagePolygon(), Polys(), ReadData(), WriteInit(), and ~ImagePolygon().

◆ p_polyStr

std::string Isis::ImagePolygon::p_polyStr
private

The string representation of the polygon.

Definition at line 281 of file ImagePolygon.h.

Referenced by ReadData(), WriteData(), and WriteInit().

◆ p_pts

geos::geom::CoordinateSequence* Isis::ImagePolygon::p_pts
private

The sequence of coordinates that compose the boundry of the image.

Definition at line 277 of file ImagePolygon.h.

Referenced by Create(), Fix360Poly(), FixPolePoly(), and WalkPoly().

◆ p_sampinc

int Isis::ImagePolygon::p_sampinc
private

The increment for walking along the polygon in the sample direction.

Definition at line 295 of file ImagePolygon.h.

Referenced by Create(), FindBestPoint(), FindNextPoint(), FindSubpixel(), FixCornerSkip(), getSinc(), and WalkPoly().

◆ p_startByte

BigInt Isis::Blob::p_startByte
protectedinherited

Byte blob data starts at in buffer.

Definition at line 98 of file Blob.h.

Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), Isis::Table::ReadData(), and ReadData().

◆ p_subpixelAccuracy

int Isis::ImagePolygon::p_subpixelAccuracy
private

The subpixel accuracy to use.

Definition at line 302 of file ImagePolygon.h.

Referenced by FindSubpixel(), ImagePolygon(), and SubpixelAccuracy().

◆ p_type

QString Isis::Blob::p_type
protectedinherited

Type of data stored in the buffer.

Definition at line 100 of file Blob.h.

Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), and ReadData().


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