USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::ProcessPolygons Class Reference

#include <ProcessPolygons.h>

Inheritance diagram for Isis::ProcessPolygons:
Inheritance graph
Collaboration diagram for Isis::ProcessPolygons:
Collaboration graph

Public Member Functions

void SetStatCubes (const QString &parameter, const int nsamps, const int nlines, int nbands=1)
 
void SetStatCubes (const QString &avgFileName, const QString &countFileName, Isis::CubeAttributeOutput &atts, const int nsamps, const int nlines, int nbands=1)
 
void SetIntersectAlgorithm (const bool useCenter)
 Sets the algorithm for how output pixels are rasterized.
 
Isis::CubeAppendOutputCube (const QString &avgFileName, const QString &countFileName="")
 This gives the option to append to the cube.
 
void Rasterize (std::vector< double > &samples, std::vector< double > &lines, std::vector< double > &values)
 
void Rasterize (std::vector< double > &samples, std::vector< double > &lines, int &band, double &value)
 Rasterize multiband instruments where the bands have dependent geometry (i.e., the bands are not geometrically registered).
 
void EndProcess ()
 
void Finalize ()
 Cleans up by closing cubes and freeing memory for owned cubes.
 
virtual void StartProcess (void funct())
 In the base class, this method will invoked a user-specified function exactly one time.
 
virtual Isis::CubeSetInputCube (const QString &parameter, const int requirements=0)
 Opens an input cube specified by the user and verifies requirements are met.
 
virtual Isis::CubeSetInputCube (const QString &fname, const Isis::CubeAttributeInput &att, int requirements=0)
 Opens an input cube specified by the programmer and verifies requirements are met.
 
virtual void SetInputCube (Isis::Cube *inCube)
 Set the InputCube vector to an opened Cube which was dynamically allocated.
 
virtual Isis::CubeSetOutputCube (const QString &parameter)
 Allocates a user-specified output cube whose size matches the first input cube.
 
virtual Isis::CubeSetOutputCube (const QString &parameter, const int nsamps, const int nlines, const int nbands=1)
 Allocates a user specified output cube whose size is specified by the programmer.
 
virtual Isis::CubeSetOutputCube (const QString &fname, const Isis::CubeAttributeOutput &att, const int nsamps, const int nlines, const int nbands=1)
 Allocates a output cube whose name and size is specified by the programmer.
 
void AddInputCube (Cube *cube, bool owned=true)
 
void AddOutputCube (Cube *cube, bool owned=true)
 
void ClearCubes ()
 Close owned cubes from the list and clear the list.
 
void ClearInputCubes ()
 Close owned input cubes from the list and clear the list.
 
void ClearOutputCubes ()
 Close owned output cubes from the list and clear the list.
 
void PropagateLabels (const bool prop)
 This method allows the programmer to turn on/off the propagation of labels from the 1st input cube to any of the output cubes.
 
void PropagateLabels (const QString &cube)
 This method allows the programmer to propagate labels from a specific secondary cube.
 
void PropagateTables (const bool prop)
 This method allows the programmer to propagate input tables to the output cube (default is true)
 
void PropagateTables (const QString &fromName)
 Propagate the tables from the cube with the given filename to the output cube.
 
void PropagatePolygons (const bool prop)
 This method allows the programmer to propagate input blobs to the output cube (default is true)
 
void PropagateHistory (const bool prop)
 This method allows the programmer to propagate history to the output cube (default is true)
 
void PropagateOriginalLabel (const bool prop)
 This method allows the programmer to propagate original labels to the output cube (default is true)
 
Isis::ProgressProgress ()
 This method returns a pointer to a Progress object.
 
QString MissionData (const QString &mission, const QString &file, bool highestVersion=false)
 This method reads the mission specific data directory from the user preference file, makes sure that mission is available in the Isis installation, and the attaches the provided input file to the directory in order to create a full file specification.
 
void WriteHistory (Cube &cube)
 Writes out the History blob to the cube.
 
void CalculateStatistics ()
 Calculates and stores off statistics on every band of every cube added to this process via the SetInputCube method.
 
std::vector< Isis::Statistics * > BandStatistics (const unsigned index)
 Get the vector of Statistics objects for each band separately of a specified input cube.
 
Isis::StatisticsCubeStatistics (const unsigned index)
 Get the Statistics object for all bands of a specified input cube.
 

