48     p_progress->SetText(
"Working");
 
   49     p_propagateLabels = 
true;
 
   50     p_propagateTables = 
true;
 
   51     p_propagatePolygons = 
true;
 
   52     p_propagateHistory = 
true;
 
   53     p_propagateOriginalLabel = 
true;
 
   86     if(att.
bands().size() != 0) {
 
   87       vector<QString> lame = att.
bands();
 
   92       if(requirements & Isis::ReadWrite) {
 
   93         cube->
open(fname, 
"rw");
 
  105     if(requirements & Isis::AllMatchOrOne) {
 
  106       if(InputCubes.size() > 0) {
 
  108           if(cube->
lineCount() != InputCubes[0]->lineCount()) {
 
  109             QString message = 
"The number of lines in the secondary input cubes must match";
 
  110             message += 
" the primary input cube or be exactly one";
 
  116           if(cube->
sampleCount() != InputCubes[0]->sampleCount()) {
 
  117             QString message = 
"The number of samples in the secondary input cubes must match";
 
  118             message += 
" the primary input cube or be exactly one";
 
  123           if(cube->
bandCount() != InputCubes[0]->bandCount()) {
 
  124             QString message = 
"The number of bands in the secondary input cubes must match";
 
  125             message += 
" the primary input cube or be exactly one";
 
  131         requirements = requirements & !Isis::SpatialMatch;
 
  136     if(requirements & Isis::SizeMatch) {
 
  137       if(InputCubes.size() > 0) {
 
  138         if(cube->
lineCount() != InputCubes[0]->lineCount()) {
 
  139           QString message = 
"The number of lines in the input cubes must match";
 
  142         if(cube->
sampleCount() != InputCubes[0]->sampleCount()) {
 
  143           QString message = 
"The number of samples in the input cubes must match";
 
  146         if(cube->
bandCount() != InputCubes[0]->bandCount()) {
 
  147           QString message = 
"The number of bands in the input cubes must match";
 
  154     if(requirements & Isis::SpatialMatch) {
 
  155       if(InputCubes.size() > 0) {
 
  156         if(cube->
lineCount() != InputCubes[0]->lineCount()) {
 
  157           QString message = 
"The number of lines in the input cubes must match";
 
  160         if(cube->
sampleCount() != InputCubes[0]->sampleCount()) {
 
  161           QString message = 
"The number of samples in the input cubes must match";
 
  168     if(requirements & Isis::OneBand) {
 
  170         QString message = 
"Input cube [" + fname + 
"] must have one band";
 
  176     if(requirements & Isis::BandMatchOrOne) {
 
  178         if(InputCubes.size() > 0) {
 
  179           if(cube->
bandCount() != InputCubes[0]->bandCount()) {
 
  180             QString message = 
"The number of bands in the secondary input cubes must match";
 
  181             message += 
" the primary input cube or be exactly one";
 
  203     if(inCube != NULL && inCube->
isOpen()) {
 
  204       AddInputCube(inCube, 
false);
 
  207       QString message = 
"Input cube does not exist";
 
  244                                     const int requirements) {
 
  245     QString fname = Application::GetUserInterface().GetFileName(parameter);
 
  247     return SetInputCube(fname, att, requirements);
 
  266   Isis::Cube *Process::SetOutputCube(
const QString ¶meter) {
 
  268     if(InputCubes.size() == 0) {
 
  269       QString message = 
"No input images have been selected ... therefore";
 
  270       message += 
"the output image size can not be determined";
 
  274     int nl = InputCubes[0]->lineCount();
 
  275     int ns = InputCubes[0]->sampleCount();
 
  276     int nb = InputCubes[0]->bandCount();
 
  277     return SetOutputCube(parameter, ns, nl, nb);
 
  302   Isis::Cube *Process::SetOutputCube(
const QString ¶meter, 
const int ns,
 
  303                                      const int nl, 
const int nb) {
 
  305     if((ns <= 0) || (nl <= 0) || (nb <= 0)) {
 
  306       ostringstream message;
 
  307       message << 
"Invalid cube size specifications [ns=" << ns << 
",nl=" << nl
 
  308               << 
",nb=" << nb << 
"]";
 
  312     QString fname = Application::GetUserInterface().GetFileName(parameter);
 
  314     return SetOutputCube(fname, atts, ns, nl, nb);
 
  336                                      const int ns, 
const int nl,
 
  339     if ((ns <= 0) || (nl <= 0) || (nb <= 0)) {
 
  340       ostringstream message;
 
  341       message << 
"Invalid cube size specifications [ns=" << ns << 
",nl=" << nl
 
  342               << 
",nb=" << nb << 
"]";
 
  355         if(InputCubes.size() > 0) {
 
  359           QString msg = 
"You told me to propagate PixelType from input to output";
 
  360           msg += 
" cube but there are no input cubes loaded";
 
  372         else if(InputCubes.size() == 0) {
 
  373           QString msg = 
"You told me to propagate base/multiplier from input to output";
 
  374           msg += 
" cube but there are no input cubes loaded";
 
  377         else if(cube->
pixelType() >= InputCubes[0]->pixelType()) {
 
  378           double base = InputCubes[0]->base();
 
  379           double mult = InputCubes[0]->multiplier();
 
  382         else if((cube->
pixelType() != Isis::Real) &&
 
  383                 (cube->
pixelType() != Isis::UnsignedByte) &&
 
  384                 (cube->
pixelType() != Isis::UnsignedWord) &&
 
  385                 (cube->
pixelType() != Isis::SignedWord)) {
 
  386           QString msg = 
"Looks like your refactoring to add different pixel types";
 
  387           msg += 
" you'll need to make changes here";
 
  391           QString msg = 
"You've chosen to reduce your output PixelType for [" +
 
  392                        fname + 
"] you must specify the output pixel range too";
 
  401       if(InputCubes.size() > 0) {
 
  402         int needLabBytes = InputCubes[0]->labelSize(
true) + (1024 * 6);
 
  412       if((p_propagateLabels) && (InputCubes.size() > 0)) {
 
  414             InputCubes[0]->label()->
findObject(
"IsisCube");
 
  416         for(
int i = 0; i < incube.
groups(); i++) {
 
  420         if (InputCubes[0]->label()->hasObject(
"NaifKeywords")) {
 
  422               InputCubes[0]->label()->findObject(
"NaifKeywords"));
 
  427       if((p_propagateTables) && (InputCubes.size() > 0)) {
 
  428         Isis::Pvl &inlab = *InputCubes[0]->label();
 
  429         for(
int i = 0; i < inlab.
objects(); i++) {
 
  432             InputCubes[0]->read(t);
 
  439       if((p_propagatePolygons) && (InputCubes.size() > 0)) {
 
  440         Isis::Pvl &inlab = *InputCubes[0]->label();
 
  441         for(
int i = 0; i < inlab.
objects(); i++) {
 
  444             InputCubes[0]->read(t);
 
  451       if((p_propagateOriginalLabel) && (InputCubes.size() > 0)) {
 
  452         Isis::Pvl &inlab = *InputCubes[0]->label();
 
  453         for(
int i = 0; i < inlab.
objects(); i++) {
 
  456             InputCubes[0]->read(ol);
 
  481   void Process::EndProcess() {
 
  489   void Process::Finalize() {
 
  493   void Process::AddInputCube(
Cube *cube, 
bool owned) {
 
  494     InputCubes.push_back(cube);
 
  495     if (owned) m_ownedCubes->insert(cube);
 
  498   void Process::AddOutputCube(Cube *cube, 
bool owned) {
 
  499     OutputCubes.push_back(cube);
 
  500     if (owned) m_ownedCubes->insert(cube);
 
  507   void Process::ClearCubes() {
 
  511     m_ownedCubes->clear();
 
  517   void Process::ClearInputCubes() {
 
  519     for (
unsigned int i = 0; i < InputCubes.size(); i++) {
 
  520       if (m_ownedCubes->contains(InputCubes[i])) {
 
  521         InputCubes[i]->close();
 
  522         delete InputCubes[i];
 
  531   void Process::ClearOutputCubes() {
 
  533     for (
unsigned int i = 0; i < OutputCubes.size(); i++) {
 
  534       if (m_ownedCubes->contains(OutputCubes[i])) {
 
  535         OutputCubes[i]->close();
 
  536         delete OutputCubes[i];
 
  553   void Process::PropagateLabels(
const bool prop) {
 
  554     p_propagateLabels = prop;
 
  564   void Process::PropagateLabels(
const QString &cube) {
 
  569     for(
int i = 0; i < (int)OutputCubes.size(); i++) {
 
  572       Isis::Pvl &outLabels(*OutputCubes[i]->label());
 
  575       for(
int g = 0; g < inCubeLabels.
groups(); g++) {
 
  579       if (inLabels.
hasObject(
"NaifKeywords")) {
 
  592   void Process::PropagateTables(
const bool prop) {
 
  593     p_propagateTables = prop;
 
  612   void Process::PropagateTables(
const QString &fromName, 
const QList<QString> &tableNames) {
 
  614     fromCube->
open(fromName);
 
  615     const Pvl *fromLabels = fromCube->
label();
 
  617     for (
unsigned int i = 0; i < OutputCubes.size(); i++) {
 
  618       for (
int j = 0; j < fromLabels->
objects(); j++) {
 
  621         if (
object.isNamed(
"Table")) {
 
  622           if (tableNames.isEmpty() || tableNames.contains(
object[
"Name"])) { 
 
  623             Blob table((QString) 
object[
"Name"], 
object.name());
 
  624             fromCube->
read(table);
 
  625             OutputCubes[i]->write(table);
 
  639   void Process::PropagatePolygons(
const bool prop) {
 
  640     p_propagatePolygons = prop;
 
  649   void Process::PropagateHistory(
const bool prop) {
 
  650     p_propagateHistory = prop;
 
  660   void Process::PropagateOriginalLabel(
const bool prop) {
 
  661     p_propagateOriginalLabel = prop;
 
  680   QString Process::MissionData(
const QString &mission, 
const QString &file,
 
  681                               bool highestVersion) {
 
  683     QString dir = dataDir[mission];
 
  687     if(!installed.fileExists()) {
 
  688       QString message = 
"Data directory for mission [" + mission + 
"] " +
 
  689                        "is not installed at your site";
 
  694     if(highestVersion) expanded = expanded.highestVersion();
 
  695     return expanded.expanded();
 
  701   void Process::WriteHistory(
Cube &cube) {
 
  702     if(p_propagateHistory) {
 
  703       bool addedHist = 
false;
 
  704       if(InputCubes.size() > 0) {
 
  705         Isis::Pvl & inlab = *InputCubes[0]->label();
 
  706         for(
int i = 0; i < inlab.
objects(); i++) {
 
  707           if(inlab.
object(i).
isNamed(
"History") && Isis::iApp != NULL) {
 
  709             InputCubes[0]->read(h);
 
  717       if(!addedHist && Isis::iApp != NULL) {
 
  735   void Process::CalculateStatistics() {
 
  736     for(
unsigned cubeNum = 0; cubeNum < InputCubes.size(); cubeNum++) {
 
  737       Cube *cube = InputCubes[cubeNum];
 
  747       QString cubeNumStr = 
toString(cubeNum + 1);
 
  748       QString totalCubes = 
toString((
int)InputCubes.size());
 
  749       QString msg = 
"Calculating statistics for cube " + cubeNumStr + 
" of " + totalCubes;
 
  757       vector<Statistics *> allBandStats;
 
  758       for(
int useBand = bandStart; useBand <= bandStop; useBand++) {
 
  761         for(
int i = 1; i <= cube->
lineCount(); i++) {
 
  769         allBandStats.push_back(bandStats);
 
  772       p_bandStats.push_back(allBandStats);
 
  773       p_cubeStats.push_back(cubeStats);
 
PvlObject & object(const int index)
Return the object at the specified index. 
 
bool SetLine(const int line, const int band=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
 
Read and store original labels. 
 
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process. 
 
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes. 
 
bool propagateMinimumMaximum() const 
Return true if the min/max are to be propagated from an input cube. 
 
PixelType pixelType() const 
 
double maximum() const 
Return the output cube attribute maximum. 
 
bool propagatePixelType() const 
Return true if the pixel type is to be propagated from an input cube. 
 
File name manipulation and expansion. 
 
bool isOpen() const 
Test if a cube file has been opened/created. 
 
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes. 
 
Pvl * label() const 
Returns a pointer to the IsisLabel object associated with the cube. 
 
void addGroup(const Isis::PvlGroup &group)
Add a group to the object. 
 
void setFormat(Format format)
Used prior to the Create method, this will specify the format of the cube, either band...
 
void setLabelsAttached(bool attached)
Use prior to calling create, this sets whether or not to use separate label and data files...
 
double * DoubleBuffer() const 
Returns the value of the shape buffer. 
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string. 
 
void read(Blob &blob) const 
This method will read data from the specified Blob object. 
 
void CheckStatus()
Checks and updates the status. 
 
void setDimensions(int ns, int nl, int nb)
Used prior to the Create method to specify the size of the cube. 
 
void addObject(const PvlObject &object)
Add a PvlObject. 
 
Buffer manager, for moving through a cube in lines. 
 
This class is used to accumulate statistics on double arrays. 
 
Program progress reporter. 
 
void setPixelType(PixelType pixelType)
Used prior to the Create method, this will specify the output pixel type. 
 
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed. 
 
int labelSize(bool actual=false) const 
Returns the number of bytes used by the label. 
 
Contains multiple PvlContainers. 
 
#define _FILEINFO_
Macro for the filename and line number. 
 
void setVirtualBands(const QList< QString > &vbands)
This allows the programmer to specify a subset of bands to work with. 
 
int objects() const 
Returns the number of objects. 
 
Manipulate and parse attributes of output cube filenames. 
 
void setBaseMultiplier(double base, double mult)
Used prior to the Create method, this will specify the base and multiplier for converting 8-bit/16-bi...
 
int bandCount() const 
Returns the number of virtual bands for the cube. 
 
Cube::Format fileFormat() const 
Return the file format an Cube::Format. 
 
void open(const QString &cfile, QString access="r")
This method will open an isis cube for reading or reading/writing. 
 
The input label is embedded in the image file. 
 
double minimum() const 
Return the output cube attribute minimum. 
 
Container for cube-like labels. 
 
void setByteOrder(ByteOrder byteOrder)
Used prior to the Create method, this will specify the byte order of pixels, either least or most sig...
 
bool hasObject(const QString &name) const 
Returns a boolean value based on whether the object exists in the current PvlObject or not...
 
int groups() const 
Returns the number of groups contained. 
 
PvlGroup & group(const int index)
Return the group at the specified index. 
 
void setMinMax(double min, double max)
Used prior to the Create method, this will compute a good base and multiplier value given the minimum...
 
int size() const 
Returns the total number of pixels in the shape buffer. 
 
void write(Blob &blob)
This method will write a blob of data (e.g. 
 
void AddEntry()
Adds History PvlObject. 
 
ByteOrder byteOrder() const 
Return the byte order as an Isis::ByteOrder. 
 
bool isNamed(const QString &match) const 
Returns whether the given string is equal to the container name or not. 
 
void AddData(const double *data, const unsigned int count)
Add an array of doubles to the accumulators and counters. 
 
Contains Pvl Groups and Pvl Objects. 
 
void create(const QString &cfile)
This method will create an isis cube for writing. 
 
QString name() const 
Returns the container name. 
 
void setLabelSize(int labelBytes)
Used prior to the Create method, this will allocate a specific number of bytes in the label area for ...
 
IO Handler for Isis Cubes. 
 
PixelType pixelType() const 
Return the pixel type as an Isis::PixelType.