|
Isis 3.0 Application Source Code Reference |
Home |
00001 #include "Isis.h" 00002 #include "InterestOperator.h" 00003 #include "InterestOperatorFactory.h" 00004 #include "ProcessByBrick.h" 00005 #include "Pixel.h" 00006 #include "Cube.h" 00007 #include "IException.h" 00008 00009 using namespace std; 00010 using namespace Isis; 00011 00012 void Operate(Isis::Buffer &in, Isis::Buffer &out); 00013 00014 InterestOperator *iop; 00015 Cube cube; 00016 int boxcarLines, boxcarSamples; 00017 UniversalGroundMap *unvGMap; 00018 00019 void IsisMain() { 00020 // We will be processing by line 00021 ProcessByBrick p; 00022 p.SetBrickSize(1, 1, 1); 00023 p.SetOutputBrickSize(1, 1, 1); 00024 UserInterface &ui = Application::GetUserInterface(); 00025 00026 // Basic settings 00027 p.SetInputCube("FROM"); 00028 p.SetOutputCube("TO"); 00029 Pvl pvl = Pvl(ui.GetFileName("PVL")); 00030 00031 cube.open(ui.GetFileName("FROM")); 00032 00033 try { 00034 // Get info from the operator group 00035 // Set the pvlkeywords that need to be set to zero 00036 PvlGroup &op = pvl.FindGroup("Operator", Pvl::Traverse); 00037 boxcarSamples = op["Samples"]; 00038 boxcarLines = op["Lines"]; 00039 op["DeltaLine"] = "0"; 00040 op["DeltaSamp"] = "0"; 00041 op["MinimumInterest"] = "0.0"; 00042 Application::Log(op); 00043 } 00044 catch(IException &e) { 00045 QString msg = "Improper format for InterestOperator PVL [" + pvl.FileName() + "]"; 00046 throw IException(e, IException::User, msg, _FILEINFO_); 00047 } 00048 00049 iop = InterestOperatorFactory::Create(pvl); 00050 00051 // Get the universal ground map of this cube 00052 unvGMap = new UniversalGroundMap(cube); 00053 00054 // Start the processing 00055 p.StartProcess(Operate); 00056 p.EndProcess(); 00057 00058 delete unvGMap; 00059 } 00060 00061 // Call Operate once per pixel to get the interest for every pixel in the input cube. 00062 void Operate(Isis::Buffer &in, Isis::Buffer &out) { 00063 try { 00064 int sample = in.Sample(); 00065 int line = in.Line(); 00066 00067 iop->Operate(cube, *unvGMap, sample, line); 00068 00069 out[0] = iop->InterestAmount(); 00070 00071 } 00072 catch(IException &e) { 00073 e.print(); 00074 } 00075 }