Protected Attributes

Isis::Progressp_progress
 Pointer to a Progress object.
 
bool p_propagateLabels
 Flag indicating if labels are be propagated to output cubes.
 
bool p_propagateTables
 Flag indicating if tables are be propagated to output cubes.
 
bool p_propagatePolygons
 Flag indicating if blobs are be propagated to output cubes.
 
bool p_propagateHistory
 Flag indicating if history is to be propagated to output cubes.
 
bool p_propagateOriginalLabel
 Flag indicating if original lable is to be propagated to output cubes.
 
std::vector< std::vector
< Isis::Statistics * > > 
p_bandStats
 Holds the calculated statistics for each band separately of every input cubei after the CalculateStatistics method is called.
 
std::vector< Isis::Statistics * > p_cubeStats
 Holds the calculated statistics for every band together of every input cubei after the CalculateStatistics method is called.
 
std::vector< Isis::Cube * > InputCubes
 A vector of pointers to opened Cube objects.
 
std::vector< Isis::Cube * > OutputCubes
 A vector of pointers to allocated Cube objects.
 
QSet< Isis::Cube * > * m_ownedCubes
 A list of cubes owned by this instant.
 

Private Member Functions

void FillPolygon (int Flag)
 This method does the actuall reading and writing to the cube file.
 
void GetPolygonCoords ()
 

Private Attributes

bool m_useCenter
 
std::vector< double > m_sampleVertices
 
std::vector< double > m_lineVertices
 
std::vector< double > m_dns
 
int m_band
 
Brickm_average
 
Brickm_count
 
geos::geom::Polygon * m_imagePoly
 

Detailed Description

Author
2007-12-07 Stacy Alley
History:

2010-02-26 Steven Lambright - Now using a geometry snapper on points before testing if they are inside a polygon inside DoWork(...).

2012-02-24 Steven Lambright - Added Finalize()

2013-03-27 Jeannie Backer - Added programmer comments. References #1248.

2013-02-06 Tracie Sucharski - Improved speed by adding BoxcarCaching Algorithm for I/O, using prepared polygons for the intersections and read/write the entire spectra for the input pixel rather than one band at a time. References #1289.

2013-09-10 Stuart Sides, Tracie Sucharski - Cleaned up code, added additional error checks for valid polygons, added option to check for either input pixel intersecting the center of the output pixel or any part of the output pixel. References #1604.

2015-01-19 Sasha Brownsberger - Changed name of SetOutputCube function to SetStatCubes function to better reflect the command functionality and to avoid conflicts with Process::SetOutputCube virtual function. References #2215.

Definition at line 40 of file ProcessPolygons.h.

Member Function Documentation

Isis::Cube * Isis::ProcessPolygons::AppendOutputCube ( const QString &  avgFileName,
const QString &  countFileName = "" 
)

This gives the option to append to the cube.

Parameters
avgFileName
countFileName
Returns
Isis::Cube*

Definition at line 269 of file ProcessPolygons.cpp.

References Isis::Cube::open(), and Isis::FileName::path().

std::vector<Isis::Statistics *> Isis::Process::BandStatistics ( const unsigned  index)
inlineinherited

Get the vector of Statistics objects for each band separately of a specified input cube.

Parameters
indexThe index of the input cube in InputCubes
Returns
vector<Statistics*> A list of statistics ordered by band

Definition at line 283 of file Process.h.

References Isis::Process::p_bandStats.

void Isis::Process::CalculateStatistics ( )
inherited

Calculates and stores off statistics on every band of every cube added to this process via the SetInputCube method.

The newly calculated statistics are stored in two ways: as a vector where each entry is a single Statistics object for every band of a particular input cube, and as a vector where each entry is a vector of Statistics objects, for each band separately, of a particular input cube.

Definition at line 721 of file Process.cpp.

References Isis::Statistics::AddData(), Isis::Cube::bandCount(), Isis::Progress::CheckStatus(), Isis::Buffer::DoubleBuffer(), Isis::Cube::lineCount(), Isis::Cube::read(), Isis::LineManager::SetLine(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::Buffer::size(), and Isis::toString().

void Isis::Process::ClearCubes ( )
inherited

Close owned cubes from the list and clear the list.

Definition at line 506 of file Process.cpp.

void Isis::Process::ClearInputCubes ( )
inherited

Close owned input cubes from the list and clear the list.

Definition at line 516 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), Isis::FileTool::saveAsReducedCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::ClearOutputCubes ( )
inherited

