本文整理汇总了C++中Process::EndProcess方法的典型用法代码示例。如果您正苦于以下问题:C++ Process::EndProcess方法的具体用法?C++ Process::EndProcess怎么用?C++ Process::EndProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Process
的用法示例。
在下文中一共展示了Process::EndProcess方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsisMain
void IsisMain() {
// Set the input image, get the camera model
Process p;
Cube *icube = p.SetInputCube("FROM");
Camera *cam = icube->camera();
// Get the ra/dec range and resolution
double minRa, maxRa, minDec, maxDec;
cam->RaDecRange(minRa, maxRa, minDec, maxDec);
double res = cam->RaDecResolution();
// Get the center ra/dec
cam->SetImage(icube->sampleCount() / 2.0, icube->lineCount() / 2.0);
double centerRa = cam->RightAscension();
double centerDec = cam->Declination();
// Compute the rotation
cam->SetRightAscensionDeclination(centerRa, centerDec + 2.0 * res);
double x = cam->Sample() - icube->sampleCount() / 2.0;
double y = cam->Line() - icube->lineCount() / 2.0;
double rot = atan2(-y, x) * 180.0 / Isis::PI;
rot = 90.0 - rot;
if(rot < 0.0) rot += 360.0;
// Setup and log results
PvlGroup results("Range");
results += PvlKeyword("MinimumRightAscension", toString(minRa), "degrees");
results += PvlKeyword("MaximumRightAscension", toString(maxRa), "degrees");
results += PvlKeyword("MinimumDeclination", toString(minDec), "degrees");
results += PvlKeyword("MaximumDeclination", toString(maxDec), "degrees");
results += PvlKeyword("MinimumRightAscension", Projection::ToHMS(minRa), "hms");
results += PvlKeyword("MaximumRightAscension", Projection::ToHMS(maxRa), "hms");
results += PvlKeyword("MinimumDeclination", Projection::ToDMS(minDec), "dms");
results += PvlKeyword("MaximumDeclination", Projection::ToDMS(maxDec), "dms");
results += PvlKeyword("Resolution", toString(res), "degrees/pixel");
Application::Log(results);
// Setup and log orientation
PvlGroup orient("Orientation");
orient += PvlKeyword("CenterSample", toString(icube->sampleCount() / 2.0));
orient += PvlKeyword("CenterLine", toString(icube->lineCount() / 2.0));
orient += PvlKeyword("CenterRightAscension", toString(centerRa), "degrees");
orient += PvlKeyword("CenterDeclination", toString(centerDec), "degrees");
orient += PvlKeyword("CelestialNorthClockAngle", toString(rot), "degrees");
orient += PvlKeyword("Resolution", toString(res), "degrees/pixel");
Application::Log(orient);
// Write the output file if requested
UserInterface ui = Application::GetUserInterface();
if(ui.WasEntered("TO")) {
Pvl temp;
temp.addGroup(results);
temp.addGroup(orient);
temp.write(ui.GetFileName("TO", "txt"));
}
p.EndProcess();
}
示例2: ComputePixRes
//Helper function to get camera resolution.
void ComputePixRes () {
Process p;
UserInterface &ui = Application::GetUserInterface();
Cube *latCube = p.SetInputCube("LATCUB");
Cube *lonCube = p.SetInputCube("LONCUB");
Brick latBrick(1,1,1,latCube->PixelType());
Brick lonBrick(1,1,1,lonCube->PixelType());
latBrick.SetBasePosition(1,1,1);
latCube->Read(latBrick);
lonBrick.SetBasePosition(1,1,1);
lonCube->Read(lonBrick);
double a = latBrick.at(0) * PI/180.0;
double c = lonBrick.at(0) * PI/180.0;
latBrick.SetBasePosition(latCube->Samples(),latCube->Lines(),1);
latCube->Read(latBrick);
lonBrick.SetBasePosition(lonCube->Samples(),lonCube->Lines(),1);
lonCube->Read(lonBrick);
double b = latBrick.at(0) * PI/180.0;
double d = lonBrick.at(0) * PI/180.0;
double angle = acos(cos(a) * cos(b) * cos(c - d) + sin(a) * sin(b));
angle *= 180/PI;
double pixels = sqrt(pow(latCube->Samples() -1.0, 2.0) + pow(latCube->Lines() -1.0, 2.0));
p.EndProcess();
ui.Clear("RESOLUTION");
ui.PutDouble("RESOLUTION", pixels/angle);
ui.Clear("PIXRES");
ui.PutAsString("PIXRES","PPD");
}
示例3: IsisMain
//.........这里部分代码省略.........
key.setName("EphemerisTime");
key.setValue(Isis::toString(et), "seconds");
inst.addKeyword(key);
key.setName("StartTime");
key.setValue(startTime);
inst.addKeyword(key);
if(stopTime != "") {
key.setName("StopTime");
key.setValue(stopTime);
inst.addKeyword(key);
}
key.setName("FocalPlaneXDependency");
key.setValue(toString((int)incam->FocalPlaneMap()->FocalPlaneXDependency()));
inst.addKeyword(key);
int xDependency = incam->FocalPlaneMap()->FocalPlaneXDependency();
double newInstrumentTransX = incam->FocalPlaneMap()->SignMostSigX();
inst.addKeyword(PvlKeyword("TransX", toString(newInstrumentTransX)));
double newInstrumentTransY = incam->FocalPlaneMap()->SignMostSigY();
inst.addKeyword(PvlKeyword("TransY", toString(newInstrumentTransY)));
storeSpice(&inst, naifKeywordsObject, "TransX0", "IDEAL_TRANSX", transx,
newPixelPitch * newInstrumentTransX, (xDependency == CameraFocalPlaneMap::Sample));
storeSpice(&inst, naifKeywordsObject, "TransY0", "IDEAL_TRANSY", transy,
newPixelPitch * newInstrumentTransY, (xDependency == CameraFocalPlaneMap::Line));
double transSXCoefficient = 1.0 / newPixelPitch * newInstrumentTransX;
double transLXCoefficient = 1.0 / newPixelPitch * newInstrumentTransY;
if (xDependency == CameraFocalPlaneMap::Line) {
swap(transSXCoefficient, transLXCoefficient);
}
storeSpice(&inst, naifKeywordsObject, "TransS0", "IDEAL_TRANSS",
transs, transSXCoefficient, (xDependency == CameraFocalPlaneMap::Sample));
storeSpice(&inst, naifKeywordsObject, "TransL0", "IDEAL_TRANSL",
transl, transLXCoefficient, (xDependency == CameraFocalPlaneMap::Line));
if(instType == "LINESCAN") {
key.setName("ExposureDuration");
key.setValue(Isis::toString(incam->DetectorMap()->LineRate() * 1000.), "milliseconds");
inst.addKeyword(key);
}
key.setName("MatchedCube");
key.setValue(mcube->fileName());
inst.addKeyword(key);
ocube->putGroup(inst);
p.EndProcess();
// Now adjust the label to fake the true size of the image to match without
// taking all the space it would require for the image data
Pvl label;
label.read("match.lbl");
PvlGroup &dims = label.findGroup("Dimensions", Pvl::Traverse);
dims["Lines"] = toString(numberLines);
dims["Samples"] = toString(detectorSamples);
dims["Bands"] = toString(numberBands);
label.write("match.lbl");
// And run cam2cam to apply the transformation
QString parameters;
parameters += " FROM= " + ui.GetFileName("FROM");
parameters += " MATCH= " + QString("match.cub");
parameters += " TO= " + ui.GetFileName("TO");
parameters += " INTERP=" + ui.GetString("INTERP");
ProgramLauncher::RunIsisProgram("cam2cam", parameters);
// Cleanup by deleting the match files
remove("match.History.IsisCube");
remove("match.lbl");
remove("match.cub");
remove("match.OriginalLabel.IsisCube");
remove("match.Table.BodyRotation");
remove("match.Table.HiRISE Ancillary");
remove("match.Table.HiRISE Calibration Ancillary");
remove("match.Table.HiRISE Calibration Image");
remove("match.Table.InstrumentPointing");
remove("match.Table.InstrumentPosition");
remove("match.Table.SunPosition");
// Finally finish by adding the OriginalInstrument group to the TO cube
Cube toCube;
toCube.open(ui.GetFileName("TO"), "rw");
// Extract label and create cube object
Pvl *toLabel = toCube.label();
PvlObject &o = toLabel->findObject("IsisCube");
o.deleteGroup("OriginalInstrument");
o.addGroup(fromInst);
toCube.close();
}
示例4: IsisMain
void IsisMain() {
QString projName;
Process pHist;
Cube *icube = pHist.SetInputCube("FROM");
// Check to see if the input cube looks like a HiRISE RDR
if (icube->bandCount() > 3) {
QString msg = "Input file [" +
Application::GetUserInterface().GetFileName("FROM") +
"] does not appear to be a HiRISE RDR product. Number of " +
"bands is greater than 3";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
// Setup to get a histogram for each band
g_min = new double[icube->bandCount()];
g_max = new double[icube->bandCount()];
UserInterface &ui = Application::GetUserInterface();
// Determine if the data is to be converted to JPEG2000
IString enctype = ui.GetString("ENCODING_TYPE");
enctype.DownCase();
for (int band = 1; band <= icube->bandCount(); ++band) {
if (ui.GetString("TYPE").compare("AUTOMATIC") == 0) {
// Set up a histogram for this band. This call sets the input range
// by making an initial stats pass to find the data min and max
Histogram hist(*icube, band, pHist.Progress());
// Loop and accumulate histogram
pHist.Progress()->SetText("Gathering Histogram");
pHist.Progress()->SetMaximumSteps(icube->lineCount());
pHist.Progress()->CheckStatus();
LineManager line(*icube);
for (int i = 1; i <= icube->lineCount(); i++) {
line.SetLine(i, band);
icube->read(line);
hist.AddData(line.DoubleBuffer(), line.size());
pHist.Progress()->CheckStatus();
}
// get the requested cumulative percentages
g_min[band-1] = ui.GetDouble("MINPER") == 0.0 ? hist.Minimum() : hist.Percent(ui.GetDouble("MINPER"));
g_max[band-1] = ui.GetDouble("MAXPER") == 100.0 ? hist.Maximum() : hist.Percent(ui.GetDouble("MAXPER"));
}
else {
g_min[band-1] = ui.GetDouble("MIN");
g_max[band-1] = ui.GetDouble("MAX");
}
}
// Find the minimum min and maximum max for all bands
double minmin = g_min[0];
double maxmax = g_max[0];
for (int band = 1; band < icube->bandCount(); ++band) {
if (g_min[band] < minmin) minmin = g_min[band];
if (g_max[band] > maxmax) maxmax = g_max[band];
}
pHist.EndProcess();
// Set up for writing the data to a PDS formatted file
ProcessExportPds p;
Cube *icube2 = p.SetInputCube("FROM");
if (enctype.Equal("jp2")) {
g_jp2buf = new char* [icube2->bandCount()];
FileName lblFile(ui.GetFileName("TO"));
QString lblFileName = lblFile.path() + "/" + lblFile.baseName() + ".lbl";
p.SetDetached(lblFileName);
p.setFormat(ProcessExport::JP2);
}
// Set the output pixel type and the special pixel values
int nbits = ui.GetInteger("BITS");
if (nbits == 8) {
if (enctype.Equal("jp2")) {
for (int i = 0; i < icube2->bandCount(); i++) {
g_jp2buf[i] = new char[icube2->sampleCount()];
}
}
g_oType = Isis::UnsignedByte;
p.SetOutputType(g_oType);
p.SetOutputRange(VALID_MIN1, VALID_MAX1);
p.SetOutputNull(NULL1);
p.SetOutputLis(LOW_INSTR_SAT1);
p.SetOutputLrs(LOW_REPR_SAT1);
p.SetOutputHis(HIGH_INSTR_SAT1);
p.SetOutputHrs(HIGH_REPR_SAT1);
}
else if (nbits == 16) {
if (enctype.Equal("jp2")) {
for (int i = 0; i < icube2->bandCount(); i++) {
g_jp2buf[i] = new char[icube2->sampleCount()*2];
}
}
//.........这里部分代码省略.........
示例5: IsisMain
//.........这里部分代码省略.........
for (unsigned i = 0; i < outList.size(); i++) {
if (outList[i].compare(imageList[i]) == 0) {
std::string msg = "The to list file [" + outList[i] +
"] has the same name as its corresponding from list file.";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
}
}
// Test to ensure sampling percent in bound
double sampPercent = ui.GetDouble("PERCENT");
if (sampPercent <= 0.0 || sampPercent > 100.0) {
string msg = "The sampling percent must be a decimal (0.0, 100.0]";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
int mincnt = ui.GetInteger("MINCOUNT");
bool wtopt = ui.GetBoolean("WEIGHT");
if (processOpt != "APPLY") {
// Loop through all the input cubes, calculating statistics for each cube to use later
iString maxCubeStr ((int)imageList.size());
for (int band=1; band<=g_maxBand; band++) {
std::vector<Statistics> statsList;
for (int img=0; img<(int)imageList.size(); img++) {
Process p;
const CubeAttributeInput att;
const std::string inp = imageList[img];
Cube *icube = p.SetInputCube(inp, att);
// Add a Statistics object to the list for every band of every input cube
g_imageIndex = img;
Statistics stats = GatherStatistics(*icube, band, sampPercent, maxCubeStr);
statsList.push_back(stats);
p.EndProcess();
}
// Create a separate OverlapNormalization object for every band
OverlapNormalization *oNorm = new OverlapNormalization (statsList);
for (int h=0; h<(int)hold.size(); h++) oNorm->AddHold(hold[h]);
g_oNormList.push_back(oNorm);
}
// A list for keeping track of which input cubes are known to overlap another
std::vector<bool> doesOverlapList;
for (unsigned int i=0; i<imageList.size(); i++) doesOverlapList.push_back(false);
// Find overlapping areas and add them to the set of known overlaps for each
// band shared amongst cubes
for (unsigned int i=0; i<imageList.size(); i++){
Cube cube1;
cube1.Open(imageList[i]);
for (unsigned int j=(i+1); j<imageList.size(); j++) {
Cube cube2;
cube2.Open(imageList[j]);
iString cubeStr1 ((int)(i+1));
iString cubeStr2 ((int)(j+1));
string statMsg = "Gathering Overlap Statisitcs for Cube " +
cubeStr1 + " vs " + cubeStr2 + " of " + maxCubeStr;
// Get overlap statistics for cubes
OverlapStatistics oStats(cube1, cube2, statMsg, sampPercent);
// Only push the stats onto the oList vector if there is an overlap in at
// least one of the bands
if (oStats.HasOverlap()) {
示例6: IsisMain
//.........这里部分代码省略.........
PvlTranslationManager missionXlater (lab, transFile);
// Get the mission name so we can search the correct DB's for kernels
string mission = missionXlater.Translate ("MissionName");
// Get system base kernels
unsigned int allowed = 0;
unsigned int allowedCK = 0;
unsigned int allowedSPK = 0;
if (ui.GetBoolean("CKPREDICTED")) allowedCK |= spiceInit::kernelTypeEnum("PREDICTED");
if (ui.GetBoolean("CKRECON")) allowedCK |= spiceInit::kernelTypeEnum("RECONSTRUCTED");
if (ui.GetBoolean("CKSMITHED")) allowedCK |= spiceInit::kernelTypeEnum("SMITHED");
if (ui.GetBoolean("CKNADIR")) allowedCK |= spiceInit::kernelTypeEnum("NADIR");
if (ui.GetBoolean("SPKPREDICTED")) allowedSPK |= spiceInit::kernelTypeEnum("PREDICTED");
if (ui.GetBoolean("SPKRECON")) allowedSPK |= spiceInit::kernelTypeEnum("RECONSTRUCTED");
if (ui.GetBoolean("SPKSMITHED")) allowedSPK |= spiceInit::kernelTypeEnum("SMITHED");
KernelDb baseKernels (allowed);
KernelDb ckKernels (allowedCK);
KernelDb spkKernels (allowedSPK);
baseKernels.LoadSystemDb(mission);
ckKernels.LoadSystemDb(mission);
spkKernels.LoadSystemDb(mission);
Kernel lk, pck, targetSpk, fk, ik, sclk, spk, iak, dem, exk;
std::priority_queue< Kernel > ck;
lk = baseKernels.LeapSecond(lab);
pck = baseKernels.TargetAttitudeShape(lab);
targetSpk = baseKernels.TargetPosition(lab);
ik = baseKernels.Instrument(lab);
sclk = baseKernels.SpacecraftClock(lab);
iak = baseKernels.InstrumentAddendum(lab);
fk = ckKernels.Frame(lab);
ck = ckKernels.SpacecraftPointing(lab);
spk = spkKernels.SpacecraftPosition(lab);
if (ui.GetBoolean("CKNADIR")) {
// Only add nadir if no spacecraft pointing found
std::vector<std::string> kernels;
kernels.push_back("Nadir");
ck.push(Kernel((spiceInit::kernelTypes)0, kernels));
}
// Get user defined kernels and override ones already found
GetUserEnteredKernel("LS", lk);
GetUserEnteredKernel("PCK", pck);
GetUserEnteredKernel("TSPK", targetSpk);
GetUserEnteredKernel("FK", fk);
GetUserEnteredKernel("IK", ik);
GetUserEnteredKernel("SCLK", sclk);
GetUserEnteredKernel("SPK", spk);
GetUserEnteredKernel("IAK", iak);
GetUserEnteredKernel("EXTRA", exk);
// Get shape kernel
if (ui.GetString ("SHAPE") == "USER") {
GetUserEnteredKernel("MODEL", dem);
} else if (ui.GetString("SHAPE") == "SYSTEM") {
dem = baseKernels.Dem(lab);
}
bool kernelSuccess = false;
if (ck.size() == 0 && !ui.WasEntered("CK")) {
throw iException::Message(iException::Camera,
"No Camera Kernel found for the image ["+ui.GetFilename("FROM")
+"]",
_FILEINFO_);
}
else if(ui.WasEntered("CK")) {
// ck needs to be array size 1 and empty kernel objects
while(ck.size()) ck.pop();
ck.push(Kernel());
}
while(ck.size() != 0 && !kernelSuccess) {
Kernel realCkKernel = ck.top();
ck.pop();
if (ui.WasEntered("CK")) {
ui.GetAsString("CK", realCkKernel.kernels);
}
// Merge SpacecraftPointing and Frame into ck
for (int i = 0; i < fk.size(); i++) {
realCkKernel.push_back(fk[i]);
}
kernelSuccess = TryKernels(icube, p, lk, pck, targetSpk,
realCkKernel, fk, ik, sclk, spk, iak, dem, exk);
}
if(!kernelSuccess) {
throw iException::Message(iException::Camera,
"Unable to initialize camera model",
_FILEINFO_);
}
p.EndProcess();
}
示例7: IsisMain
//.........这里部分代码省略.........
// Get the radii
double radii[3];
cam->Radii(radii);
eqRad = radii[0] * 1000.0;
eq2Rad = radii[1] * 1000.0;
poleRad = radii[2] * 1000.0;
target = cam->Target();
equiRadStat.AddData(&eqRad, 1);
poleRadStat.AddData(&poleRad, 1);
// Get resolution
double lowres = cam->LowestImageResolution();
double hires = cam->HighestImageResolution();
scaleStat.AddData(&lowres, 1);
scaleStat.AddData(&hires, 1);
double pixres = (lowres+hires)/2.0;
double scale = Scale(pixres, poleRad, eqRad);
mapgrp.AddKeyword(PvlKeyword("PixelResolution",pixres),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("Scale",scale,"pixels/degree"),Pvl::Replace);
mapgrp += PvlKeyword("MinPixelResolution",lowres,"meters");
mapgrp += PvlKeyword("MaxPixelResolution",hires,"meters");
// Get the universal ground range
double minlat,maxlat,minlon,maxlon;
cam->GroundRange(minlat,maxlat,minlon,maxlon,mapping);
mapgrp.AddKeyword(PvlKeyword("MinimumLatitude",minlat),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("MaximumLatitude",maxlat),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("MinimumLongitude",minlon),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("MaximumLongitude",maxlon),Pvl::Replace);
fmap.AddGroup(mapgrp);
fileset.AddObject(fmap);
longitudeStat.AddData(&minlon, 1);
longitudeStat.AddData(&maxlon, 1);
latitudeStat.AddData(&minlat, 1);
latitudeStat.AddData(&maxlat, 1);
p.ClearInputCubes();
prog.CheckStatus();
}
// Construct the output mapping group with statistics
PvlGroup mapping("Mapping");
double avgPixRes((scaleStat.Minimum()+scaleStat.Maximum())/2.0);
double avgLat((latitudeStat.Minimum()+latitudeStat.Maximum())/2.0);
double avgLon((longitudeStat.Minimum()+longitudeStat.Maximum())/2.0);
double avgEqRad((equiRadStat.Minimum()+equiRadStat.Maximum())/2.0);
double avgPoleRad((poleRadStat.Minimum()+poleRadStat.Maximum())/2.0);
double scale = Scale(avgPixRes, avgPoleRad, avgEqRad);
mapping += PvlKeyword("ProjectionName",projection);
mapping += PvlKeyword("TargetName", target);
mapping += PvlKeyword("EquatorialRadius",eqRad,"meters");
mapping += PvlKeyword("PolarRadius",poleRad,"meters");
mapping += PvlKeyword("LatitudeType",lattype);
mapping += PvlKeyword("LongitudeDirection",londir);
mapping += PvlKeyword("LongitudeDomain",londom);
mapping += PvlKeyword("PixelResolution", SetRound(avgPixRes, digits), "meters/pixel");
mapping += PvlKeyword("Scale", SetRound(scale, digits), "pixels/degree");
mapping += PvlKeyword("MinPixelResolution",scaleStat.Minimum(),"meters");
mapping += PvlKeyword("MaxPixelResolution",scaleStat.Maximum(),"meters");
mapping += PvlKeyword("CenterLongitude", SetRound(avgLon,digits));
mapping += PvlKeyword("CenterLatitude", SetRound(avgLat,digits));
mapping += PvlKeyword("MinimumLatitude", MAX(SetFloor(latitudeStat.Minimum(),digits), -90.0));
mapping += PvlKeyword("MaximumLatitude", MIN(SetCeil(latitudeStat.Maximum(),digits), 90.0));
mapping += PvlKeyword("MinimumLongitude",MAX(SetFloor(longitudeStat.Minimum(),digits), -180.0));
mapping += PvlKeyword("MaximumLongitude",MIN(SetCeil(longitudeStat.Maximum(),digits), 360.0));
PvlKeyword clat("PreciseCenterLongitude", avgLon);
clat.AddComment("Actual Parameters without precision applied");
mapping += clat;
mapping += PvlKeyword("PreciseCenterLatitude", avgLat);
mapping += PvlKeyword("PreciseMinimumLatitude", latitudeStat.Minimum());
mapping += PvlKeyword("PreciseMaximumLatitude", latitudeStat.Maximum());
mapping += PvlKeyword("PreciseMinimumLongitude",longitudeStat.Minimum());
mapping += PvlKeyword("PreciseMaximumLongitude",longitudeStat.Maximum());
Application::GuiLog(mapping);
// Write the output file if requested
if (ui.WasEntered("TO")) {
Pvl temp;
temp.AddGroup(mapping);
temp.Write(ui.GetFilename("TO","map"));
}
if (ui.WasEntered("LOG")) {
Pvl temp;
temp.AddObject(fileset);
temp.Write(ui.GetFilename("LOG","log"));
}
p.EndProcess();
}
示例8: IsisMain
//.........这里部分代码省略.........
// Set the title for the dialog
string title;
if (ui.WasEntered("TITLE")) {
title = ui.GetString("TITLE");
}
else {
title = "Histogram Plot for " + Filename(ui.GetAsString("FROM")).Name();
}
// Create the QHistogram, set the title & load the Isis::Histogram into it
Qisis::HistogramToolWindow *plot = new Qisis::HistogramToolWindow(title.c_str(), ui.TheGui());
// Set the xaxis title if they entered one
if (ui.WasEntered("XAXIS")) {
string xaxis(ui.GetString("XAXIS"));
plot->setAxisLabel(QwtPlot::xBottom,xaxis.c_str());
}
// Set the yLeft axis title if they entered one
if (ui.WasEntered("Y1AXIS")) {
string yaxis(ui.GetString("Y1AXIS"));
plot->setAxisLabel(QwtPlot::yLeft,yaxis.c_str());
}
// Set the yRight axis title if they entered one
if (ui.WasEntered("Y2AXIS")) {
string y2axis(ui.GetString("Y2AXIS"));
plot->setAxisLabel(QwtPlot::yRight,y2axis.c_str());
}
//Transfer data from histogram to the plotcurve
std::vector<double> xarray,yarray,y2array;
double cumpct = 0.0;
for (int i=0; i<hist.Bins(); i++) {
if (hist.BinCount(i) > 0) {
xarray.push_back(hist.BinMiddle(i));
yarray.push_back(hist.BinCount(i));
double pct = (double)hist.BinCount(i) / hist.ValidPixels() * 100.;
cumpct += pct;
y2array.push_back(cumpct);
}
}
Qisis::HistogramItem *histCurve = new Qisis::HistogramItem();
histCurve->setColor(Qt::darkCyan);
histCurve->setTitle("Frequency");
Qisis::PlotToolCurve *cdfCurve = new Qisis::PlotToolCurve();
cdfCurve->setStyle(QwtPlotCurve::Lines);
cdfCurve->setTitle("Percentage");
QPen *pen = new QPen(Qt::red);
pen->setWidth(2);
histCurve->setYAxis(QwtPlot::yLeft);
cdfCurve->setYAxis(QwtPlot::yRight);
cdfCurve->setPen(*pen);
//These are all variables needed in the following for loop.
//----------------------------------------------
QwtArray<QwtDoubleInterval> intervals(xarray.size());
QwtArray<double> values(yarray.size());
double maxYValue = DBL_MIN;
double minYValue = DBL_MAX;
// ---------------------------------------------
for(unsigned int y = 0; y < yarray.size(); y++) {
intervals[y] = QwtDoubleInterval(xarray[y], xarray[y] + hist.BinSize());
values[y] = yarray[y];
if(values[y] > maxYValue) maxYValue = values[y];
if(values[y] < minYValue) minYValue = values[y];
}
histCurve->setData(QwtIntervalData(intervals, values));
cdfCurve->setData(&xarray[0],&y2array[0],xarray.size());
plot->add(histCurve);
plot->add(cdfCurve);
plot->fillTable();
plot->setScale(QwtPlot::yLeft,0,maxYValue);
plot->setScale(QwtPlot::xBottom,hist.Minimum(),hist.Maximum());
QLabel *label = new QLabel(" Average = " + QString::number(hist.Average()) + '\n' +
"\n Minimum = " + QString::number(hist.Minimum()) + '\n' +
"\n Maximum = " + QString::number(hist.Maximum()) + '\n' +
"\n Stand. Dev.= " + QString::number(hist.StandardDeviation()) + '\n' +
"\n Variance = " + QString::number(hist.Variance()) + '\n' +
"\n Median = " + QString::number(hist.Median()) + '\n' +
"\n Mode = " + QString::number(hist.Mode()) +'\n' +
"\n Skew = " + QString::number(hist.Skew()), plot);
plot->getDockWidget()->setWidget(label);
plot->showWindow();
}
p.EndProcess();
}
示例9: ComputeInputRange
//.........这里部分代码省略.........
else {
Filename pckFile("$base/kernels/pck/pck?????.tpc");
pckFile.HighestVersion();
string pckFilename = pckFile.Expanded();
furnsh_c(pckFilename.c_str());
string target;
//If user entered target
if(ui.WasEntered("TARGET")) {
target = ui.GetString("TARGET");
}
//Else read the target name from the input cube
else {
Pvl fromFile;
fromFile.Read(ui.GetFilename("FROM"));
target = (string)fromFile.FindKeyword("TargetName", Pvl::Traverse);
}
SpiceInt code;
SpiceBoolean found;
bodn2c_c (target.c_str(), &code, &found);
if (!found) {
string msg = "Could not convert Target [" + target +
"] to NAIF code";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
SpiceInt n;
SpiceDouble radii[3];
bodvar_c(code,"RADII",&n,radii);
equRadius = radii[0] * 1000;
polRadius = radii[2] * 1000;
}
if(isOcentric) {
if(ui.GetString("LATTYPE") != "PLANETOCENTRIC") {
minLat = Projection::ToPlanetocentric(minLat, (double)equRadius, (double)polRadius);
maxLat = Projection::ToPlanetocentric(maxLat, (double)equRadius, (double)polRadius);
}
}
else {
if(ui.GetString("LATTYPE") == "PLANETOCENTRIC") {
minLat = Projection::ToPlanetographic(minLat, (double)equRadius, (double)polRadius);
maxLat = Projection::ToPlanetographic(maxLat, (double)equRadius, (double)polRadius);
}
}
}
if(userGrp.HasKeyword("LongitudeDirection")) {
bool isPosEast = ((std::string)userGrp.FindKeyword("LongitudeDirection")) == "PositiveEast";
if(isPosEast) {
if(ui.GetString("LONDIR") != "POSITIVEEAST") {
minLon = Projection::ToPositiveEast(minLon, lonDomain);
maxLon = Projection::ToPositiveEast(maxLon, lonDomain);
if(minLon > maxLon) {
double temp = minLon;
minLon = maxLon;
maxLon = temp;
}
}
}
else {
if(ui.GetString("LONDIR") == "POSITIVEEAST") {
minLon = Projection::ToPositiveWest(minLon, lonDomain);
maxLon = Projection::ToPositiveWest(maxLon, lonDomain);
if(minLon > maxLon) {
double temp = minLon;
minLon = maxLon;
maxLon = temp;
}
}
}
}
// Set ground range parameters in UI
ui.Clear("MINLAT");
ui.PutDouble("MINLAT", minLat);
ui.Clear("MAXLAT");
ui.PutDouble("MAXLAT", maxLat);
ui.Clear("MINLON");
ui.PutDouble("MINLON", minLon);
ui.Clear("MAXLON");
ui.PutDouble("MAXLON", maxLon);
p.EndProcess();
// Set default ground range param to camera
ui.Clear("DEFAULTRANGE");
ui.PutAsString("DEFAULTRANGE","COMPUTE");
}
示例10: IsisMain
//.........这里部分代码省略.........
vector<double> data = sampSol.GetInput(i);
iString tmp = "";
tmp += iString(sampSol.GetExpected(i));
tmp += ",\t";
tmp += iString(lineSol.GetExpected(i));
tmp += ",\t";
tmp += iString(data[0]);
tmp += ",\t";
tmp += iString(data[1]);
tmp += ",\t";
tmp += iString(sampResiduals[i]);
tmp += ",\t";
tmp += iString(lineResiduals[i]);
oFile.PutLine(tmp + "\n");
}
}
oFile.Close();
//Records the error to the log
PvlGroup error( "Error" );
error += PvlKeyword( "Degree", degree );
error += PvlKeyword( "NumberOfPoints", (int)sampResiduals.size() );
error += PvlKeyword( "SampleMinimumError", sampErr.Minimum() );
error += PvlKeyword( "SampleAverageError", sampErr.Average() );
error += PvlKeyword( "SampleMaximumError", sampErr.Maximum() );
error += PvlKeyword( "SampleStdDeviationError", sampErr.StandardDeviation() );
error += PvlKeyword( "LineMinimumError", lineErr.Minimum() );
error += PvlKeyword( "LineAverageError", lineErr.Average() );
error += PvlKeyword( "LineMaximumError", lineErr.Maximum() );
error += PvlKeyword( "LineStdDeviationError", lineErr.StandardDeviation() );
Application::Log( error );
//Close the input cubes for cleanup
p.EndProcess();
//If we want to warp the image, then continue, otherwise return
if(!ui.GetBoolean("NOWARP")) {
//Creates the mapping group
Pvl mapFile;
mapFile.Read(ui.GetFilename("MAP"));
PvlGroup &mapGrp = mapFile.FindGroup("Mapping",Pvl::Traverse);
//Reopen the lat and long cubes
latCube = new Cube();
latCube->SetVirtualBands(ui.GetInputAttribute("LATCUB").Bands());
latCube->Open(ui.GetFilename("LATCUB"));
lonCube = new Cube();
lonCube->SetVirtualBands(ui.GetInputAttribute("LONCUB").Bands());
lonCube->Open(ui.GetFilename("LONCUB"));
PvlKeyword targetName;
//If the user entered the target name
if(ui.WasEntered("TARGET")) {
targetName = PvlKeyword("TargetName", ui.GetString("TARGET"));
}
//Else read the target name from the input cube
else {
Pvl fromFile;
fromFile.Read(ui.GetFilename("FROM"));
targetName = fromFile.FindKeyword("TargetName", Pvl::Traverse);
}
mapGrp.AddKeyword(targetName, Pvl::Replace);
示例11: IsisMain
//.........这里部分代码省略.........
// If a TO parameter was specified, create DEM with errors
if (ui.WasEntered("TO")) {
// Create the output DEM
cout << "\nCreating output DEM from " << bmf.size() << " points.\n";
Process p;
Cube *icube = p.SetInputCube("FROM");
Cube *ocube = p.SetOutputCube("TO", icube->sampleCount(),
icube->lineCount(), 3);
p.ClearInputCubes();
int boxsize = ui.GetInteger("BOXSIZE");
double plotdist = ui.GetDouble("PLOTDIST");
TileManager dem(*ocube), eigen(*ocube), stErr(*ocube);
dem.SetTile(1, 1); // DEM Data/elevation
stErr.SetTile(1, 2); // Error in stereo computation
eigen.SetTile(1, 3); // Eigenvalue of the solution
int nBTiles(eigen.Tiles()/3); // Total tiles / 3 bands
prog.SetText("Creating DEM");
prog.SetMaximumSteps(nBTiles);
prog.CheckStatus();
Statistics stAng;
while ( !eigen.end() ) { // Must use the last band for this!!
PointPlot tm = for_each(bmf.begin(), bmf.end(), PointPlot(dem, plotdist));
tm.FillPoints(*lhCamera, *rhCamera, boxsize, dem, stErr, eigen, &stAng);
ocube->write(dem);
ocube->write(stErr);
ocube->write(eigen);
dem.next();
stErr.next();
eigen.next();
prog.CheckStatus();
}
// Report Stereo separation angles
PvlGroup stresultsPvl("StereoSeparationAngle");
stresultsPvl += PvlKeyword("Minimum", toString(stAng.Minimum()), "deg");
stresultsPvl += PvlKeyword("Average", toString(stAng.Average()), "deg");
stresultsPvl += PvlKeyword("Maximum", toString(stAng.Maximum()), "deg");
stresultsPvl += PvlKeyword("StandardDeviation", toString(stAng.StandardDeviation()), "deg");
Application::Log(stresultsPvl);
// Update the label with BandBin keywords
PvlKeyword filter("FilterName", "Elevation", "meters");
filter.addValue("ElevationError", "meters");
filter.addValue("GoodnessOfFit", "unitless");
PvlKeyword center("Center", "1.0");
center.addValue("1.0");
center.addValue("1.0");
PvlGroup &bandbin = ocube->label()->findGroup("BandBin", PvlObject::Traverse);
bandbin.addKeyword(filter, PvlContainer::Replace);
bandbin.addKeyword(center, PvlContainer::Replace);
center.setName("Width");
bandbin.addKeyword(center, PvlContainer::Replace);
p.EndProcess();
}
// If a cnet file was entered, write the ControlNet pvl to the file
if (ui.WasEntered("ONET")) {
WriteCnet(ui.GetFileName("ONET"), bmf, lhCamera->target()->name(), serialLeft,
serialRight);
}
// Create output data
PvlGroup totalPointsPvl("Totals");
totalPointsPvl += PvlKeyword("AttemptedPoints", toString(numAttemptedInitialPoints));
totalPointsPvl += PvlKeyword("InitialSuccesses", toString(numOrigPoints));
totalPointsPvl += PvlKeyword("GrowSuccesses", toString(passpix2));
totalPointsPvl += PvlKeyword("ResultingPoints", toString(bmf.size()));
Application::Log(totalPointsPvl);
Pvl arPvl = matcher.RegistrationStatistics();
PvlGroup smtkresultsPvl("SmtkResults");
smtkresultsPvl += PvlKeyword("SpiceOffImage", toString(matcher.OffImageErrorCount()));
smtkresultsPvl += PvlKeyword("SpiceDistanceError", toString(matcher.SpiceErrorCount()));
arPvl.addGroup(smtkresultsPvl);
for(int i = 0; i < arPvl.groups(); i++) {
Application::Log(arPvl.group(i));
}
// add the auto registration information to print.prt
PvlGroup autoRegTemplate = matcher.RegTemplate();
Application::Log(autoRegTemplate);
// Don't need the cubes opened anymore
lhImage.close();
rhImage.close();
}