USGS

Isis 3.0 Application Source Code Reference

Home

translate.cpp

Go to the documentation of this file.
00001 #include "Isis.h"
00002 #include "ProcessRubberSheet.h"
00003 
00004 #include "translate.h"
00005 
00006 using namespace std;
00007 using namespace Isis;
00008 
00009 void IsisMain() {
00010   ProcessRubberSheet p;
00011 
00012   // Open the input cube
00013   Cube *icube = p.SetInputCube("FROM");
00014 
00015   // Set up the transform object
00016   UserInterface &ui = Application::GetUserInterface();
00017   Transform *transform = new Translate(icube->getSampleCount(), icube->getLineCount(),
00018                                        ui.GetDouble("STRANS"),
00019                                        ui.GetDouble("LTRANS"));
00020 
00021   // Allocate the output file, same size as input
00022   p.SetOutputCube("TO", icube->getSampleCount(), icube->getLineCount(), icube->getBandCount());
00023 
00024   // Set up the interpolator
00025   Interpolator *interp;
00026   if(ui.GetString("INTERP") == "NEARESTNEIGHBOR") {
00027     interp = new Interpolator(Interpolator::NearestNeighborType);
00028   }
00029   else if(ui.GetString("INTERP") == "BILINEAR") {
00030     interp = new Interpolator(Interpolator::BiLinearType);
00031   }
00032   else if(ui.GetString("INTERP") == "CUBICCONVOLUTION") {
00033     interp = new Interpolator(Interpolator::CubicConvolutionType);
00034   }
00035   else {
00036     string msg = "Unknow value for INTERP [" +
00037                  ui.GetString("INTERP") + "]";
00038     throw iException::Message(iException::Programmer, msg, _FILEINFO_);
00039   }
00040 
00041   p.StartProcess(*transform, *interp);
00042   p.EndProcess();
00043 
00044   delete transform;
00045   delete interp;
00046 }
00047