Close owned output cubes from the list and clear the list.

Definition at line 530 of file Process.cpp.

Isis::Statistics* Isis::Process::CubeStatistics ( const unsigned  index)
inlineinherited

Get the Statistics object for all bands of a specified input cube.

Parameters
indexThe index of the input cube in InputCubes
Returns
Statistics* Collections of statistics gathered on all bands

Definition at line 297 of file Process.h.

References Isis::Process::p_cubeStats.

void Isis::ProcessPolygons::EndProcess ( )
virtual
Deprecated:
Please use Finalize()

Reimplemented from Isis::Process.

Definition at line 239 of file ProcessPolygons.cpp.

void Isis::ProcessPolygons::FillPolygon ( int  Flag)
private

This method does the actuall reading and writing to the cube file.

The Flag parameter is there to help out where the two Rasterize method need to behave differently during this operation. Most notibly, when we set the position of the bricks and when we are calculating the average using the given value or values.

Parameters
Flag

Definition at line 83 of file ProcessPolygons.cpp.

References _FILEINFO_, Isis::IsValidPixel(), and Isis::Null.

void Isis::ProcessPolygons::Finalize ( )
virtual

Cleans up by closing cubes and freeing memory for owned cubes.

Clears the lists for all cubes.

Reimplemented from Isis::Process.

Definition at line 252 of file ProcessPolygons.cpp.

QString Isis::Process::MissionData ( const QString &  mission,
const QString &  file,
bool  highestVersion = false 
)
inherited

This method reads the mission specific data directory from the user preference file, makes sure that mission is available in the Isis installation, and the attaches the provided input file to the directory in order to create a full file specification.

Parameters
missionName of the mission data directory
fileName of the file to attach to the end of the directory
highestVersionIf set to true the method will return the highest version number of the given file. Therefore, file must contain question marks such as "file???.dat". See the FileName class for more information on versioned files. Defaults to false.

Definition at line 666 of file Process.cpp.

References _FILEINFO_, and Isis::PvlObject::findGroup().

Isis::Progress* Isis::Process::Progress ( )
inlineinherited

This method returns a pointer to a Progress object.

Returns
Progress*

Definition at line 263 of file Process.h.

References Isis::Process::p_progress.

Referenced by Isis::Equalization::calculateStatistics(), Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagateHistory ( const bool  prop)
inherited

This method allows the programmer to propagate history to the output cube (default is true)

Parameters
propFlag indicating if history is to be propagated to output cubes.

Definition at line 635 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagateLabels ( const bool  prop)
inherited

This method allows the programmer to turn on/off the propagation of labels from the 1st input cube to any of the output cubes.

By default, propagation occurs automatically in the Process class when a call to either of the SetOutputCube methods is invoked. If the program * requires no propagation then utilize this method. This method can be invoked between successive calls of SetOutputCube so that some cube will have labels propagated while others will not.

Parameters
propFlag indicating if labels are be propagated to output cubes.

Definition at line 552 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagateLabels ( const QString &  cube)
inherited

This method allows the programmer to propagate labels from a specific secondary cube.

Parameters
cubeIString containing the name of the cube containing the labels to propagate.

Definition at line 563 of file Process.cpp.

References Isis::PvlObject::addGroup(), Isis::PvlObject::addObject(), Isis::PvlObject::findObject(), Isis::PvlObject::group(), Isis::PvlObject::groups(), and Isis::PvlObject::hasObject().

void Isis::Process::PropagateOriginalLabel ( const bool  prop)
inherited

This method allows the programmer to propagate original labels to the output cube (default is true)

Parameters
propFlag indicating if original labels is to be propagated to output cubes.

Definition at line 646 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagatePolygons ( const bool  prop)
inherited

This method allows the programmer to propagate input blobs to the output cube (default is true)

Parameters
propFlag indicating if input blobs are to be propagated to output cubes.

Definition at line 625 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagateTables ( const bool  prop)
inherited

This method allows the programmer to propagate input tables to the output cube (default is true)

Parameters
propFlag indicating if input tables are to be propagated to output cubes.

Definition at line 591 of file Process.cpp.

Referenced by Isis::ProcessMapMosaic::RingsSetOutputCube(), and Isis::ProcessMapMosaic::SetOutputCube().

