|
Isis 3.0 Application Source Code Reference |
Home |
00001 #include "Isis.h" 00002 #include "ProcessByLine.h" 00003 #include "SpecialPixel.h" 00004 00005 using namespace std; 00006 using namespace Isis; 00007 00008 void ratio(vector<Buffer *> &in, 00009 vector<Buffer *> &out); 00010 00011 void IsisMain() { 00012 ProcessByLine p; 00013 p.SetInputCube("NUMERATOR"); 00014 p.SetInputCube("DENOMINATOR"); 00015 p.SetOutputCube("TO"); 00016 p.StartProcess(ratio); 00017 p.EndProcess(); 00018 } 00019 00020 // Line processing routine 00021 void ratio(vector<Buffer *> &in, 00022 vector<Buffer *> &out) { 00023 Buffer &num = *in[0]; 00024 Buffer &den = *in[1]; 00025 Buffer &rat = *out[0]; 00026 00027 // Loop for each pixel in the line. Check 00028 // for special pixels and if any are found the 00029 // output will be set to NULL. 00030 for(int i = 0; i < num.size(); i++) { 00031 if(IsSpecial(num[i])) { 00032 rat[i] = NULL8; 00033 } 00034 else if(IsSpecial(den[i])) { 00035 rat[i] = NULL8; 00036 } 00037 else if(den[i] == 0.0) { 00038 rat[i] = NULL8; 00039 } 00040 else { 00041 rat[i] = num[i] / den[i]; 00042 } 00043 } 00044 }