Loading isis/src/base/apps/segment/main.cpp +2 −40 Changes for isis/src/base/apps/segment/main.cpp: 2 added lines, 40 removed lines. Original line number Diff line number Diff line #include "Isis.h" #include "Application.h" #include "Cube.h" #include "ProgramLauncher.h" #include "segment.h" using namespace std; using namespace Isis; void IsisMain() { //Get user parameters UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); int numberOfLines = ui.GetInteger("NL"); int lineOverlap = ui.GetInteger("OVERLAP"); //Throws exception if user is dumb if(lineOverlap >= numberOfLines) { throw IException(IException::User, "The Line Overlap (OVERLAP) must be less than the Number of Lines (LN).", _FILEINFO_); } //Opens the cube Cube cube; cube.open(inFile.expanded()); //Loops through, cropping as desired int cropNum = 1; int startLine = 1; bool hasReachedEndOfCube = false; while(startLine <= cube.lineCount() && not hasReachedEndOfCube) { //! Sets up the proper paramaters for running the crop program QString parameters = "FROM=" + inFile.expanded() + " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + toString(cropNum) + ".cub" + " LINE=" + toString(startLine) + " NLINES="; if(startLine + numberOfLines > cube.lineCount()) { parameters += toString(cube.lineCount() - (startLine - 1)); hasReachedEndOfCube = true; } else { parameters += toString(numberOfLines); } ProgramLauncher::RunIsisProgram("crop", parameters); //The starting line for next crop startLine = 1 + cropNum * (numberOfLines - lineOverlap); cropNum++; } segment(ui); } isis/src/base/apps/segment/segment.cpp +52 Changes for isis/src/base/apps/segment/segment.cpp: 52 added lines, 0 removed lines. Original line number Diff line number Diff line #include "Application.h" #include "Cube.h" #include "ProgramLauncher.h" #include "segment.h" using namespace std; namespace Isis { void segment(UserInterface &ui) { Cube *incube = new Cube(); incube->open(ui.GetFileName("FROM")); segment(incube, ui); } void segment(Cube *cube, UserInterface &ui) { //Get user parameters FileName inFile = ui.GetFileName("FROM"); int numberOfLines = ui.GetInteger("NL"); int lineOverlap = ui.GetInteger("OVERLAP"); //Throws exception if user is dumb if(lineOverlap >= numberOfLines) { throw IException(IException::User, "The Line Overlap (OVERLAP) must be less than the Number of Lines (LN).", _FILEINFO_); } //Loops through, cropping as desired int cropNum = 1; int startLine = 1; bool hasReachedEndOfCube = false; while(startLine <= cube->lineCount() && not hasReachedEndOfCube) { //! Sets up the proper paramaters for running the crop program QString parameters = "FROM=" + inFile.expanded() + " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + toString(cropNum) + ".cub" + " LINE=" + toString(startLine) + " NLINES="; if(startLine + numberOfLines > cube->lineCount()) { parameters += toString(cube->lineCount() - (startLine - 1)); hasReachedEndOfCube = true; } else { parameters += toString(numberOfLines); } ProgramLauncher::RunIsisProgram("crop", parameters); //The starting line for next crop startLine = 1 + cropNum * (numberOfLines - lineOverlap); cropNum++; } } } isis/src/base/apps/segment/segment.h +12 Changes for isis/src/base/apps/segment/segment.h: 12 added lines, 0 removed lines. Original line number Diff line number Diff line #ifndef segment_h #define segment_h #include "Cube.h" #include "UserInterface.h" namespace Isis { extern void segment(Cube *cube, UserInterface &ui); extern void segment(UserInterface &ui); } #endif isis/src/base/apps/segment/tsts/Makefile −4 File deleted. Show changes isis/src/base/apps/segment/tsts/boundry/Makefile −8 File deleted. Show changes Loading
isis/src/base/apps/segment/main.cpp +2 −40 Changes for isis/src/base/apps/segment/main.cpp: 2 added lines, 40 removed lines. Original line number Diff line number Diff line #include "Isis.h" #include "Application.h" #include "Cube.h" #include "ProgramLauncher.h" #include "segment.h" using namespace std; using namespace Isis; void IsisMain() { //Get user parameters UserInterface &ui = Application::GetUserInterface(); FileName inFile = ui.GetFileName("FROM"); int numberOfLines = ui.GetInteger("NL"); int lineOverlap = ui.GetInteger("OVERLAP"); //Throws exception if user is dumb if(lineOverlap >= numberOfLines) { throw IException(IException::User, "The Line Overlap (OVERLAP) must be less than the Number of Lines (LN).", _FILEINFO_); } //Opens the cube Cube cube; cube.open(inFile.expanded()); //Loops through, cropping as desired int cropNum = 1; int startLine = 1; bool hasReachedEndOfCube = false; while(startLine <= cube.lineCount() && not hasReachedEndOfCube) { //! Sets up the proper paramaters for running the crop program QString parameters = "FROM=" + inFile.expanded() + " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + toString(cropNum) + ".cub" + " LINE=" + toString(startLine) + " NLINES="; if(startLine + numberOfLines > cube.lineCount()) { parameters += toString(cube.lineCount() - (startLine - 1)); hasReachedEndOfCube = true; } else { parameters += toString(numberOfLines); } ProgramLauncher::RunIsisProgram("crop", parameters); //The starting line for next crop startLine = 1 + cropNum * (numberOfLines - lineOverlap); cropNum++; } segment(ui); }
isis/src/base/apps/segment/segment.cpp +52 Changes for isis/src/base/apps/segment/segment.cpp: 52 added lines, 0 removed lines. Original line number Diff line number Diff line #include "Application.h" #include "Cube.h" #include "ProgramLauncher.h" #include "segment.h" using namespace std; namespace Isis { void segment(UserInterface &ui) { Cube *incube = new Cube(); incube->open(ui.GetFileName("FROM")); segment(incube, ui); } void segment(Cube *cube, UserInterface &ui) { //Get user parameters FileName inFile = ui.GetFileName("FROM"); int numberOfLines = ui.GetInteger("NL"); int lineOverlap = ui.GetInteger("OVERLAP"); //Throws exception if user is dumb if(lineOverlap >= numberOfLines) { throw IException(IException::User, "The Line Overlap (OVERLAP) must be less than the Number of Lines (LN).", _FILEINFO_); } //Loops through, cropping as desired int cropNum = 1; int startLine = 1; bool hasReachedEndOfCube = false; while(startLine <= cube->lineCount() && not hasReachedEndOfCube) { //! Sets up the proper paramaters for running the crop program QString parameters = "FROM=" + inFile.expanded() + " TO=" + inFile.path() + "/" + inFile.baseName() + ".segment" + toString(cropNum) + ".cub" + " LINE=" + toString(startLine) + " NLINES="; if(startLine + numberOfLines > cube->lineCount()) { parameters += toString(cube->lineCount() - (startLine - 1)); hasReachedEndOfCube = true; } else { parameters += toString(numberOfLines); } ProgramLauncher::RunIsisProgram("crop", parameters); //The starting line for next crop startLine = 1 + cropNum * (numberOfLines - lineOverlap); cropNum++; } } }
isis/src/base/apps/segment/segment.h +12 Changes for isis/src/base/apps/segment/segment.h: 12 added lines, 0 removed lines. Original line number Diff line number Diff line #ifndef segment_h #define segment_h #include "Cube.h" #include "UserInterface.h" namespace Isis { extern void segment(Cube *cube, UserInterface &ui); extern void segment(UserInterface &ui); } #endif