本文整理汇总了C++中ProcessByLine类的典型用法代码示例。如果您正苦于以下问题:C++ ProcessByLine类的具体用法?C++ ProcessByLine怎么用?C++ ProcessByLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessByLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsisMain
void IsisMain() {
// Create a process by line object
ProcessByLine p;
// Get the size of the cube
Cube *icube = p.SetInputCube("FROM");
// Open output text file
UserInterface &ui = Application::GetUserInterface();
QString to = ui.GetFileName("TO", "txt");
fout.open(to.toAscii().data());
// Print header if needed
if(ui.GetBoolean("HEADER")) {
fout << "Input Cube: " << icube->fileName() << endl;
fout << "Samples:Lines:Bands: " << icube->sampleCount() << ":" <<
icube->lineCount() << ":" << icube->bandCount() << endl;
}
// List the cube
p.StartProcess(isis2ascii);
p.EndProcess();
fout.close();
}
示例2: main
int main(int argc, char *argv[]) {
Preference::Preferences(true);
cout << setprecision(9);
try {
FileName fromList("FromList.lst");
QString holdList = "HoldList.lst";
cout << "UnitTest for Equalization" << endl;
HiEqualization equalizer(fromList.toString());
equalizer.addHolds(holdList);
equalizer.calculateStatistics();
// Open input cube
FileList imageList(fromList);
for (int i = 0; i < imageList.size(); i++) {
ProcessByLine p;
CubeAttributeInput att;
QString inp = imageList[i].toString();
Cube *inputCube = p.SetInputCube(inp, att);
TestFunctor func(&equalizer, inputCube->lineCount(), i);
p.ProcessCubeInPlace(func, false);
p.EndProcess();
}
}
catch (IException &e) {
e.print();
}
}
示例3: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and get the camera model
icube = p.SetInputCube("FROM");
cam = icube->Camera();
// Create the output cube
p.SetOutputCube ("TO");
// Get the trim angles
UserInterface &ui = Application::GetUserInterface();
minPhase = ui.GetDouble ("MINPHASE");
maxPhase = ui.GetDouble ("MAXPHASE");
minEmission = ui.GetDouble ("MINEMISSION");
maxEmission = ui.GetDouble ("MAXEMISSION");
minIncidence = ui.GetDouble ("MININCIDENCE");
maxIncidence = ui.GetDouble ("MAXINCIDENCE");
// Start the processing
lastBand = 0;
p.StartProcess(photrim);
p.EndProcess();
}
示例4: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Set up the input cube and get camera information
Cube *icube = p.SetInputCube("FROM");
// Create the output cube
Cube *ocube = p.SetOutputCube("TO");
// Set up the user interface
UserInterface &ui = Application::GetUserInterface();
// Get the name of the parameter file
Pvl par(ui.GetFileName("PHOPAR"));
auto_ptr<Hillier> photom = auto_ptr<Hillier> (new Hillier(par, *icube));
pho = photom.get();
// Start the processing
p.StartProcess(hillier);
PvlGroup photo("Photometry");
pho->Report(photo);
ocube->putGroup(photo);
Application::Log(photo);
p.EndProcess();
}
示例5: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and output files
UserInterface &ui = Application::GetUserInterface();
// Setup the input and output cubes
p.SetInputCube("FROM1");
if (ui.WasEntered ("FROM2")) p.SetInputCube("FROM2");
p.SetOutputCube ("TO");
// Get the coefficients
Isisa = ui.GetDouble ("A");
Isisb = ui.GetDouble ("B");
Isisc = ui.GetDouble ("C");
Isisd = ui.GetDouble ("D");
Isise = ui.GetDouble ("E");
// Start the processing based on the operator
string op = ui.GetString ("OPERATOR");
if (op == "ADD" ) p.StartProcess(add);
if (op == "SUBTRACT") p.StartProcess(sub);
if (op == "MULTIPLY") p.StartProcess(mult);
if (op == "DIVIDE") p.StartProcess(div);
if (op == "UNARY") p.StartProcess(unary);
// Cleanup
p.EndProcess();
}
示例6: IsisMain
void IsisMain() {
// Create a process by line object
ProcessByLine p;
// Get the value to put in the cube
UserInterface &ui = Application::GetUserInterface();
QString pixels = ui.GetString("PIXELS");
double value = Null;
if(pixels == "NULL") {
value = NULL8;
}
else if(pixels == "LIS") {
value = LOW_INSTR_SAT8;
}
else if(pixels == "LRS") {
value = LOW_REPR_SAT8;
}
else if(pixels == "HIS") {
value = HIGH_INSTR_SAT8;
}
else if(pixels == "HRS") {
value = HIGH_REPR_SAT8;
}
else {
value = ui.GetDouble("VALUE");
}
// Need to pick good min/maxs to ensure the user's value
// doesn't get saturated
CubeAttributeOutput &att = ui.GetOutputAttribute("TO");
if(IsValidPixel(value)) {
if(value == 0.0) {
att.setMinimum(value);
att.setMaximum(value + 1.0);
}
if(value < 0.0) {
att.setMinimum(value);
att.setMaximum(-value);
}
else {
att.setMinimum(-value);
att.setMaximum(value);
}
}
else {
att.setMinimum(0.0);
att.setMaximum(1.0);
}
// Get the size of the cube and create the cube
int samps = ui.GetInteger("SAMPLES");
int lines = ui.GetInteger("LINES");
int bands = ui.GetInteger("BANDS");
p.SetOutputCube(ui.GetFileName("TO"), att, samps, lines, bands);
// Make the cube
p.ProcessCubeInPlace(ConstantValueFunctor(value), false);
p.EndProcess();
}
示例7: IsisMain
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
tempFiles.clear();
specificEnergyCorrections.clear();
sampleBasedDarkCorrections.clear();
lineBasedDarkCorrections.clear();
solarRemoveCoefficient = 1.0;
iof = (ui.GetString("UNITS") == "IOF");
calibInfo = PvlGroup("Results");
ProcessByLine p;
Cube *icube = p.SetInputCube("FROM");
bool isVims = true;
try {
isVims = (icube->label()->findGroup("Instrument",
Pvl::Traverse)["InstrumentId"][0] == "VIMS");
}
catch(IException &e) {
isVims = false;
}
if(!isVims) {
QString msg = "The input cube [" + QString(ui.GetAsString("FROM")) + "] is not a Cassini VIMS cube";
throw IException(IException::User, msg, _FILEINFO_);
}
if(icube->label()->findObject("IsisCube").hasGroup("AlphaCube")) {
QString msg = "The input cube [" + QString(ui.GetAsString("FROM")) + "] has had its dimensions modified and can not be calibrated";
throw IException(IException::User, msg, _FILEINFO_);
}
// done first since it's likely to cause an error if one exists
calculateSolarRemove(icube, &p);
if(ui.GetBoolean("DARK"))
calculateDarkCurrent(icube);
chooseFlatFile(icube, &p);
calculateSpecificEnergy(icube);
calibInfo += PvlKeyword("OutputUnits", ((iof) ? "I/F" : "Specific Energy"));
Application::Log(calibInfo);
p.SetOutputCube("TO");
p.StartProcess(calibrate);
p.EndProcess();
for(unsigned int i = 0; i < tempFiles.size(); i++) {
QFile::remove(tempFiles[i]);
}
tempFiles.clear();
}
示例8: getInputs
void HiEqualization::calculateStatistics() {
// TODO member variable
const FileList &imageList = getInputs();
QString maxCubeStr = toString((int) imageList.size());
// Adds statistics for whole and side regions of every cube
vector<Statistics *> statsList;
vector<Statistics *> leftStatsList;
vector<Statistics *> rightStatsList;
for (int img = 0; img < imageList.size(); img++) {
Statistics *stats = new Statistics();
Statistics *statsLeft = new Statistics();
Statistics *statsRight = new Statistics();
QString cubeStr = toString((int) img + 1);
ProcessByLine p;
p.Progress()->SetText("Calculating Statistics for Cube " +
cubeStr + " of " + maxCubeStr);
CubeAttributeInput att;
QString inp = imageList[img].toString();
p.SetInputCube(inp, att);
HiCalculateFunctor func(stats, statsLeft, statsRight, 100.0);
p.ProcessCubeInPlace(func, false);
statsList.push_back(stats);
leftStatsList.push_back(statsLeft);
rightStatsList.push_back(statsRight);
}
// Initialize the object that will calculate the gains and offsets
OverlapNormalization oNorm(statsList);
// Add the known overlaps between two cubes, and apply a weight to each
// overlap equal the number of pixels in the overlapping area
for (int i = 0; i < imageList.size() - 1; i++) {
int j = i + 1;
oNorm.AddOverlap(*rightStatsList[i], i, *leftStatsList[j], j,
rightStatsList[i]->ValidPixels());
}
loadHolds(&oNorm);
// Attempt to solve the least squares equation
oNorm.Solve(OverlapNormalization::Both);
clearAdjustments();
for (int img = 0; img < imageList.size(); img++) {
ImageAdjustment *adjustment = new ImageAdjustment(OverlapNormalization::Both);
adjustment->addGain(oNorm.Gain(img));
adjustment->addOffset(oNorm.Offset(img));
adjustment->addAverage(oNorm.Average(img));
addAdjustment(adjustment);
}
addValid(imageList.size() - 1);
setResults();
}
示例9: IsisMain
void IsisMain () {
ProcessByLine p;
Cube *icube = p.SetInputCube("FROM");
cam = icube->Camera();
maxinc = Application::GetUserInterface().GetDouble("MAXINC");
p.SetOutputCube("TO");
p.StartProcess(divide);
p.EndProcess();
}
示例10: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and output cubes
p.SetInputCube("FROM");
p.SetOutputCube("TO");
// Start the processing
p.StartProcess(mirror);
p.EndProcess();
}
示例11: IsisMain
void IsisMain() {
// Setup the input and output cubes
ProcessByLine p; // used for getting histograms from input cubes
Cube *icube = p.SetInputCube("FROM", Isis::OneBand);
p.SetOutputCube ("TO");
// Histogram parameters
UserInterface &ui = Application::GetUserInterface();
double minimum = ui.GetDouble("MINPER");
double maximum = ui.GetDouble("MAXPER");
int increment = ui.GetInteger("INCREMENT");
// Histograms from input cubes
Histogram *from = icube->Histogram();
Histogram *match = icube->Histogram();
double fromMin = from->Percent(minimum);
double fromMax = from->Percent(maximum);
int fromBins = from->Bins();
double data[fromBins];
double slope = (fromMax - fromMin) / (fromBins - 1);
// Set "match" to have the same data range and number of bins as "to"
match->SetBins(fromBins);
match->SetValidRange(fromMin, fromMax);
for (int i = 0; i < fromBins; i++) {
data[i] = fromMin + (slope * i);
}
match->AddData(data, fromBins);
stretch.ClearPairs();
double lastPer = from->Percent(minimum);
stretch.AddPair(lastPer, match->Percent(minimum));
for (double i = increment+minimum; i < maximum; i += increment) {
double curPer = from->Percent(i);
if (lastPer < curPer) {
if(abs(lastPer - curPer) > DBL_EPSILON) {
stretch.AddPair(curPer, match->Percent(i));
lastPer = curPer;
}
}
}
double curPer = from->Percent(maximum);
if (lastPer < curPer && abs(lastPer - curPer) > DBL_EPSILON) {
stretch.AddPair(curPer, match->Percent(maximum));
}
// Start the processing
p.StartProcess(remap);
p.EndProcess();
}
示例12: IException
/**
* Set the output cube to specified file name and specified input images
* and output attributes and lat,lons
*/
Isis::Cube *ProcessMapMosaic::SetOutputCube(const QString &inputFile, PvlGroup mapping,
CubeAttributeOutput &oAtt, const QString &mosaicFile) {
if (OutputCubes.size() != 0) {
QString msg = "You can only specify one output cube and projection";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
if (mapping.hasKeyword("UpperLeftCornerX"))
mapping.deleteKeyword("UpperLeftCornerX");
if (mapping.hasKeyword("UpperLeftCornerY"))
mapping.deleteKeyword("UpperLeftCornerY");
if (p_createMosaic) {
Pvl newMap;
newMap.addGroup(mapping);
int samps, lines, bands;
delete ProjectionFactory::CreateForCube(newMap, samps, lines, false);
// Initialize the mosaic
ProcessByLine p;
CubeAttributeInput inAtt(inputFile);
Cube *propCube = p.SetInputCube(inputFile, inAtt);
bands = propCube->bandCount();
// If track set, create the origin band
if (GetTrackFlag()) {
bands += 1;
}
// For average priority, get the new band count
else if (GetImageOverlay() == AverageImageWithMosaic) {
bands *= 2;
}
p.PropagateHistory(false);
p.PropagateLabels(false);
Cube *ocube = p.SetOutputCube(mosaicFile, oAtt, samps, lines, bands);
p.Progress()->SetText("Initializing mosaic");
p.ClearInputCubes();
p.StartProcess(ProcessMapMosaic::FillNull);
// CreateForCube created some keywords in the mapping group that needs to be added
ocube->putGroup(newMap.findGroup("Mapping", Pvl::Traverse));
p.EndProcess();
}
Cube *mosaicCube = new Cube();
AddOutputCube(mosaicCube);
mosaicCube->open(mosaicFile, "rw");
mosaicCube->addCachingAlgorithm(new UniqueIOCachingAlgorithm(2));
return mosaicCube;
}
示例13: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and output cubes
p.SetInputCube("FROM");
p.SetOutputCube ("TO");
UserInterface &ui = Application::GetUserInterface();
// Which function is it to be?
string func = ui.GetString ("FUNCTION");
if (func == "COS") Function = COS;
if (func == "SIN") Function = SIN;
if (func == "TAN") Function = TAN;
if (func == "ACOS") Function = ACOS;
if (func == "ASIN") Function = ASIN;
if (func == "ATAN") Function = ATAN;
if (func == "INV") Function = INV;
if (func == "SQRT") Function = SQRT;
if (func == "POW10") Function = POW10;
if (func == "EXP") Function = EXP;
if (func == "XTOY") Function = XTOY;
if (func == "LOG10") Function = LOG10;
if (func == "LN") Function = LN;
if (func == "ABS") Function = ABS;
if (Function == XTOY) {
if (ui.WasEntered ("Y")) {
y = ui.GetDouble("Y");
}
else {
string message = "For the XTOY function, you must enter a value for y";
throw iException::Message(iException::User,message,_FILEINFO_);
}
}
// Start the processing
p.StartProcess(cubefunc);
if (bad != 0) {
PvlGroup results ("Results");
string message = "Invalid input pixels converted to Isis NULL values";
results += PvlKeyword ("Error", message);
results += PvlKeyword ("Count",bad);
Application::Log (results);
}
p.EndProcess();
}
示例14: IsisMain
void IsisMain () {
// Grab the file to import
UserInterface &ui = Application::GetUserInterface();
Filename in = ui.GetFilename("FROM");
Filename out = ui.GetFilename("TO");
// Make sure it is a Clementine EDR
bool projected;
try {
Pvl lab(in.Expanded());
projected = lab.HasObject("IMAGE_MAP_PROJECTION");
iString id;
id = (string)lab["DATA_SET_ID"];
id.ConvertWhiteSpace();
id.Compress();
id.Trim(" ");
if (id.find("CLEM") == string::npos) {
string msg = "Invalid DATA_SET_ID [" + id + "]";
throw iException::Message(iException::Pvl,msg,_FILEINFO_);
}
}
catch (iException &e) {
string msg = "Input file [" + in.Expanded() +
"] does not appear to be " +
"in Clementine EDR format";
throw iException::Message(iException::Io,msg, _FILEINFO_);
}
//Checks if in file is rdr
if( projected ) {
string msg = "[" + in.Name() + "] appears to be an rdr file.";
msg += " Use pds2isis.";
throw iException::Message(iException::User,msg, _FILEINFO_);
}
//Decompress the file
long int lines = 0;
long int samps = 0;
iString filename = in.Expanded();
pdsi = PDSR((char *)filename.c_str(),&lines,&samps);
ProcessByLine p;
CubeAttributeOutput cubeAtt("+unsignedByte+1.0:254.0");
Cube *ocube = p.SetOutputCube(ui.GetFilename("TO"), cubeAtt, pdsi->image_ncols, pdsi->image_nrows);
p.StartProcess (WriteLine);
TranslateLabels(in, ocube);
p.EndProcess ();
}
示例15: IsisMain
void IsisMain() {
// Grab the file to import
UserInterface &ui = Application::GetUserInterface();
FileName in = ui.GetFileName("FROM");
FileName out = ui.GetFileName("TO");
// Make sure it is a Clementine EDR
bool projected;
try {
Pvl lab(in.expanded());
projected = lab.hasObject("IMAGE_MAP_PROJECTION");
QString id;
id = (QString)lab["DATA_SET_ID"];
id = id.simplified().trimmed();
if(!id.contains("CLEM")) {
QString msg = "Invalid DATA_SET_ID [" + id + "]";
throw IException(IException::Unknown, msg, _FILEINFO_);
}
}
catch(IException &e) {
QString msg = "Input file [" + in.expanded() +
"] does not appear to be " +
"in Clementine EDR format";
throw IException(IException::Unknown, msg, _FILEINFO_);
}
//Checks if in file is rdr
if(projected) {
QString msg = "[" + in.name() + "] appears to be an rdr file.";
msg += " Use pds2isis.";
throw IException(IException::User, msg, _FILEINFO_);
}
//Decompress the file
long int lines = 0;
long int samps = 0;
QString filename = in.expanded();
pdsi = PDSR(filename.toAscii().data(), &lines, &samps);
ProcessByLine p;
CubeAttributeOutput cubeAtt("+unsignedByte+1.0:254.0");
Cube *ocube = p.SetOutputCube(ui.GetFileName("TO"), cubeAtt, pdsi->image_ncols, pdsi->image_nrows);
p.StartProcess(WriteLine);
TranslateLabels(in, ocube);
p.EndProcess();
}