USGS

Isis 3.0 Application Source Code Reference

Home

bandtrim.cpp

Go to the documentation of this file.
00001 #include "Isis.h"
00002 #include "ProcessByBrick.h"
00003 #include "SpecialPixel.h"
00004 
00005 using namespace std; 
00006 using namespace Isis;
00007 
00008 void BandTrim (Buffer &in, Buffer &out);
00009 
00010 void IsisMain()
00011 {
00012   ProcessByBrick p;
00013   Cube *icube = p.SetInputCube("FROM");
00014   p.SetBrickSize(1, 1, icube->Bands());
00015   p.SetOutputCube ("TO");
00016   p.StartProcess(BandTrim);
00017   p.EndProcess();
00018 }
00019 
00020 // Trim spectral pixels if anyone of them is null
00021 void BandTrim (Buffer &in, Buffer &out){
00022   // Copy input to output and check to see if we should null
00023   bool nullPixels = false;
00024   for (int i=0; i<in.size(); i++) {
00025     out[i] = in[i];
00026     if (in[i] == Isis::Null) nullPixels = true;
00027   } 
00028 
00029   // Null all pixels in the spectra if necessary
00030   if (nullPixels) { 
00031     for (int i=0; i<in.size(); i++) {
00032       out[i] = Isis::Null;
00033     } 
00034   }
00035 }