本文整理汇总了C++中Cube::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::Close方法的具体用法?C++ Cube::Close怎么用?C++ Cube::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::Close方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main () {
Isis::Preference::Preferences(true);
/**
* @brief Test ImagePolygon object for accuracy and correct behavior.
*
* @author 2005-11-22 Tracie Sucharski
*
* @history 2007-01-19 Tracie Sucharski, Removed ToGround method (for now)
* because of round off problems going back and forth between
* lat/lon,line/samp.
* @history 2007-01-31 Tracie Sucharski, Added WKT method to return polygon
* in string as WKT.
* @history 2007-11-09 Tracie Sucharski, Remove WKT method, geos now has
* a method to return a WKT string.
* @history 2007-11-20 Tracie Sucharski, Added test for sub-polys
*/
// simple MOC image
string inFile = "/usgs/cpkgs/isis3/data/mgs/testData/ab102401.cub";
//string inFile = "/work1/tsucharski/poly/I17621017RDR_lev2.cub";
// same MOC image, but sinusoidal projection
//string inFile = "/farm/prog1/tsucharski/isis3/ab102401.lev2.cub";
// same MOC image, but sinusoidal projection , doctored left edge
//string inFile = "/farm/prog1/tsucharski/isis3/ab102401.lev2.leftTrim.cub";
// MOC north pole image
//string inFile = "/work1/tsucharski/isis3/poly/e0202226.lev1.cub";
// MOC image with 0/360 boundary
// orkin
//string inFile = "/farm/prog1/tsucharski/isis3/cubes/m0101631.lev1.cub";
// blackflag
//string inFile = "/work1/tsucharski/isis3/poly/m0101631.lev1.cub";
// galileo ssi image
//string inFile = "/farm/prog1/tsucharski/isis3/6700r.cub";
// Open the cube
Cube cube;
Cube cube1;
cube.Open(inFile,"r");
ImagePolygon poly;
try {
poly.Create(cube);
}
catch (iException &e) {
std::string msg = "Cannot create polygon for [" + cube.Filename() + "]";
throw iException::Message(iException::Programmer,msg,_FILEINFO_);
}
// write poly as WKT
std::cout<< poly.Polys()->toString()<<std::endl;
// Test sub-poly option
try {
poly.Create(cube,12,1,384,640,385);
}
catch (iException &e) {
std::string msg = "Cannot create sub-polygon for [" + cube.Filename() + "]";
throw iException::Message(iException::Programmer,msg,_FILEINFO_);
}
// write poly as WKT
std::cout<< poly.Polys()->toString()<<std::endl;
// Test lower quality option
try {
poly.Create(cube,10,12,1,384,640,385);
}
catch (iException &e) {
std::string msg = "Cannot create lower quality polygon for [" + cube.Filename() + "]";
throw iException::Message(iException::Programmer,msg,_FILEINFO_);
}
// write poly as WKT
std::cout<< poly.Polys()->toString()<<std::endl;
cube.Close();
}
示例2: IsisMain
//.........这里部分代码省略.........
imageValid &= stats->StandardDeviation() <= maxStdev;
vector<double> fileStats;
fileStats.push_back(stats->Average());
inputFrameletAverages.push_back(fileStats);
delete stats;
}
else if(cameraType == PushFrame) {
imageValid &= CheckFramelets(prog, tmp);
}
if(setTempFileLength && !imageValid) {
tempFileLength = 0;
}
}
// The line scan camera needs to actually count the number of lines in each image to know
// how many total frames there are before beginning pass 2.
if(imageValid && (cameraType == LineScan)) {
int lines = (tmp.Lines() / numFrameLines);
// partial frame?
if(tmp.Lines() % numFrameLines != 0) {
lines ++;
}
tempFileLength += lines;
}
else if(!imageValid) {
excludedFiles.insert(pair<int, bool>(currImage, true));
}
tmp.Close();
if(cameraType == LineScan) {
progress.CheckStatus();
}
}
/**
* If the number of output samples could not be determined, we never
* found a legitimate cube.
*/
if(numOutputSamples <= 0) {
string msg = "No valid input cubes were found";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
/**
* If theres no temp file length, which is based off of valid data in
* the input cubes, then we havent found any valid data.
*/
if(tempFileLength <= 0) {
string msg = "No valid input data was found";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
/**
* ocube is now the temporary file (for pass 2).
*/
ocube = new Cube();
ocube->SetDimensions(numOutputSamples, tempFileLength, 2);
PvlGroup &prefs = Preference::Preferences().FindGroup("DataDirectory", Pvl::Traverse);
iString outTmpName = (string)prefs["Temporary"][0] + "/";
outTmpName += Filename(ui.GetFilename("TO")).Basename() + ".tmp.cub";
示例3: IsisMain
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
/*Processing steps
1. Open and read the jitter table, convert the pixel offsets to angles,
and create the polynomials (solve for the coefficients) to use to do
the high pass filter putting the results into a rotation matrix in the jitter class.
2. Apply the jitter correction in the LineScanCameraRotation object of the master cube.
3. Loop through FROMLIST correcting the pointing and writing out the
updated camera pointing from the master cube
*/
int degree = ui.GetInteger("DEGREE");
// Get the input file list to make sure it is not empty and the master cube is included
FileList list;
list.Read(ui.GetFilename("FROMLIST"));
if (list.size() < 1) {
string msg = "The input list file [" + ui.GetFilename("FROMLIST") + "is empty";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
int ifile = 0;
// Make sure the master file is included in the input file list
while (ifile < (int) list.size() && Filename(list[ifile]).Expanded() != Filename(ui.GetFilename("MASTER")).Expanded()) {
ifile++;
}
if (ifile >= (int) list.size()) {
string msg = "The master file, [" + Filename(ui.GetFilename("MASTER")).Expanded() + " is not included in " +
"the input list file " + ui.GetFilename("FROMLIST") + "]";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
bool step2 = false;
PvlGroup gp("AppjitResults");
//Step 1: Create the jitter rotation
try {
// Open the master cube
Cube cube;
cube.Open(ui.GetFilename("MASTER"),"rw");
//check for existing polygon, if exists delete it
if (cube.Label()->HasObject("Polygon")){
cube.Label()->DeleteObject("Polygon");
}
// Get the camera
Camera *cam = cube.Camera();
if (cam->DetectorMap()->LineRate() == 0.0) {
string msg = "[" + ui.GetFilename("MASTER") + "] is not a line scan camera image";
throw iException::Message(Isis::iException::User,msg,_FILEINFO_);
}
// Create the master rotation to be corrected
int frameCode = cam->InstrumentRotation()->Frame();
cam->SetImage(int(cube.Samples()/2), int(cube.Lines()/2) );
double tol = cam->PixelResolution();
if (tol < 0.) {
// Alternative calculation of .01*ground resolution of a pixel
tol = cam->PixelPitch()*cam->SpacecraftAltitude()*1000./cam->FocalLength()/100.;
}
LineScanCameraRotation crot(frameCode, *(cube.Label()), cam->InstrumentRotation()->GetFullCacheTime(), tol );
crot.SetPolynomialDegree(ui.GetInteger("DEGREE"));
crot.SetAxes(1, 2, 3);
if (ui.WasEntered("PITCHRATE")) crot.ResetPitchRate(ui.GetDouble("PITCHRATE"));
if (ui.WasEntered("YAW")) crot.ResetYaw(ui.GetDouble("YAW"));
crot.SetPolynomial();
double baseTime = crot.GetBaseTime();
double timeScale = crot.GetTimeScale();
double fl = cam->FocalLength();
double pixpitch = cam->PixelPitch();
std::vector<double> cacheTime = cam->InstrumentRotation()->GetFullCacheTime();
// Get the jitter in pixels, compute jitter angles, and fit a polynomial to each angle
PixelOffset jitter(ui.GetFilename("JITTERFILE"), fl, pixpitch, baseTime, timeScale, degree);
jitter.LoadAngles(cacheTime);
jitter.SetPolynomial();
// Set the jitter and apply to the instrument rotation
crot.SetJitter( &jitter );
crot.ReloadCache();
// Pull out the pointing cache as a table and write it
Table cmatrix = crot.Cache("InstrumentPointing");
cmatrix.Label().AddComment("Corrected using appjit and" + ui.GetFilename("JITTERFILE"));
cube.Write(cmatrix);
// Write out the instrument position table
Isis::PvlGroup kernels = cube.Label()->FindGroup("Kernels",Isis::Pvl::Traverse);
// Write out the "Table" label to the tabled kernels in the kernels group
kernels["InstrumentPointing"] = "Table";
// kernels["InstrumentPosition"] = "Table";
cube.PutGroup(kernels);
cube.Close();
gp += PvlKeyword("StatusMaster",ui.GetFilename("MASTER") + ": camera pointing updated");
//.........这里部分代码省略.........
示例4: IsisMain
//.........这里部分代码省略.........
"ResolutionStandardDeviation,"<<
"AspectRatioMinimum,"<<
"AspectRatioMaximum,"<<
"AspectRatioAverage,"<<
"AspectRatioStandardDeviation,"<<
"PhaseMinimum,"<<
"PhaseMaximum,"<<
"PhaseAverage,"<<
"PhaseStandardDeviation,"<<
"EmissionMinimum,"<<
"EmissionMaximum,"<<
"EmissionAverage,"<<
"EmissionStandardDeviation,"<<
"IncidenceMinimum,"<<
"IncidenceMaximum,"<<
"IncidenceAverage,"<<
"IncidenceStandardDeviation,"<<
"LocalSolarTimeMinimum,"<<
"LocalSolarTimeMaximum,"<<
"LocalSolarTimeAverage,"<<
"LocalSolarTimeStandardDeviation,"<<
"LocalRadiusMaximum,"<<
"LocalRadiusMaximum,"<<
"LocalRadiusAverage,"<<
"LocalRadiusStandardDeviation,"<<
"NorthAzimuthMinimum,"<<
"NorthAzimuthMaximum,"<<
"NorthAzimuthAverage,"<<
"NorthAzimuthStandardDeviation,"<<endl;
}
os << Filename(from).Expanded() <<",";
//call the function to write out the values for each group
writeFlat(os, latStat);
writeFlat(os, lonStat);
writeFlat(os, sampleResStat);
writeFlat(os, lineResStat);
writeFlat(os, resStat);
writeFlat(os, aspectRatioStat);
writeFlat(os, phaseStat);
writeFlat(os, emissionStat);
writeFlat(os, incidenceStat);
writeFlat(os, localSolarTimeStat);
writeFlat(os, localRaduisStat);
writeFlat(os, northAzimuthStat);
os << endl;
}
}
if( ui.GetBoolean("ATTACH") ) {
string cam_name = "CameraStatistics";
//Creates new CameraStatistics Table
TableField fname( "Name", Isis::TableField::Text, 20 );
TableField fmin( "Minimum", Isis::TableField::Double );
TableField fmax( "Maximum", Isis::TableField::Double );
TableField favg( "Average", Isis::TableField::Double );
TableField fstd( "StandardDeviation", Isis::TableField::Double );
TableRecord record;
record += fname;
record += fmin;
record += fmax;
record += favg;
record += fstd;
Table table( cam_name, record );
vector<PvlGroup> grps;
grps.push_back( pLat );
grps.push_back( pLon );
grps.push_back( pSampleRes );
grps.push_back( pLineRes );
grps.push_back( pResolution );
grps.push_back( pAspectRatio );
grps.push_back( pPhase );
grps.push_back( pEmission );
grps.push_back( pIncidence );
grps.push_back( pTime );
grps.push_back( pLocalRadius );
grps.push_back( pNorthAzimuth );
for( vector<PvlGroup>::iterator g = grps.begin(); g != grps.end(); g++ ) {
int i = 0;
record[i++] = g->Name();
record[i++] = (double) (*g)[0][0];
record[i++] = (double) (*g)[1][0];
record[i++] = (double) (*g)[2][0];
record[i++] = (double) (*g)[3][0];
table += record;
}
icube->ReOpen( "rw" );
icube->Write( table );
p.WriteHistory(*icube);
icube->Close();
}
}
示例5: IsisMain
//.........这里部分代码省略.........
string testStartTime = (string)timegrp["StartTime"];
string testStopTime = (string)timegrp["StopTime"];
if (testStartTime < startTime) {
startTime = testStartTime;
startClock = (string)timegrp["SpacecraftClockStartCount"];
}
if (testStopTime > stopTime) {
stopTime = testStopTime;
stopClock = (string)timegrp["spacecraftClockStopCount"];
}
}
}
// Concatenate all TDI's and summing and specialProcessingFlat into one keyword
PvlKeyword cpmmTdiFlag("cpmmTdiFlag");
PvlKeyword cpmmSummingFlag("cpmmSummingFlag");
PvlKeyword specialProcessingFlag("SpecialProcessingFlag");
for (int i=0; i<14; i++) {
cpmmTdiFlag +=(string)"";
cpmmSummingFlag +=(string)"";
specialProcessingFlag +=(string)"";
}
for (int i=0; i<(int)clist.size(); i++) {
Pvl *clab = clist[i]->Label();
PvlGroup cInst = clab->FindGroup("Instrument",Pvl::Traverse);
OriginalLabel cOrgLab;
clist[i]->Read(cOrgLab);
PvlGroup cGrp = cOrgLab.ReturnLabels().FindGroup("INSTRUMENT_SETTING_PARAMETERS",Pvl::Traverse);
cpmmTdiFlag[(int)cInst["CpmmNumber"]] = (string) cGrp["MRO:TDI"];
cpmmSummingFlag[(int)cInst["CpmmNumber"]] = (string) cGrp["MRO:BINNING"];
if (cInst.HasKeyword("Special_Processing_Flag")) {
specialProcessingFlag[cInst["CpmmNumber"]] = (string) cInst["Special_Processing_Flag"];
}
else {
// there may not be the keyword Special_Processing_Flag if no
//keyword then set the output to NOMINAL
specialProcessingFlag[cInst["CpmmNumber"]] = "NOMINAL";
}
}
// Get the blob of original labels from first image in list
OriginalLabel org;
clist[0]->Read(org);
//close all cubes
for (int i=0; i<(int)clist.size(); i++) {
clist[i]->Close();
delete clist[i];
}
clist.clear();
// automos step
string list = ui.GetFilename("FROMLIST");
string toMosaic = ui.GetFilename("TO");
string MosaicPriority = ui.GetString("PRIORITY");
string parameters = "FROMLIST=" + list + " MOSAIC=" + toMosaic + " PRIORITY=" + MosaicPriority;
Isis::iApp ->Exec("automos",parameters);
// write out new information to new group mosaic
PvlGroup mos("Mosaic");
mos += PvlKeyword("ProductId ", ProdId);
mos += PvlKeyword(sourceProductId);
mos += PvlKeyword("StartTime ", startTime);
mos += PvlKeyword("SpacecraftClockStartCount ", startClock);
mos += PvlKeyword("StopTime ", stopTime);
mos += PvlKeyword("SpacecraftClockStopCount ", stopClock);
mos += PvlKeyword("IncidenceAngle ", Cincid, "DEG");
mos += PvlKeyword("EmissionAngle ", Cemiss, "DEG");
mos += PvlKeyword("PhaseAngle ", Cphase, "DEG");
mos += PvlKeyword("LocalTime ", ClocalSolTime, "LOCALDAY/24");
mos += PvlKeyword("SolarLongitude ", CsolarLong, "DEG");
mos += PvlKeyword("SubSolarAzimuth ", CsunAzimuth, "DEG");
mos += PvlKeyword("NorthAzimuth ", CnorthAzimuth, "DEG");
mos += cpmmTdiFlag;
mos += cpmmSummingFlag;
mos += specialProcessingFlag;
Cube mosCube;
mosCube.Open(ui.GetFilename("TO"), "rw");
PvlObject &lab=mosCube.Label()->FindObject("IsisCube");
lab.AddGroup(mos);
//add orginal label blob to the output cube
mosCube.Write(org);
mosCube.Close();
}
catch (iException &e) {
for (int i=0; i<(int)clist.size(); i++) {
clist[i]->Close();
delete clist[i];
}
string msg = "The mosaic [" + ui.GetFilename("TO") + "] was NOT created";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
} // end of isis main