本文整理汇总了C++中Cube::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::fileName方法的具体用法?C++ Cube::fileName怎么用?C++ Cube::fileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::fileName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: realError
/**
* Constructs a UniversalGroundMap object from a cube
*
* @param cube The Cube to create the UniversalGroundMap from
* @param priority Try to make a camera or projection first
*/
UniversalGroundMap::UniversalGroundMap(Cube &cube, CameraPriority priority) {
p_camera = NULL;
p_projection = NULL;
Pvl &pvl = *cube.label();
try {
if(priority == CameraFirst)
p_camera = CameraFactory::Create(cube);
else
p_projection = Isis::ProjectionFactory::CreateFromCube(pvl);
}
catch (IException &firstError) {
p_camera = NULL;
p_projection = NULL;
try {
if(priority == CameraFirst)
p_projection = Isis::ProjectionFactory::CreateFromCube(pvl);
else
p_camera = CameraFactory::Create(cube);
}
catch (IException &secondError) {
p_projection = NULL;
QString msg = "Could not create camera or projection for [" +
cube.fileName() + "]";
IException realError(IException::Unknown, msg, _FILEINFO_);
realError.append(firstError);
realError.append(secondError);
throw realError;
}
}
}
示例3: IException
QList<ControlPoint *> getValidPoints(Cube &cube, STRtree &coordTree) {
ImagePolygon poly;
try {
cube.read(poly);
}
catch (IException &e) {
QString msg = "Footprintinit must be run prior to running cnetadd";
msg += " with POLYGON=TRUE for cube [" + cube.fileName() + "]";
throw IException(e, IException::User, msg, _FILEINFO_);
}
std::vector<void *> matches;
MultiPolygon *polys = poly.Polys();
for (unsigned int i = 0; i < polys->getNumGeometries(); i++) {
const Geometry *geometry = polys->getGeometryN(i);
const Envelope *boundingBox = geometry->getEnvelopeInternal();
coordTree.query(boundingBox, matches);
}
QList<ControlPoint *> results;
for (unsigned int i = 0; i < matches.size(); i++) {
results.append((ControlPoint *) matches[i]);
}
return results;
}
示例4: init
/**
* @brief Initializes an ISIS cube converting it into a SPICE segment
*
* This method is called to extract the perinent contents of an ISIS cube file
* and accumulate generic information that is used to create the output SPICE
* kernel segment. Other specific kernel types can use this class as its base
* class and add to it additional elements to complete the needed content for
* the NAIF kernel.
*
* @param cube ISIS cube file to accumulate information from
*/
void SpiceSegment::init(Cube &cube) {
_kernels.UnLoad(); // Unload all active, owned kernels
init(); // Init local variables
_fname = cube.fileName();
// Extract ISIS CK blob and transform to CK 3 content
NaifStatus::CheckErrors();
try {
// Order is somewhat important here. The call to initialize Kernels
// object checks the NAIF pool for existance. It logs their NAIF
// status as loaded which may cause trouble from here on...
Pvl *label = cube.label();
_kernels.Init(*label);
Camera *camera = cube.camera();
// Determine segment ID from product ID if it exists, otherwise basename
if ( _name.isEmpty() ) {
_name = getKeyValue(*label, "ProductId");
if (_name.isEmpty() ) {
_name = FileName(_fname).baseName();
}
}
// Get instrument and target ids
QString value("");
value = getKeyValue(*label, "InstrumentId");
if (!value.isEmpty()) { _instId = value; }
value = getKeyValue(*label, "TargetName");
if (!value.isEmpty()) { _target = value; }
// Get default times for sorting purposes
setStartTime(camera->cacheStartTime().Et());
setEndTime(camera->cacheEndTime().Et());
} catch ( IException &ie ) {
ostringstream mess;
mess << "Failed to construct Spice Segment basics from ISIS file " << _fname;
throw IException(ie, IException::User, mess.str(), _FILEINFO_);
}
return;
}
示例5: IsisMain
void IsisMain(){
const QString hical_program = "hicalbeta";
const QString hical_version = "5.0";
const QString hical_revision = "$Revision: 1.15 $";
const QString hical_runtime = Application::DateTime();
UserInterface &ui = Application::GetUserInterface();
QString 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->sampleCount();
int nlines = hifrom->lineCount();
// Initialize the configuration file
QString 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
QString 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);
////////////////////////////////////////////////////////////////////////////
// Drift Correction (Zf) using buffer pixels
// Extracts specified regions of the calibration buffer pixels and runs
// series of lowpass filters. Apply spline fit if any missing data
// remains. Config file contains parameters for this operation.
procStep = "ZeroBufferSmooth module";
hiconf.selectProfile("ZeroBufferSmooth");
hiprof = hiconf.getMatrixProfile();
HiHistory ZbsHist;
ZbsHist.add("Profile["+ hiprof.Name()+"]");
if ( !SkipModule(hiprof) ) {
ZeroBufferSmooth zbs(caldata, hiconf);
calVars->add("ZeroBufferSmooth", zbs.ref());
ZbsHist = zbs.History();
if ( hiprof.exists("DumpModuleFile") ) {
zbs.Dump(hiconf.getMatrixSource("DumpModuleFile",hiprof));
}
}
else {
// NOT RECOMMENDED! This is required for the next step!
// SURELY must be skipped with ZeroBufferSmooth step as well!
calVars->add("ZeroBufferSmooth", HiVector(nlines, 0.0));
ZbsHist.add("Debug::SkipModule invoked!");
}
/////////////////////////////////////////////////////////////////////
// ZeroBufferFit
// Compute second level of drift correction. The high level noise
// is removed from a modeled non-linear fit.
//
procStep = "ZeroBufferFit module";
HiHistory ZbfHist;
hiconf.selectProfile("ZeroBufferFit");
hiprof = hiconf.getMatrixProfile();
ZbfHist.add("Profile["+ hiprof.Name()+"]");
if (!SkipModule(hiprof) ) {
ZeroBufferFit zbf(hiconf);
calVars->add(hiconf.getProfileName(),
zbf.Normalize(zbf.Solve(calVars->get("ZeroBufferSmooth"))));
ZbfHist = zbf.History();
if ( hiprof.exists("DumpModuleFile") ) {
zbf.Dump(hiconf.getMatrixSource("DumpModuleFile",hiprof));
}
}
else {
//.........这里部分代码省略.........
示例6: IsisMain
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
Process p;
// Get the histogram
Cube *icube = p.SetInputCube("FROM");
double validMin = Isis::ValidMinimum;
double validMax = Isis::ValidMaximum;
if(ui.WasEntered("VALIDMIN")) {
validMin = ui.GetDouble("VALIDMIN");
}
if(ui.WasEntered("VALIDMAX")) {
validMax = ui.GetDouble("VALIDMAX");
}
// Set a global Pvl for storing results
Pvl mainpvl;
// Get the number of bands to process
int bandcount = icube->bandCount();
for (int i = 1; i <= bandcount; i++) {
Histogram *stats = icube->histogram(i, validMin, validMax);
// Construct a label with the results
PvlGroup results("Results");
results += PvlKeyword("From", icube->fileName());
results += PvlKeyword("Band", toString(icube->physicalBand(i)));
if(stats->ValidPixels() != 0) {
results += PvlKeyword("Average", toString(stats->Average()));
results += PvlKeyword("StandardDeviation", toString(stats->StandardDeviation()));
results += PvlKeyword("Variance", toString(stats->Variance()));
// These statistics only worked on a histogram
results += PvlKeyword("Median", toString(stats->Median()));
results += PvlKeyword("Mode", toString(stats->Mode()));
results += PvlKeyword("Skew", toString(stats->Skew()));
results += PvlKeyword("Minimum", toString(stats->Minimum()));
results += PvlKeyword("Maximum", toString(stats->Maximum()));
results += PvlKeyword("Sum", toString(stats->Sum()));
}
results += PvlKeyword("TotalPixels", toString(stats->TotalPixels()));
results += PvlKeyword("ValidPixels", toString(stats->ValidPixels()));
results += PvlKeyword("OverValidMaximumPixels", toString(stats->OverRangePixels()));
results += PvlKeyword("UnderValidMinimumPixels", toString(stats->UnderRangePixels()));
results += PvlKeyword("NullPixels", toString(stats->NullPixels()));
results += PvlKeyword("LisPixels", toString(stats->LisPixels()));
results += PvlKeyword("LrsPixels", toString(stats->LrsPixels()));
results += PvlKeyword("HisPixels", toString(stats->HisPixels()));
results += PvlKeyword("HrsPixels", toString(stats->HrsPixels()));
mainpvl.addGroup(results);
delete stats;
// Write the results to the log
Application::Log(results);
}
// Write the results to the output file if the user specified one
if(ui.WasEntered("TO")) {
QString outFile = FileName(ui.GetFileName("TO")).expanded();
bool exists = FileName(outFile).fileExists();
bool append = ui.GetBoolean("APPEND");
ofstream os;
bool writeHeader = false;
//write the results in the requested format.
if(ui.GetString("FORMAT") == "PVL") {
if(append) {
mainpvl.append(outFile);
}
else {
mainpvl.write(outFile);
}
}
else {
//if the format was not PVL, write out a flat file.
if(append) {
os.open(outFile.toAscii().data(), ios::app);
if(!exists) {
writeHeader = true;
}
}
else {
os.open(outFile.toAscii().data(), ios::out);
writeHeader = true;
}
if(writeHeader) {
for(int i = 0; i < mainpvl.group(0).keywords(); i++) {
os << mainpvl.group(0)[i].name();
if( i < mainpvl.group(0).keywords() - 1 ) {
os << ",";
}
}
os << endl;
}
//.........这里部分代码省略.........
示例7: IsisMain
//.........这里部分代码省略.........
useDcconst = ui.WasEntered("DCCONST");
if(useDcconst) {
dcconst = ui.GetDouble("DCCONST");
}
else {
dcconst = 0.0;
}
conv = ui.GetBoolean("CONV");
exposureDuration = icube->group("Instrument")["ExposureDuration"];
offsetModeID = icube->group("Instrument")["OffsetModeID"];
if(((QString)icube->group("Instrument")["FocalPlaneTemperature"]).compare("UNK") == 0) {
//if FocalPlaneTemp is unknown set it to zero
focalPlaneTemp = 0.0;
}
else {
focalPlaneTemp = icube->group("Instrument")["FocalPlaneTemperature"];
}
Camera *cam = icube->camera();
bool camSuccess = cam->SetImage(icube->sampleCount() / 2, icube->lineCount() / 2);
if(!camSuccess) {
throw IException(IException::Unknown, "Unable to calculate the Solar Distance for this cube.", _FILEINFO_);
}
dist = cam->SolarDistance();
// If temp. correction set to true, or focal plane temp is zero then use temperature correction
if(ui.GetBoolean("TCOR") || abs(focalPlaneTemp) <= DBL_EPSILON) {
// Temperature correction requires the use of the mission phase
// (PRELAUNCH, EARTH, LUNAR) and the product ID.
QString productID = (QString)(icube->group("Archive")["ProductID"]);
QChar missionPhase = ((QString)((icube->group("Archive"))["MissionPhase"])).at(0);
QString n1subQString(productID.mid(productID.indexOf('.') + 1, productID.length() - 1));
QString n2subQString(productID.mid(4, productID.indexOf('.') - 5));
int n1 = toInt(n1subQString);
int n2 = toInt(n2subQString);
int phase = 0;
if(missionPhase == 'L') {
phase = 0;
}
else if(missionPhase == 'E') {
phase = 1;
}
else if(missionPhase == 'P') {
phase = 2;
}
else {
throw IException(IException::Unknown, "Invalid Mission Phase", _FILEINFO_);
}
// This formula makes the primary search critera the original product ID's extension,
// the secondary search criteria the mission phase and finally the numerical part of the
// original product ID.
int imageID = (100000 * n1) + (10000 * phase) + n2;
FixTemp(imageID);
}
if(focalPlaneTemp <= 0.0) {
focalPlaneTemp = 272.5;
}
// Start the processing
p.SetBrickSize(icube->sampleCount(), icube->lineCount(), 1);
p.StartProcess(UvVisCal);
// Add the radiometry group
PvlGroup calgrp("Radiometry");
calgrp += PvlKeyword("FlatFieldFile", ffcube->fileName());
if(ui.GetString("DARKCURRENT").compare("DCFILE") == 0) {
calgrp += PvlKeyword("DarkCurrentFile", dccube->fileName());
}
else {
calgrp += PvlKeyword("DarkCurrentConstant", toString(dcconst));
}
calgrp += PvlKeyword("CorrectedFocalPlaneTemp", toString(focalPlaneTemp));
calgrp += PvlKeyword("C1", toString(avgFF));
calgrp += PvlKeyword("C2", toString(C2));
calgrp += PvlKeyword("C3", toString(C3));
calgrp += PvlKeyword("C4", toString(C4));
calgrp += PvlKeyword("C5", toString(C5));
calgrp += PvlKeyword("CR", toString(cr));
calgrp += PvlKeyword("FrameTransferTimePerRow", toString(cr));
calgrp += PvlKeyword("Gain", toString(gain));
calgrp += PvlKeyword("CorrectedExposureDuration", toString(correctedExposureDuration));
calgrp += PvlKeyword("ConvertToRadiance", toString(conv));
calgrp += PvlKeyword("ACO", toString(ACO));
calgrp += PvlKeyword("BCO", toString(BCO));
calgrp += PvlKeyword("CCO", toString(CCO));
calgrp += PvlKeyword("DCO", toString(DCO));
ocube->putGroup(calgrp);
p.EndProcess();
}
示例8: IsisMain
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and make sure it is a mariner10 file
UserInterface & ui = Application::GetUserInterface();
Isis::Pvl lab(ui.GetFileName("FROM"));
Isis::PvlGroup & inst = lab.findGroup("Instrument", Pvl::Traverse);
QString mission = inst["SpacecraftName"];
if (mission != "Mariner_10") {
string msg = "This is not a Mariner 10 image. Mar10cal requires a Mariner 10 image.";
throw IException(IException::User, msg, _FILEINFO_);
}
Cube * icube = p.SetInputCube("FROM", OneBand);
// If it is already calibrated then complain
if (icube->hasGroup("Radiometry")) {
QString msg = "This Mariner 10 image [" + icube->fileName() + "] has "
"already been radiometrically calibrated";
throw IException(IException::User, msg, _FILEINFO_);
}
// Get label parameters we will need for calibration equation
QString instId = inst["InstrumentId"];
QString camera = instId.mid(instId.size()-1);
QString filter = (QString)(icube->group("BandBin"))["FilterName"];
filter = filter.toUpper().mid(0,3);
QString target = inst["TargetName"];
iTime startTime((QString) inst["StartTime"]);
double exposure = inst["ExposureDuration"];
double exposureOffset = 0.0;
if (ui.WasEntered("EXPOFF")) {
exposureOffset = ui.GetDouble("EXPOFF");
}
else {
if (camera == "A") {
exposureOffset = 0.316;
}
else if (camera == "B") {
exposureOffset = 3.060;
}
else {
QString msg = "Camera [" + camera + "] is not supported.";
throw IException(IException::User, msg, _FILEINFO_);
}
}
correctedExp = exposure + exposureOffset;
Cube * dcCube;
if (ui.WasEntered ("DCCUBE") ) {
dcCube = p.SetInputCube("DCCUBE");
}
else {
// Mercury Dark current
// ??? NOTE: Need to find Mark's dc for venus and moon ????
QString dcFile("$mariner10/calibration/mariner_10_" + camera +
"_dc.cub");
CubeAttributeInput cubeAtt;
dcCube = p.SetInputCube(dcFile, cubeAtt);
}
// Open blemish removal file
Cube * blemCube = 0;
useBlem = (ui.GetBoolean("BLEMMASK")) ? true : false;
if (useBlem) {
QString blemFile("$mariner10/calibration/mariner_10_blem_" + camera + ".cub");
CubeAttributeInput cubeAtt;
blemCube = p.SetInputCube(blemFile, cubeAtt);
}
if (filter == "FAB" || filter == "WAF") {
QString msg = "Filter type [" + filter + "] is not supported at this time.";
throw IException(IException::User, msg, _FILEINFO_);
}
if (ui.WasEntered ("COEFCUBE")) {
coCube.open(ui.GetFileName("COEFCUBE"));
}
else {
FileName coFile("$mariner10/calibration/mariner_10_" + filter + "_" +
camera + "_coef.cub");
coCube.open(coFile.expanded());
}
coef = new Brick(icube->sampleCount(), 1, 6, coCube.pixelType());
if (ui.WasEntered("ABSCOEF")) {
absCoef = ui.GetDouble("ABSCOEF");
}
else {
if (camera == "A") {
absCoef = 16.0;
}
//.........这里部分代码省略.........
示例9: IsisMain
// Main moccal routine
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and make sure it is a ctx file
UserInterface &ui = Application::GetUserInterface();
Isis::Pvl lab(ui.GetFileName("FROM"));
Isis::PvlGroup &inst =
lab.findGroup("Instrument", Pvl::Traverse);
QString instId = inst["InstrumentId"];
if(instId != "CTX") {
QString msg = "This is not a CTX image. Ctxcal requires a CTX image.";
throw IException(IException::User, msg, _FILEINFO_);
}
Cube *icube = p.SetInputCube("FROM", OneBand);
Cube flatFile;
if(ui.WasEntered("FLATFILE")) {
flatFile.open(ui.GetFileName("FLATFILE"));
}
else {
FileName flat = FileName("$mro/calibration/ctxFlat_????.cub").highestVersion();
flatFile.open(flat.expanded());
}
flat = new Brick(5000, 1, 1, flatFile.pixelType());
flat->SetBasePosition(1, 1, 1);
flatFile.read(*flat);
// If it is already calibrated then complain
if(icube->hasGroup("Radiometry")) {
QString msg = "The CTX image [" + icube->fileName() + "] has already "
"been radiometrically calibrated";
throw IException(IException::User, msg, _FILEINFO_);
}
// Get label parameters we will need for calibration equation
iTime startTime((QString) inst["StartTime"]);
double etStart = startTime.Et();
// Read exposure and convert to milliseconds
exposure = inst["LineExposureDuration"];
//exposure *= 1000.;
sum = inst["SpatialSumming"];
// If firstSamp > 0, adjust by 38 to account for prefix pixels.
firstSamp = inst["SampleFirstPixel"];
if(firstSamp > 0) firstSamp -= 38;
// Read dark current info, if no dc exit?
Table dcTable("Ctx Prefix Dark Pixels");
icube->read(dcTable);
// TODO:: make sure dc records match cube nlines.
// If summing mode = 1 , average odd & even dc pixels separately for
// a & b channels.
// If summing mode != 1, average all dc pixels and use for both
for(int rec = 0; rec < dcTable.Records(); rec++) {
vector<int> darks = dcTable[rec]["DarkPixels"];
bool aChannel = true;
double dcASum = 0.;
double dcBSum = 0.;
int dcACount = 0;
int dcBCount = 0;
double dcSum = 0;
int dcCount = 0;
for(int i = 0; i < (int)darks.size(); i++) {
if(sum == 1) {
if(aChannel == true) {
dcASum += (double)darks.at(i);
dcACount++;
}
else {
dcBSum += (double)darks.at(i);
dcBCount++;
}
aChannel = !aChannel;
}
else if(sum > 1) {
dcSum += (double)darks.at(i);
dcCount ++;
}
}
if(sum == 1) {
dcA.push_back(dcASum / (double)dcACount);
dcB.push_back(dcBSum / (double)dcBCount);
}
else {
dc.push_back(dcSum / (double)dcCount);
}
}
//.........这里部分代码省略.........
示例10: IsisMain
void IsisMain () {
ResetGlobals();
UserInterface &ui = Application::GetUserInterface();
ProcessByBrick p;
Cube *icube = p.SetInputCube("FROM");
// Make sure it is a WAC cube
Isis::PvlGroup &inst = icube->label()->findGroup("Instrument", Pvl::Traverse);
QString instId = (QString) inst["InstrumentId"];
instId = instId.toUpper();
if (instId != "WAC-VIS" && instId != "WAC-UV") {
QString msg = "This program is intended for use on LROC WAC images only. [";
msg += icube->fileName() + "] does not appear to be a WAC image.";
throw IException(IException::User, msg, _FILEINFO_);
}
// And check if it has already run through calibration
if (icube->label()->findObject("IsisCube").hasGroup("Radiometry")) {
QString msg = "This image has already been calibrated";
throw IException(IException::User, msg, _FILEINFO_);
}
if (icube->label()->findObject("IsisCube").hasGroup("AlphaCube")) {
QString msg = "This application can not be run on any image that has been geometrically transformed (i.e. scaled, rotated, sheared, or reflected) or cropped.";
throw IException(IException::User, msg, _FILEINFO_);
}
g_dark = ui.GetBoolean("DARK");
g_flatfield = ui.GetBoolean("FLATFIELD");
g_radiometric = ui.GetBoolean("RADIOMETRIC");
g_iof = (ui.GetString("RADIOMETRICTYPE") == "IOF");
g_specpix = ui.GetBoolean("SPECIALPIXELS");
g_temprature = ui.GetBoolean("TEMPERATURE");
// Determine the dark/flat files to use
QString offset = (QString) inst["BackgroundOffset"];
QString mode = (QString) inst["Mode"];
QString instModeId = (QString) inst["InstrumentModeId"];
instModeId = instModeId.toUpper();
if (instModeId == "COLOR" && (QString) inst["InstrumentId"] == "WAC-UV")
instModeId = "UV";
else if (instModeId == "VIS")
instModeId = "COLOR";
g_startTemperature = (double) inst["BeginTemperatureFpa"];
g_endTemperature = (double) inst["EndTemperatureFpa"];
g_numFrames = (int) inst["NumFramelets"];
vector<QString> darkFiles;
ui.GetAsString("DARKFILE", darkFiles);
QString flatFile = ui.GetAsString("FLATFIELDFILE");
QString radFile = ui.GetAsString("RADIOMETRICFILE");
QString specpixFile = ui.GetAsString("SPECIALPIXELSFILE");
QString tempFile = ui.GetAsString("TEMPERATUREFILE");
// Figure out which bands are input
for (int i = 1; i <= icube->bandCount(); i++) {
g_bands.push_back(icube->physicalBand(i));
}
Isis::PvlGroup &bandBin = icube->label()->findGroup("BandBin", Pvl::Traverse);
QString filter = (QString) bandBin["Center"][0];
QString filterNum = (QString) bandBin["FilterNumber"][0];
//We have to pay special attention incase we are passed a
//single band image that has been "exploded" from a multiband wac
if (instModeId == "COLOR" && g_bands.size() == 1)
g_bands[0] = (toInt(filterNum) -2);
else if (instModeId == "UV" && g_bands.size() == 1)
g_bands[0] = (toInt(filterNum));
if (g_dark) {
if (darkFiles.size() == 0 || darkFiles[0] =="Default" || darkFiles[0].length() == 0) {
darkFiles.resize(2);
double temp = (double) inst["MiddleTemperatureFpa"];
double time = iTime(inst["StartTime"][0]).Et();
QString darkFile = "$lro/calibration/wac_darks/WAC_" + instModeId;
if (instModeId == "BW")
darkFile += "_" + filter + "_Mode" + mode;
darkFile += "_Offset" + offset + "_*C_*T_Dark.????.cub";
GetDark (darkFile, temp, time, g_darkCube1, g_darkCube2, g_temp1, g_temp2, darkFiles[0], darkFiles[1]);
}
else if (darkFiles.size() == 1) {
CopyCubeIntoBuffer(darkFiles[0], g_darkCube1);
g_temp1 = 0.0;
g_darkCube2 = new Buffer(*g_darkCube1);
g_temp2 = g_temp1;
}
else {
CopyCubeIntoBuffer(darkFiles[0], g_darkCube1);
int index = darkFiles[0].lastIndexOf("_");
g_temp1 = IString(darkFiles[0].mid( darkFiles[0].lastIndexOf("_", index-1), index)).ToDouble();
CopyCubeIntoBuffer(darkFiles[1], g_darkCube2);
index = darkFiles[1].lastIndexOf("_");
g_temp2 = IString(darkFiles[1].mid( darkFiles[1].lastIndexOf("_", index-1), index)).ToDouble();
}
}
//.........这里部分代码省略.........
示例11: IsisMain
// Main moccal routine
void IsisMain() {
// We will be processing by line
ProcessByLine p;
// Setup the input and make sure it is a moc file
UserInterface &ui = Application::GetUserInterface();
Cube *icube = p.SetInputCube("FROM", OneBand);
gbl::moc = new MocLabels(ui.GetFileName("FROM"));
// If it is already calibrated then complain
if(icube->hasGroup("Radiometry")) {
QString msg = "The MOC image [" + icube->fileName() + "] has already "
"been radiometrically calibrated";
throw IException(IException::User, msg, _FILEINFO_);
}
// Get label parameters we will need for calibration equation
gbl::a = gbl::moc->Gain();
gbl::off = gbl::moc->Offset();
gbl::ex = gbl::moc->ExposureDuration();
// Get the starting, ending, and activation et's. For now, the
// activation et is set to the largest double precision value. If
// The narrow angle B detectors ever get activated then the value
// will need to be changed to the appropriate et
iTime startTime(gbl::moc->StartTime());
double etStart = startTime.Et();
double etNABActivation = DBL_MAX;
// Open the calibration kernel that contains constants for each camera
// and internalize it in a pvl object
QString calKernelFile;
if(ui.WasEntered("CALKERNEL")) {
calKernelFile = ui.GetFileName("CALKERNEL");
}
else {
calKernelFile = p.MissionData("mgs", "/calibration/moccal.ker.???", true);
}
Pvl calKernel(calKernelFile);
// Point to the right group of camera parameters
QString camera;
if(gbl::moc->WideAngleRed()) {
camera = "WideAngleRed";
}
else if(gbl::moc->WideAngleBlue()) {
camera = "WideAngleBlue";
}
else if(etStart > etNABActivation) {
camera = "NarrowAngleB";
}
else {
camera = "NarrowAngleA";
}
PvlGroup &calCamera = calKernel.findGroup(camera);
// Get the camera specific calibration parameters from the kernel file
// and load detector coefficients (gain/offsets at each pixel)
gbl::z = calCamera["Z"];
gbl::dc = calCamera["DC"];
gbl::g = calCamera["G"];
gbl::w0 = calCamera["W0"];
QString coefFile = calCamera["CoefFile"];
gbl::LoadCoefficients(coefFile, icube->sampleCount());
#if 0
// Override with these with any user selected parameters
if(ui.WasEntered("Z")) gbl::z = ui.GetDouble("Z");
if(ui.WasEntered("DC")) gbl::dc = ui.GetDouble("DC");
if(ui.WasEntered("G")) gbl::g = ui.GetDouble("G");
if(ui.WasEntered("W0")) gbl::w0 = ui.GetDouble("W0");
#endif
gbl::nullWago = ui.GetBoolean("NULLWAGO");
// Get the distance between Mars and the Sun at the given time in
// Astronomical Units (AU)
QString bspKernel = p.MissionData("base", "/kernels/spk/de???.bsp", true);
furnsh_c(bspKernel.toAscii().data());
QString pckKernel = p.MissionData("base", "/kernels/pck/pck?????.tpc", true);
furnsh_c(pckKernel.toAscii().data());
double sunpos[6], lt;
spkezr_c("sun", etStart, "iau_mars", "LT+S", "mars", sunpos, <);
double dist = vnorm_c(sunpos);
double kmPerAU = 1.4959787066E8;
double sunAU = dist / kmPerAU;
unload_c(bspKernel.toAscii().data());
unload_c(pckKernel.toAscii().data());
// See if the user wants counts/ms or i/f but if w0 is 0 then
// we must go to counts/ms
// iof = conversion factor from counts/ms to i/f
bool convertIOF = ui.GetBoolean("IOF") && (gbl::w0 > 0.0);
if(convertIOF) {
gbl::iof = sunAU * sunAU / gbl::w0;
}
else {
gbl::iof = 1.0;
}
//.........这里部分代码省略.........
示例12: IsisMain
/** The ISIS smtk main application */
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
// Open the first cube. It is the left hand image.
Cube lhImage;
CubeAttributeInput &attLeft = ui.GetInputAttribute("FROM");
vector<QString> bandLeft = attLeft.bands();
lhImage.setVirtualBands(bandLeft);
lhImage.open(ui.GetFileName("FROM"),"r");
// Open the second cube, it is geomertricallty altered. We will be matching the
// first to this one by attempting to compute a sample/line offsets
Cube rhImage;
CubeAttributeInput &attRight = ui.GetInputAttribute("MATCH");
vector<QString> bandRight = attRight.bands();
rhImage.setVirtualBands(bandRight);
rhImage.open(ui.GetFileName("MATCH"),"r");
// Ensure only single bands
if (lhImage.bandCount() != 1 || rhImage.bandCount() != 1) {
QString msg = "Input Cubes must have only one band!";
throw IException(IException::User,msg,_FILEINFO_);
}
// Both images must have a Camera and can also have a Projection. We will
// only deal with a Camera, however as a projected, non-mosaicked image
// uses a Projection internal to the Camera object.
Camera *lhCamera = NULL;
Camera *rhCamera = NULL;
try {
lhCamera = lhImage.camera();
rhCamera = rhImage.camera();
}
catch (IException &ie) {
QString msg = "Both input images must have a camera";
throw IException(ie, IException::User, msg, _FILEINFO_);
}
// Since we are generating a DEM, we must turn off any existing
// DEM that may have been initialized with spiceinit.
lhCamera->IgnoreElevationModel(true);
rhCamera->IgnoreElevationModel(true);
// Get serial number
QString serialLeft = SerialNumber::Compose(lhImage, true);
QString serialRight = SerialNumber::Compose(rhImage, true);
// This still precludes band to band registrations.
if (serialLeft == serialRight) {
QString sLeft = FileName(lhImage.fileName()).name();
QString sRight = FileName(rhImage.fileName()).name();
if (sLeft == sRight) {
QString msg = "Cube Serial Numbers must be unique - FROM=" + serialLeft +
", MATCH=" + serialRight;
throw IException(IException::User,msg,_FILEINFO_);
}
serialLeft = sLeft;
serialRight = sRight;
}
Progress prog;
prog.SetText("Finding Initial Seeds");
int nl = lhImage.lineCount();
int ns = lhImage.sampleCount();
BigInt numAttemptedInitialPoints = 0;
// Declare Gruen matcher
SmtkMatcher matcher(ui.GetFileName("REGDEF"), &lhImage, &rhImage);
// Get line/sample linc/sinc parameters
int space = ui.GetInteger("SPACE");
int linc (space), sinc(space);
// Do we have a seed points from a control net file?
bool useseed = ui.WasEntered("CNET");
// Base points on an input cnet
SmtkQStack gstack;
double lastEigen(0.0);
if (useseed) {
ControlNet cnet(ui.GetFileName("CNET"));
prog.SetMaximumSteps(cnet.GetNumPoints());
prog.CheckStatus();
gstack.reserve(cnet.GetNumPoints());
for (int cpIndex = 0; cpIndex < cnet.GetNumPoints(); cpIndex ++) {
ControlPoint *cp = cnet.GetPoint(cpIndex);
if (!cp->IsIgnored()) {
ControlMeasure *cmLeft(0), *cmRight(0);
for(int cmIndex = 0; cmIndex < cp->GetNumMeasures(); cmIndex ++) {
ControlMeasure *cm = cp->GetMeasure(cmIndex);
if (!cm->IsIgnored()) {
if (cm->GetCubeSerialNumber() == serialLeft)
cmLeft = cp->GetMeasure(cmIndex);
if (cm->GetCubeSerialNumber() == serialRight)
cmRight = cp->GetMeasure(cmIndex);
//.........这里部分代码省略.........