本文整理汇总了C++中Cube::Lines方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::Lines方法的具体用法?C++ Cube::Lines怎么用?C++ Cube::Lines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::Lines方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckFramelets
/**
* This method performs pass1 on one image. It analyzes each framelet's
* statistics and populates the necessary global variable.
*
* @param progress Progress message
* @param theCube Current cube that needs processing
*
* @return bool True if the file contains a valid framelet
*/
bool CheckFramelets(string progress, Cube &theCube) {
bool foundValidFramelet = false;
LineManager mgr(theCube);
Progress prog;
prog.SetText(progress);
prog.SetMaximumSteps(theCube.Lines());
prog.CheckStatus();
vector<double> frameletAvgs;
// We need to store off the framelet information, because if no good
// framelets were found then no data should be added to the
// global variable for framelets, just files.
vector< pair<int,double> > excludedFrameletsTmp;
Statistics frameletStats;
for(int line = 1; line <= theCube.Lines(); line++) {
if((line-1) % numFrameLines == 0) {
frameletStats.Reset();
}
mgr.SetLine(line);
theCube.Read(mgr);
frameletStats.AddData(mgr.DoubleBuffer(), mgr.size());
if((line-1) % numFrameLines == numFrameLines-1) {
if(IsSpecial(frameletStats.StandardDeviation()) ||
frameletStats.StandardDeviation() > maxStdev) {
excludedFrameletsTmp.push_back(
pair<int,double>((line-1)/numFrameLines, frameletStats.StandardDeviation())
);
}
else {
foundValidFramelet = true;
}
frameletAvgs.push_back(frameletStats.Average());
}
prog.CheckStatus();
}
inputFrameletAverages.push_back(frameletAvgs);
if(foundValidFramelet) {
for(unsigned int i = 0; i < excludedFrameletsTmp.size(); i++) {
excludedFramelets.insert(pair< pair<int,int>, double>(
pair<int,int>(currImage, excludedFrameletsTmp[i].first),
excludedFrameletsTmp[i].second
)
);
}
}
return foundValidFramelet;
}
示例2: IsisMain
void IsisMain() {
latLonGrid = NULL;
// We will be processing by line
ProcessByLine p;
Cube *icube = p.SetInputCube("FROM");
UserInterface &ui = Application::GetUserInterface();
string mode = ui.GetString("MODE");
outline = ui.GetBoolean("OUTLINE");
inputSamples = icube->Samples();
inputLines = icube->Lines();
// Line & sample based grid
if(mode == "IMAGE") {
p.SetOutputCube ("TO");
baseLine = ui.GetInteger("BASELINE");
baseSample = ui.GetInteger("BASESAMPLE");
lineInc = ui.GetInteger("LINC");
sampleInc = ui.GetInteger("SINC");
p.StartProcess(imageGrid);
p.EndProcess();
}
// Lat/Lon based grid
else {
CubeAttributeOutput oatt("+32bit");
p.SetOutputCube (ui.GetFilename("TO"), oatt, icube->Samples(),
icube->Lines(), icube->Bands());
baseLat = ui.GetDouble("BASELAT");
baseLon = ui.GetDouble("BASELON");
latInc = ui.GetDouble("LATINC");
lonInc = ui.GetDouble("LONINC");
UniversalGroundMap *gmap = new UniversalGroundMap(*icube);
latLonGrid = new GroundGrid(gmap, icube->Samples(), icube->Lines());
Progress progress;
progress.SetText("Calculating Grid");
latLonGrid->CreateGrid(baseLat, baseLon, latInc, lonInc, &progress);
p.StartProcess(groundGrid);
p.EndProcess();
delete latLonGrid;
latLonGrid = NULL;
delete gmap;
gmap = NULL;
}
}
示例3: init
/**
* @brief Initializes the object by computing all calibration statistics
*
* This method validates the input file, reads labels for needed values
* and computes calibration statistics for data reduction.
*
* @param [in] (CubeInfo &) cube Opened cube where label and ancillary data
* is read from
*/
void HiImageClean::init(Cube &cube) {
_lines = cube.Lines();
_samples = cube.Samples();
_lastGoodLine = _lines - 1;
_totalMaskNulled = _totalDarkNulled = 0;
PvlGroup &instrument = cube.GetGroup("Instrument");
// It may be too late and a non-issue by this time, but should check to ensure
// this is a valid HiRISE image
iString instId = (std::string) instrument["InstrumentId"];
if (instId.UpCase() != "HIRISE") {
string message = "Image must be a HiRISE image (InstrumentId != HIRISE)";
iException::Message(iException::User, message, _FILEINFO_);
}
// Extract what is needed
_binning = instrument["Summing"];
_tdi = instrument["Tdi"];
_cpmm = instrument["CpmmNumber"];
_channelNo = instrument["ChannelNumber"];
// Initialize all HiRISE calibration blobs
_calimg = blobvert(HiCalibrationImage(cube));
_calbuf = blobvert(HiCalibrationBuffer(cube));
_caldark = blobvert(HiCalibrationDark(cube));
_ancbuf = blobvert(HiAncillaryBuffer(cube));
_ancdark = blobvert(HiAncillaryDark(cube));
// Compute statistics from blobs
computeStats();
return;
}
示例4: IsisMain
void IsisMain() {
//Get user parameters
UserInterface &ui = Application::GetUserInterface();
Filename inFile = ui.GetFilename("FROM");
int numberOfLines = ui.GetInteger("NL");
int lineOverlap = ui.GetInteger("OVERLAP");
//Throws exception if user is dumb
if ( lineOverlap >= numberOfLines ) {
throw iException::Message( iException::User, "The Line Overlap (OVERLAP) must be less than the Number of Lines (LN).", _FILEINFO_ );
}
//Opens the cube
Cube cube;
cube.Open( inFile.Expanded() );
//Loops through, cropping as desired
int cropNum = 1;
int startLine = 1;
bool hasReachedEndOfCube = false;
while ( startLine <= cube.Lines() && not hasReachedEndOfCube ) {
//! Sets up the proper paramaters for running the crop program
string parameters = "FROM=" + inFile.Expanded() +
" TO=" + inFile.Path() + "/" + inFile.Basename() + ".segment" + iString(cropNum) + ".cub"
+ " LINE=" + iString(startLine) + " NLINES=";
if ( startLine + numberOfLines > cube.Lines() ) {
parameters += iString( cube.Lines() - ( startLine - 1 ) );
hasReachedEndOfCube = true;
}
else {
parameters += iString(numberOfLines);
}
Isis::iApp ->Exec("crop",parameters);
//The starting line for next crop
startLine = 1 + cropNum * ( numberOfLines - lineOverlap );
cropNum++;
}
}
示例5: 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");
}
示例6: GatherStatistics
// Gather general statistics on a particular band of a cube
Isis::Statistics GatherStatistics(Cube &icube, const int band,
double sampPercent, std::string maxCubeStr) {
// Create our progress message
iString curCubeStr (g_imageIndex+1);
std::string statMsg = "";
if (icube.Bands() == 1) {
statMsg = "Calculating Statistics for Band 1 in Cube " + curCubeStr +
" of " + maxCubeStr;
}
else {
iString curBandStr (band);
iString maxBandStr (icube.Bands());
statMsg = "Calculating Statistics for Band " + curBandStr + " of " +
maxBandStr + " in Cube " + curCubeStr + " of " + maxCubeStr;
}
int linc = (int) (100.0 / sampPercent + 0.5); // Calculate our line incrementer
// Make sure band is valid
if ((band <= 0) || (band > icube.Bands())) {
string msg = "Invalid band in method [GatherStatistics]";
throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
}
// Construct a line buffer manager and a statistics object
Isis::LineManager line (icube);
Isis::Progress progress;
progress.SetText(statMsg);
// Calculate the number of steps for the Progress object, and add an extra
// step if the total lines and incrementer do not divide evenly
int maxSteps = icube.Lines() / linc;
if (icube.Lines() % linc != 0) maxSteps += 1;
progress.SetMaximumSteps(maxSteps);
progress.CheckStatus();
// Add data to Statistics object by line
Isis::Statistics stats;
int i=1;
while (i<=icube.Lines()) {
line.SetLine(i,band);
icube.Read(line);
stats.AddData (line.DoubleBuffer(), line.size());
// Make sure we consider the last line
if (i+linc > icube.Lines() && i != icube.Lines()) {
i = icube.Lines();
progress.AddSteps(1);
}
else i += linc; // Increment the current line by our incrementer
progress.CheckStatus();
}
return stats;
}
示例7: IsisMain
void IsisMain() {
ProcessRubberSheet p;
// Open the input cube
Cube *icube = p.SetInputCube ("FROM");
// Set up the transform object
UserInterface &ui = Application::GetUserInterface();
Transform *transform = new Rotate(icube->Samples(), icube->Lines(),
ui.GetDouble("DEGREES"));
// Determine the output size
int samples = transform->OutputSamples();
int lines = transform->OutputLines();
// Allocate the output file
p.SetOutputCube ("TO", samples, lines, icube->Bands());
// Set up the interpolator
Interpolator *interp;
if (ui.GetString("INTERP") == "NEARESTNEIGHBOR") {
interp = new Interpolator(Interpolator::NearestNeighborType);
}
else if (ui.GetString("INTERP") == "BILINEAR") {
interp = new Interpolator(Interpolator::BiLinearType);
}
else if (ui.GetString("INTERP") == "CUBICCONVOLUTION") {
interp = new Interpolator(Interpolator::CubicConvolutionType);
}
else {
string msg = "Unknow value for INTERP [" +
ui.GetString("INTERP") + "]";
throw iException::Message(iException::Programmer,msg,_FILEINFO_);
}
p.StartProcess(*transform, *interp);
p.EndProcess();
delete transform;
delete interp;
}
示例8: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and output cubes
Cube *icube = p.SetInputCube("FROM");
p.SetOutputCube ("TO");
// Override the defaults if the user entered a value
UserInterface &ui = Application::GetUserInterface();
top = ui.GetInteger ("TOP");
bottom = ui.GetInteger ("BOTTOM");
lleft = ui.GetInteger ("LEFT");
rright = ui.GetInteger ("RIGHT");
// Will anything be trimmed from the cube?
bool notrim = false;
if (top == 0 && bottom == 0 && lleft == 0 && rright == 0) {
notrim = true;
}
// Adjust bottom and right
bottom = icube->Lines() - bottom;
rright = icube->Samples() - rright;
// Start the processing
p.StartProcess(trim);
p.EndProcess();
//The user didn't trim anything
if (notrim == true) {
string message = "No trimming was done-output equals input file";
throw iException::Message(iException::User,message,_FILEINFO_);
}
}
示例9: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and output cubes
Cube *icube = p.SetInputCube("FROM");
p.SetOutputCube ("TO");
// Get exposure duration and tranfer time
// Override the lable values if the user entered a value
double expTime,xferTime;
UserInterface &ui = Application::GetUserInterface();
if (ui.WasEntered ("DURATION")) {
expTime = ui.GetDouble ("DURATION");
}
else {
PvlGroup grp = icube->GetGroup("ISIS_INSTRUMENT");
expTime = grp["EXPOSURE_DURATION"];
}
if (ui.WasEntered ("TRANSFER")) {
xferTime = ui.GetDouble ("TRANSFER");
}
else {
PvlGroup grp = icube->GetGroup("ISIS_INSTRUMENT");
xferTime = grp["TRANSFER_TIME"];
}
// Calculate the smear scale
smearScale = xferTime / expTime / icube->Lines();
// Start the processing
p.StartProcess(desmear);
p.EndProcess();
}
示例10: IsisMain
// Main program
void IsisMain(){
// Create an object for exporting Isis data
ProcessExport p;
// Open the input cube
Cube *icube = p.SetInputCube("FROM");
// Conform to the Big-Endian format for FITS
if(IsLsb()) p.SetOutputEndian(Isis::Msb);
// Generate the name of the fits file and open it
UserInterface &ui = Application::GetUserInterface();
// specify the bits per pixel
string bitpix;
if (ui.GetString ("BITTYPE") == "8BIT") bitpix = "8";
else if (ui.GetString ("BITTYPE") == "16BIT") bitpix = "16";
else if (ui.GetString ("BITTYPE") == "32BIT") bitpix = "-32";
else {
string msg = "Pixel type of [" + ui.GetString("BITTYPE") + "] is unsupported";
throw iException::Message(iException::User, msg, _FILEINFO_);
}
// Determine bit size and calculate number of bytes to write
// for each line.
if (bitpix == "8") p.SetOutputType(Isis::UnsignedByte);
if (bitpix == "16") p.SetOutputType(Isis::SignedWord);
if (bitpix == "-32") p.SetOutputType(Isis::Real);
// determine core base and multiplier, set up the stretch
PvlGroup pix = icube->Label()->FindObject("IsisCube").FindObject("Core").FindGroup("Pixels");
double scale = pix["Multiplier"][0].ToDouble();
double base = pix["Base"][0].ToDouble();
if (ui.GetString("STRETCH") != "NONE" && bitpix != "-32") {
if (ui.GetString("STRETCH") == "LINEAR") {
p.SetInputRange();
}
else if (ui.GetString("STRETCH") == "MANUAL") {
p.SetInputRange(ui.GetDouble("MINIMUM"), ui.GetDouble("MAXIMUM"));
}
// create a proper scale so pixels look like 32bit data.
scale = ((p.GetInputMaximum() - p.GetInputMinimum()) *
(p.GetOutputMaximum() - p.GetOutputMinimum()));
// round off after 14 decimals to avoid system architecture differences
scale = ((floor(scale * 1e14)) / 1e14);
// create a proper zero point so pixels look like 32bit data.
base = -1.0 * (scale * p.GetOutputMinimum()) + p.GetInputMinimum();
// round off after 14 decimals to avoid system architecture differences
base = ((floor(base * 1e14)) / 1e14);
}
//////////////////////////////////////////
// Write the minimal fits header //
//////////////////////////////////////////
string header;
// specify that this file conforms to simple fits standard
header += FitsKeyword("SIMPLE", true, "T");
// specify the bits per pixel
header += FitsKeyword("BITPIX", true, bitpix);
// specify the number of data axes (2: samples by lines)
int axes = 2;
if (icube->Bands() > 1) {
axes = 3;
}
header += FitsKeyword("NAXIS", true, iString(axes));
// specify the limit on data axis 1 (number of samples)
header += FitsKeyword("NAXIS1", true, iString(icube->Samples()));
// specify the limit on data axis 2 (number of lines)
header += FitsKeyword("NAXIS2", true, iString(icube->Lines()));
if (axes == 3){
header += FitsKeyword("NAXIS3", true, iString(icube->Bands()));
}
header += FitsKeyword("BZERO", true, base);
header += FitsKeyword("BSCALE", true, scale);
// Sky and All cases
if (ui.GetString("INFO") == "SKY" || ui.GetString("INFO") == "ALL") {
iString msg = "cube has not been skymapped";
PvlGroup map;
if (icube->HasGroup("mapping")) {
map = icube->GetGroup("mapping");
msg = (string)map["targetname"];
}
//.........这里部分代码省略.........
示例11: IsisMain
void IsisMain(){
const std::string hical_program = "hicalbeta";
const std::string hical_version = "3.5";
const std::string hical_revision = "$Revision: 1.14 $";
const std::string hical_runtime = Application::DateTime();
UserInterface &ui = Application::GetUserInterface();
string procStep("prepping phase");
try {
// The output from the last processing is the input into subsequent processing
ProcessByLine p;
Cube *hifrom = p.SetInputCube("FROM");
int nsamps = hifrom->Samples();
int nlines = hifrom->Lines();
// Initialize the configuration file
string conf(ui.GetAsString("CONF"));
HiCalConf hiconf(*(hifrom->Label()), conf);
DbProfile hiprof = hiconf.getMatrixProfile();
// Check for label propagation and set the output cube
Cube *ocube = p.SetOutputCube("TO");
if ( !IsTrueValue(hiprof,"PropagateTables", "TRUE") ) {
RemoveHiBlobs(*(ocube->Label()));
}
// Set specified profile if entered by user
if (ui.WasEntered("PROFILE")) {
hiconf.selectProfile(ui.GetAsString("PROFILE"));
}
// Add OPATH parameter to profiles
if (ui.WasEntered("OPATH")) {
hiconf.add("OPATH",ui.GetAsString("OPATH"));
}
else {
// Set default to output directory
hiconf.add("OPATH", Filename(ocube->Filename()).Path());
}
// Do I/F output DN conversions
string units = ui.GetString("UNITS");
// Allocate the calibration list
calVars = new MatrixList;
// Set up access to HiRISE ancillary data (tables, blobs) here. Note it they
// are gone, this will error out. See PropagateTables in conf file.
HiCalData caldata(*hifrom);
////////////////////////////////////////////////////////////////////////////
// FixGaps (Z_f) Get buffer pixels and compute coefficients for equation
// y = a[0] + a[1]*x + a[2] * exp(a[3] * x)
// where y is the average of the buffer pixel region,
// and x is the time at each line in electrons/sec/pixel
procStep = "Zf module";
hiconf.selectProfile("Zf");
hiprof = hiconf.getMatrixProfile();
HiHistory ZfHist;
ZfHist.add("Profile["+ hiprof.Name()+"]");
if ( !SkipModule(hiprof) ) {
DriftBuffer driftB(caldata, hiconf);
calVars->add("Zf", driftB.ref());
ZfHist = driftB.History();
if ( hiprof.exists("DumpModuleFile") ) {
driftB.Dump(hiconf.getMatrixSource("DumpModuleFile",hiprof));
}
}
else {
// NOT RECOMMENDED! This is required for the next step!
// SURELY must be skipped with Z_d step as well!
calVars->add("Zf", HiVector(nlines, 0.0));
ZfHist.add("Debug::SkipModule invoked!");
}
/////////////////////////////////////////////////////////////////////
// DriftCorrect (Z_d)
// Now compute the equation of fit
//
procStep = "Zd module";
HiHistory ZdHist;
hiconf.selectProfile("Zd");
hiprof = hiconf.getMatrixProfile();
ZdHist.add("Profile["+ hiprof.Name()+"]");
if (!SkipModule(hiconf.getMatrixProfile("Zd")) ) {
DriftCorrect driftC(hiconf);
calVars->add("Zd", driftC.Normalize(driftC.Solve(calVars->get("Zf"))));
ZdHist = driftC.History();
if ( hiprof.exists("DumpModuleFile") ) {
driftC.Dump(hiconf.getMatrixSource("DumpModuleFile",hiprof));
}
}
else {
calVars->add("Zd", HiVector(nlines, 0.0));
ZdHist.add("Debug::SkipModule invoked!");
}
//.........这里部分代码省略.........
示例12: IsisMain
void IsisMain() {
// Get the list of cubes to process
FileList imageList;
UserInterface &ui = Application::GetUserInterface();
imageList.Read(ui.GetFilename("FROMLIST"));
// Read to list if one was entered
FileList outList;
if (ui.WasEntered("TOLIST")) {
outList.Read(ui.GetFilename("TOLIST"));
}
// Check for user input errors and return the file list sorted by CCD numbers
ErrorCheck(imageList, outList);
// Adds statistics for whole and side regions of every cube
for (int img=0; img<(int)imageList.size(); img++) {
g_s.Reset();
g_sl.Reset();
g_sr.Reset();
iString maxCube ((int)imageList.size());
iString curCube (img+1);
ProcessByLine p;
p.Progress()->SetText("Gathering Statistics for Cube " +
curCube + " of " + maxCube);
CubeAttributeInput att;
const std::string inp = imageList[img];
p.SetInputCube(inp, att);
p.StartProcess(GatherStatistics);
p.EndProcess();
g_allStats.push_back(g_s);
g_leftStats.push_back(g_sl);
g_rightStats.push_back(g_sr);
}
// Initialize the object that will calculate the gains and offsets
g_oNorm = new OverlapNormalization(g_allStats);
// 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<(int)imageList.size()-1; i++) {
int j = i+1;
g_oNorm->AddOverlap(g_rightStats[i], i, g_leftStats[j], j,
g_rightStats[i].ValidPixels());
}
// Read in and then set the holdlist
FileList holdList;
holdList.Read(ui.GetFilename("HOLD"));
for (unsigned i=0; i<holdList.size(); i++) {
int index = -1;
for (unsigned j=0; j<imageList.size(); j++) {
std::string curName = imageList.at(j);
if (curName.compare(holdList[i]) == 0) {
index = j;
g_oNorm->AddHold(index);
}
}
}
// Attempt to solve the least squares equation
g_oNorm->Solve(OverlapNormalization::Both);
// Apply correction to the cubes if desired
bool applyopt = ui.GetBoolean("APPLY");
if (applyopt) {
// Loop through correcting the gains and offsets by line for every cube
for (int img=0; img<(int)imageList.size(); img++) {
g_imageNum = img;
ProcessByLine p;
iString max_cube ((int)imageList.size());
iString cur_cube (img+1);
p.Progress()->SetText("Equalizing Cube " + cur_cube + " of " + max_cube);
CubeAttributeInput att;
const std::string inp = imageList[img];
Cube *icube = p.SetInputCube(inp, att);
Filename file = imageList[img];
// Establish the output file depending upon whether or not a to list
// was entered
std::string out;
if (ui.WasEntered("TOLIST")) {
out = outList[img];
}
else {
Filename file = imageList[img];
out = file.Path() + "/" + file.Basename() + ".equ." + file.Extension();
}
CubeAttributeOutput outAtt;
p.SetOutputCube(out,outAtt,icube->Samples(),icube->Lines(),icube->Bands());
p.StartProcess(Apply);
p.EndProcess();
}
}
//.........这里部分代码省略.........
示例13: IsisMain
void IsisMain() {
Process p;
// Get the list of names of input CCD cubes to stitch together
FileList flist;
UserInterface &ui = Application::GetUserInterface();
flist.Read(ui.GetFilename("FROMLIST"));
if (flist.size() < 1) {
string msg = "The list file[" + ui.GetFilename("FROMLIST") +
" does not contain any filenames";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
string projection("Equirectangular");
if(ui.WasEntered("MAP")) {
Pvl mapfile(ui.GetFilename("MAP"));
projection = (string) mapfile.FindGroup("Mapping")["ProjectionName"];
}
if(ui.WasEntered("PROJECTION")) {
projection = ui.GetString("PROJECTION");
}
// Gather other user inputs to projection
string lattype = ui.GetString("LATTYPE");
string londir = ui.GetString("LONDIR");
string londom = ui.GetString("LONDOM");
int digits = ui.GetInteger("PRECISION");
// Fix them for mapping group
lattype = (lattype == "PLANETOCENTRIC") ? "Planetocentric" : "Planetographic";
londir = (londir == "POSITIVEEAST") ? "PositiveEast" : "PositiveWest";
Progress prog;
prog.SetMaximumSteps(flist.size());
prog.CheckStatus();
Statistics scaleStat;
Statistics longitudeStat;
Statistics latitudeStat;
Statistics equiRadStat;
Statistics poleRadStat;
PvlObject fileset("FileSet");
// Save major equitorial and polar radii for last occuring
double eqRad;
double eq2Rad;
double poleRad;
string target("Unknown");
for (unsigned int i = 0 ; i < flist.size() ; i++) {
// Set the input image, get the camera model, and a basic mapping
// group
Cube cube;
cube.Open(flist[i]);
int lines = cube.Lines();
int samples = cube.Samples();
PvlObject fmap("File");
fmap += PvlKeyword("Name",flist[i]);
fmap += PvlKeyword("Lines", lines);
fmap += PvlKeyword("Samples", samples);
Camera *cam = cube.Camera();
Pvl mapping;
cam->BasicMapping(mapping);
PvlGroup &mapgrp = mapping.FindGroup("Mapping");
mapgrp.AddKeyword(PvlKeyword("ProjectionName",projection),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("LatitudeType",lattype),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("LongitudeDirection",londir),Pvl::Replace);
mapgrp.AddKeyword(PvlKeyword("LongitudeDomain",londom),Pvl::Replace);
// 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
//.........这里部分代码省略.........
示例14: IsisMain
void IsisMain(){
UserInterface &ui = Application::GetUserInterface();
ProcessByLine proc;
Cube *cube = proc.SetInputCube("FROM");
BigInt npixels(cube->Lines() * cube->Samples());
// Initialize the cleaner routine
try {
delete iclean;
iclean = new HiImageClean(*cube);
}
catch (iException &ie) {
std::string message = "Error attempting to initialize HiRISE cleaner object";
throw (iException::Message(iException::Programmer,message,_FILEINFO_));
}
catch (...) {
std::string message = "Unknown error occured attempting to initialize "
"HiRISE cleaner object";
throw (iException::Message(iException::Programmer,message,_FILEINFO_));
}
// For IR10, channel 1 lets restrict the last 3100 lines of dark current
PvlGroup &instrument = cube->GetGroup("Instrument");
std::string ccd = (std::string) instrument["CcdId"];
int channel = instrument["ChannelNumber"];
if ((ccd == "IR10") && (channel == 1)) {
int bin = instrument["Summing"];
int lastLine = cube->Lines() - ((3100/bin) + iclean->getFilterWidth()/2);
if (lastLine > 1) { iclean->setLastGoodLine(lastLine); }
}
#if defined(DEBUG)
std::cout << "Lines: " << cube->Lines() << " GoodLines: "
<< iclean->getLastGoodLine() << std::endl;
#endif
// Get the output file reference for label update
Cube *ocube = proc.SetOutputCube("TO");
proc.StartProcess(cleanImage);
iclean->propagateBlobs(ocube);
proc.EndProcess();
// Write statistics to file if requested
if (ui.WasEntered("CLEANSTATS")) {
std::string darkfile = ui.GetFilename("CLEANSTATS");
std::ofstream dfile;
dfile.open(darkfile.c_str(), std::ios::out | std::ios::trunc);
dfile << *iclean;
dfile.close();
}
// Dump stats to standard out
Pvl p;
PvlGroup grp;
iclean->PvlImageStats(grp);
p.AddGroup(grp);
Application::Log(grp);
BigInt nNulled = iclean->TotalNulled();
delete iclean;
iclean = 0;
// Check for calibration problems
if (nNulled != 0) {
double tpixels((double) nNulled / (double) npixels);
std::ostringstream mess;
mess << "There were " << nNulled << " of " << npixels << " ("
<< std::setw(6) << std::setprecision(2) << (tpixels * 100.0)
<< "%) due to insufficient calibration data (LUTTED or Gaps)"
<< std::ends;
throw (iException::Message(iException::Math,mess.str(),_FILEINFO_));
}
}
示例15: IsisMain
void IsisMain() {
// Get the camera information
Process p1;
Cube *icube = p1.SetInputCube("FROM",OneBand);
cam = icube->Camera();
// We will be processing by brick.
ProcessByBrick p;
// Find out which bands are to be created
UserInterface &ui = Application::GetUserInterface();
nbands = 0;
if ((phase = ui.GetBoolean("PHASE"))) nbands++;
if ((emission = ui.GetBoolean("EMISSION"))) nbands++;
if ((incidence = ui.GetBoolean("INCIDENCE"))) nbands++;
if ((latitude = ui.GetBoolean("LATITUDE"))) nbands++;
if ((longitude = ui.GetBoolean("LONGITUDE"))) nbands++;
if ((pixelResolution = ui.GetBoolean("PIXELRESOLUTION"))) nbands++;
if ((lineResolution = ui.GetBoolean("LINERESOLUTION"))) nbands++;
if ((sampleResolution = ui.GetBoolean("SAMPLERESOLUTION"))) nbands++;
if ((detectorResolution = ui.GetBoolean("DETECTORRESOLUTION"))) nbands++;
if ((northAzimuth = ui.GetBoolean("NORTHAZIMUTH"))) nbands++;
if ((sunAzimuth = ui.GetBoolean("SUNAZIMUTH"))) nbands++;
if ((spacecraftAzimuth = ui.GetBoolean("SPACECRAFTAZIMUTH"))) nbands++;
if ((offnadirAngle = ui.GetBoolean("OFFNADIRANGLE"))) nbands++;
if (nbands < 1) {
string message = "At least one photometry parameter must be entered"
"[PHASE, EMISSION, INCIDENCE, LATITUDE, LONGITUDE]";
throw iException::Message (iException::User, message, _FILEINFO_);
}
// Create a bandbin group for the output label
PvlKeyword name("Name");
if (phase) name += "Phase Angle";
if (emission) name += "Emission Angle";
if (incidence) name += "Incidence Angle";
if (latitude) name += "Latitude";
if (longitude) name += "Longitude";
if (pixelResolution) name += "Pixel Resolution";
if (lineResolution) name += "Line Resolution";
if (sampleResolution) name += "Sample Resolution";
if (detectorResolution) name += "Detector Resolution";
if (northAzimuth) name += "North Azimuth";
if (sunAzimuth) name += "Sun Azimuth";
if (spacecraftAzimuth) name += "Spacecraft Azimuth";
if (offnadirAngle) name += "OffNadir Angle";
PvlGroup bandBin("BandBin");
bandBin += name;
// Create the output cube. Note we add the input cube to expedite propagation
// of input cube elements (label, blobs, etc...). It *must* be cleared
// prior to systematic processing.
(void) p.SetInputCube("FROM", OneBand);
Cube *ocube = p.SetOutputCube("TO",icube->Samples(), icube->Lines(), nbands);
p.SetBrickSize(64,64,nbands);
p.ClearInputCubes(); // Toss the input file as stated above
// Start the processing
p.StartProcess(phocube);
// Add the bandbin group to the output label. If a BandBin group already
// exists, remove all existing keywords and add the keywords for this app.
// Otherwise, just put the group in.
PvlObject &cobj = ocube->Label()->FindObject("IsisCube");
if (cobj.HasGroup("BandBin")) {
PvlGroup &bb = cobj.FindGroup("BandBin");
bb.Clear();
PvlContainer::PvlKeywordIterator k = bandBin.Begin();
while (k != bandBin.End()) {
bb += *k;
++k;
}
}
else {
ocube->PutGroup(bandBin);
}
p.EndProcess();
}