void Isis::Process::PropagateTables ( const QString &  fromName)
inherited

Propagate the tables from the cube with the given filename to the output cube.

This is done at the time this method is called, not during normal processing.

Definition at line 600 of file Process.cpp.

References Isis::Cube::label(), Isis::PvlObject::object(), Isis::PvlObject::objects(), Isis::Cube::open(), and Isis::Cube::read().

void Isis::ProcessPolygons::Rasterize ( std::vector< double > &  samples,
std::vector< double > &  lines,
std::vector< double > &  values 
)
Parameters
samples
lines
values

Definition at line 38 of file ProcessPolygons.cpp.

void Isis::ProcessPolygons::Rasterize ( std::vector< double > &  samples,
std::vector< double > &  lines,
int &  band,
double &  value 
)

Rasterize multiband instruments where the bands have dependent geometry (i.e., the bands are not geometrically registered).

Parameters
samples
lines
band
value

Definition at line 59 of file ProcessPolygons.cpp.

Isis::Cube * Isis::Process::SetInputCube ( const QString &  parameter,
const int  requirements = 0 
)
virtualinherited

Opens an input cube specified by the user and verifies requirements are met.

Returns
Cube*
Parameters
parameterUser parameter to obtain file to open. Typically, the value is "FROM". For example, the user can specify on the command line FROM=myfile.cub and this method will attempt to open the cube "myfile.cub" if the parameter was set to "FROM".
requirementsUse to specify requirements for the input file. The following are requirments are checked against 1) ic_base::SizeMatch checks to make sure the input cube has the same bands, samples, and lines as the first input cube open using this method, 2) ic_base::SpatialMatch checks to make sure the input cube has the same samples and lines as the first input cube, 3) ic_base::Georeferenced checks to make sure latitude/longitudes can be obtained from the input cube, 4) ic_base::FullyGeoreferenced checks to make sure latitude/longitude, phase/incidence/emission, and other geometric parameters can be obtained from the input cube, 5) ic_base::OneBand checks to make sure the input cube has exactly one band. Note, that these requirements can be logically or'ed. For example, ic_base::SpatialMatch | ic_base::georeferenced. Defaults to 0
Exceptions
Isis::iException::Message

Reimplemented in Isis::ProcessByBrick, Isis::ProcessByLine, Isis::ProcessBySpectra, and Isis::ProcessBySample.

Definition at line 243 of file Process.cpp.

Referenced by Isis::ImageExporter::addChannel(), Isis::FileTool::saveAsEnlargedCube(), and Isis::ProcessGroundPolygons::SetStatCubes().

Isis::Cube * Isis::Process::SetInputCube ( const QString &  fname,
const Isis::CubeAttributeInput att,
int  requirements = 0 
)
virtualinherited

Opens an input cube specified by the programmer and verifies requirements are met.

Parameters
fnameProgrammer specified work file. For example, "myfile.cub".
attThe cube attributes to use when opening the input cube.
requirementsSame as requirements on SetInputCube. See that method for more details. Defaults to 0
Returns
Cube*
Exceptions
Isis::iException::Message

Reimplemented in Isis::ProcessByBrick.

Definition at line 82 of file Process.cpp.

References _FILEINFO_, Isis::Cube::bandCount(), Isis::CubeAttributeInput::bands(), Isis::Cube::lineCount(), Isis::Cube::open(), Isis::Cube::sampleCount(), and Isis::Cube::setVirtualBands().

void Isis::Process::SetInputCube ( Isis::Cube inCube)
virtualinherited

Set the InputCube vector to an opened Cube which was dynamically allocated.

This is used if there already exists a valid opened cube

Author
Sharmila Prasad (5/7/2011)
Parameters
inCube- Pointer to input Cube

Reimplemented in Isis::ProcessByLine.

Definition at line 201 of file Process.cpp.

References _FILEINFO_, and Isis::Cube::isOpen().

void Isis::ProcessPolygons::SetIntersectAlgorithm ( const bool  useCenter)

Sets the algorithm for how output pixels are rasterized.

Parameters
useCenter

Definition at line 374 of file ProcessPolygons.cpp.

Isis::Cube * Isis::Process::SetOutputCube ( const QString &  parameter)
virtualinherited

Allocates a user-specified output cube whose size matches the first input cube.

Returns
Cube*
Parameters
parameterUser specified output file. For example, "TO" is a popular user parameter. If the user specified TO=output.cub, then this routine would allocate the file output.cub with size specified by the first opened input cube. The output pixel type will be propagated from the first loaded input cube or will use the value in the application XML file for pixelType.
Exceptions
Isis::iException::Message

Reimplemented in Isis::ProcessMosaic, Isis::ProcessImport, and Isis::ProcessMapMosaic.

Definition at line 266 of file Process.cpp.

References _FILEINFO_.

Referenced by Isis::FileTool::saveAsEnlargedCube(), and Isis::ProcessImport::SetOutputCube().

Isis::Cube * Isis::Process::SetOutputCube ( const QString &  parameter,
const int  ns,
const int  nl,
const int  nb = 1 
)
virtualinherited

Allocates a user specified output cube whose size is specified by the programmer.

Returns
Cube*
Parameters
parameterUser specified output file. For example, "TO" is a popular user parameter. If the user specified TO=output.cub, then this routine would allocate the file output.cub with size specified by the first opened input cube. The output pixel type will be propagated from the first loaded input cube or will use the value in the application XML file for pixelType.
nsNumber of samples to allocate
nlNumber of lines to allocate
nbNumber of bands to allocate
Exceptions
Isis::iException::Message

Definition at line 302 of file Process.cpp.

References _FILEINFO_.

Isis::Cube * Isis::Process::SetOutputCube ( const QString &  fname,
const Isis::CubeAttributeOutput att,
const int  ns,
const int  nl,
const int  nb = 1 
)
virtualinherited
void Isis::ProcessPolygons::SetStatCubes ( const QString &  parameter,
const int  nsamps,
const int  nlines,
int  nbands = 1 
)
Parameters
parameter
nsamps
nlines
nbands

Definition at line 349 of file ProcessPolygons.cpp.

References Isis::FileName::path().

void Isis::ProcessPolygons::SetStatCubes ( const QString &  avgFileName,
const QString &  countFileName,
Isis::CubeAttributeOutput atts,
const int  nsamps,
const int  nlines,
int  nbands = 1 
)
Parameters
avgFileName
countFileName
nsamps
nlines
nbands

Definition at line 311 of file ProcessPolygons.cpp.

virtual void Isis::Process::StartProcess ( void   funct())
inlinevirtualinherited

In the base class, this method will invoked a user-specified function exactly one time.

In derived classes such as ProcessByLine, the StartProcess will invoke a user-specified function for every line in a cube.

Parameters
funct()Name of your processing function

Definition at line 221 of file Process.h.

void Isis::Process::WriteHistory ( Cube cube)
inherited

Member Data Documentation

QSet<Isis::Cube *>* Isis::Process::m_ownedCubes
protectedinherited

A list of cubes owned by this instant.

These cubes will be deleted on finalization. Process will not take ownership of cubes allocated outside of Process. It is the caller's responsibility to delete such cubes.

Definition at line 207 of file Process.h.

std::vector<Isis::Cube *> Isis::Process::OutputCubes
protectedinherited
std::vector< std::vector< Isis::Statistics * > > Isis::Process::p_bandStats
protectedinherited

Holds the calculated statistics for each band separately of every input cubei after the CalculateStatistics method is called.

Definition at line 180 of file Process.h.

Referenced by Isis::Process::BandStatistics().

std::vector< Isis::Statistics * > Isis::Process::p_cubeStats
protectedinherited

Holds the calculated statistics for every band together of every input cubei after the CalculateStatistics method is called.

Definition at line 187 of file Process.h.

Referenced by Isis::Process::CubeStatistics().

bool Isis::Process::p_propagateHistory
protectedinherited

Flag indicating if history is to be propagated to output cubes.

Definition at line 169 of file Process.h.

bool Isis::Process::p_propagateLabels
protectedinherited

Flag indicating if labels are be propagated to output cubes.

Definition at line 157 of file Process.h.

bool Isis::Process::p_propagateOriginalLabel
protectedinherited

Flag indicating if original lable is to be propagated to output cubes.

Definition at line 173 of file Process.h.

bool Isis::Process::p_propagatePolygons
protectedinherited

Flag indicating if blobs are be propagated to output cubes.

Definition at line 165 of file Process.h.

bool Isis::Process::p_propagateTables
protectedinherited

Flag indicating if tables are be propagated to output cubes.

Definition at line 161 of file Process.h.


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