Commit dee06306 authored by Stuart Sides's avatar Stuart Sides
Browse files

Changed the file order to BIL for LEISA files and added the needed...

Changed the file order to BIL for LEISA files and added the needed functionality to the Process classes

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/isis3NewHorizons@5978 41f8697f-d340-4b68-9986-7bafba869bb8
parent c7582402
Loading
Loading
Loading
Loading
+41 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ namespace Isis {
    p_fileTrailer = NULL;
  }


  //!  Destroys the Import object
  ProcessImport::~ProcessImport() {
    if (p_fileHeader) {
@@ -159,6 +160,7 @@ namespace Isis {
    }
  };


  /**
   * Sets the byte order of the input file. This must be invoked prior to
   * SetOutputCube.
@@ -169,6 +171,7 @@ namespace Isis {
    p_byteOrder = order;
  };


  /**
   * This method sets the number of bytes in the header of a file.
   * The file header is a block of non-image data at the beginning
@@ -199,6 +202,7 @@ namespace Isis {
    }
  };


  /**
  * This method sets the number of bytes in the trailer of a file.
  * The trailer is a block of non-image data at the end of the
@@ -228,6 +232,7 @@ namespace Isis {
    }
  };


  /**
   * This method sets the number of bytes in the header of each
   * datablock of a file. A data header is a block of non-image
@@ -256,6 +261,7 @@ namespace Isis {
    }
  };


  /**
   * This method sets the number of bytes in the trailer of each
   * datablock of a file. A data trailer is a block of non-image
@@ -286,6 +292,7 @@ namespace Isis {
    }
  };


  /**
   * This method sets the number of bytes at the beginning of each
   * data record of a file. A data prefix is a block of non-image
@@ -315,6 +322,7 @@ namespace Isis {
    }
  };


  /**
   * This method sets the number of bytes at the end of each
   * data record of a file. A data suffix is a block of non-image
@@ -344,6 +352,7 @@ namespace Isis {
    }
  };


  /**
  * This method marks the file header to be saved.  A file
  * header is a block of non-image data at the beginning of the
@@ -370,6 +379,7 @@ namespace Isis {
    p_saveFileHeader = true;
  };


  /**
   * This method marks the file trailer to be saved.  A file
   * trailer is a block of non-image data at the end of the entire
@@ -397,6 +407,7 @@ namespace Isis {
    p_saveFileTrailer = true;
  };


  /**
   * This method marks the data block headers to be saved. A data
   * header is a block of non-image data at the beginning of each
@@ -425,6 +436,7 @@ namespace Isis {
    p_saveDataHeader = true;
  };


  /**
   * This method marks the data block trailers to be saved. A data
   * trailer is a block of non-image data at the end of each data
@@ -453,6 +465,7 @@ namespace Isis {
    p_saveDataTrailer = true;
  };


  /**
   * This method marks the data prefix to be saved.  A data prefix
   * is a block of non-image data at the beginning of each data
@@ -480,6 +493,7 @@ namespace Isis {
    p_saveDataPre = true;
  };


  /**
   * This method marks the data suffix to be saved.  A data
   * suffix is a block of non-image data at the end of each data
@@ -557,7 +571,6 @@ namespace Isis {
  }



  /**
   * This method returns a pointer to the file header.  A file
   * header is a block of non-image data at the beginning of the entire
@@ -584,6 +597,7 @@ namespace Isis {
    throw IException(IException::Programmer, msg, _FILEINFO_);
  };


  /**
   * This method returns a pointer to the file trailer.  A file
   * trailer is a block of non-image data at the end of the entire
@@ -637,6 +651,7 @@ namespace Isis {
    throw IException(IException::Programmer, msg, _FILEINFO_);
  };


  /**
   * This method returns a pointer to the data trailer.  A data
   * trailer is a block of non-image data at the end each data
@@ -664,6 +679,7 @@ namespace Isis {
    throw IException(IException::Programmer, msg, _FILEINFO_);
  };


  /**
   *  This method returns a pointer to the data prefix.  A data
   *  prefix is a block of non-image data at the beginning of each
@@ -691,6 +707,7 @@ namespace Isis {
    throw IException(IException::Programmer, msg, _FILEINFO_);
  };


  /**
   * This method returns a pointer to the data suffix.  A data
   * suffix is a block of non-image data at the end of each data
@@ -718,6 +735,7 @@ namespace Isis {
    throw IException(IException::Programmer, msg, _FILEINFO_);
  };


  /**
   * Sets the organization of the input cube. If not invoked it is assumed
   * Isis::Import::Bsq.
@@ -729,6 +747,16 @@ namespace Isis {
    p_organization = org;
  };


  /**
   * Gets the organization of the input cube. 
   *
   */
  ProcessImport::Interleave ProcessImport::Organization() const {
    return p_organization;
  };


  /**
   * Sets the core base of the input cube. Defaults to zero if not invoked.
   *
@@ -739,6 +767,7 @@ namespace Isis {
    p_base.push_back(base);
  };


  /**
   * Sets band dependent core base
   *
@@ -748,6 +777,7 @@ namespace Isis {
    p_base = base;
  };


  /**
   * Sets the core multiplier of the input cube. Defaults to one if not invoked.
   *
@@ -758,6 +788,7 @@ namespace Isis {
    p_mult.push_back(mult);
  };


  /**
   * Sets band dependent core multiplier
   *
@@ -767,6 +798,7 @@ namespace Isis {
    p_mult = mult;
  };


  /**
   * Sets a mapping of input pixel values to output special pixel values.
   *
@@ -795,6 +827,7 @@ namespace Isis {
    SetHIS(his, his);
  };


  /**
  * Sets the range that will be considered Isis::Null
  *
@@ -811,6 +844,7 @@ namespace Isis {
    p_null_max = null_max;
  }


  /**
  * Sets the range that will be considered Isis::Null
  *
@@ -827,6 +861,7 @@ namespace Isis {
    p_lrs_max = lrs_max;
  }


  /**
  * Sets the range that will be considered Isis::Null
  *
@@ -843,6 +878,7 @@ namespace Isis {
    p_lis_max = lis_max;
  }


  /**
  * Sets the range that will be considered Isis::Null
  *
@@ -859,6 +895,7 @@ namespace Isis {
    p_hrs_max = hrs_max;
  }


  /**
  * Sets the range that will be considered Isis::Null
  *
@@ -942,6 +979,7 @@ namespace Isis {

  }


  /**
  * Tests the pixel. If it is valid it will return the dn value,
  * otherwise it will return the Isis special pixel value that
@@ -974,6 +1012,7 @@ namespace Isis {
    }
  }


  /**
   * Create the output file. Note that all the appropiate calls to at least
   * SetDimensions and SetPixelType should be made prior to calling this method.
@@ -1032,6 +1071,7 @@ namespace Isis {
    return Process::SetOutputCube(Application::GetUserInterface().GetFileName(parameter), att, p_ns, p_nl, p_nb);
  }


  /**
   * Create the output file. Note that all the appropiate calls to at least
   * SetDimensions should be invoked prior to calling this method.
+1 −0
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ namespace Isis {
                                  all bands.*/
      };
      void SetOrganization(const ProcessImport::Interleave org);
      Interleave Organization() const;

      void SetBase(const double base);
      void SetMultiplier(const double mult);
+17 −0
Original line number Diff line number Diff line
@@ -353,6 +353,7 @@ namespace Isis {
    // data byte count. Some FITS files do have them and ISIS needs to remove them so it is not
    // considered part of the DNs. So, use the parent class' prefix/suffix byte count to reduce
    // the number of samples.
    if (Organization() == BSQ) {
      if (toInt(label["NAXIS"][0]) == 2) {
        SetDimensions(toInt(label["NAXIS1"][0]) - (DataPrefixBytes()+DataSuffixBytes())/SizeOf(type),
                      toInt(label["NAXIS2"][0]), 1);
@@ -365,6 +366,22 @@ namespace Isis {
        QString msg = "NAXIS count of [" + label["NAXIS"][0] + "] is not supported at this time";
        throw IException(IException::User, msg, _FILEINFO_);
      }
    }

    if (Organization() == BIL) {
      if (toInt(label["NAXIS"][0]) == 2) {
        SetDimensions(toInt(label["NAXIS1"][0]) - (DataPrefixBytes()+DataSuffixBytes())/SizeOf(type),
                      1, toInt(label["NAXIS2"][0]));
      }
      else if (toInt(label["NAXIS"][0]) == 3) {
        SetDimensions(toInt(label["NAXIS1"][0]) - (DataPrefixBytes()+DataSuffixBytes())/SizeOf(type),
                      toInt(label["NAXIS3"][0]), toInt(label["NAXIS2"][0]));
      }
      else {
        QString msg = "NAXIS count of [" + label["NAXIS"][0] + "] is not supported at this time";
        throw IException(IException::User, msg, _FILEINFO_);
      }
    }

    // Base and multiplier
    if (label.hasKeyword("BZERO")) {
+3 −1
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ void IsisMain() {

  // Get the first label and make sure this is a New Horizons LEISA file
  PvlGroup mainLabel = importFits.fitsLabel(0);
  if (mainLabel["MISSION"][0] != "New Horizons" || mainLabel["INSTRU"][0] != "lei") {
  if (!mainLabel.hasKeyword("MISSION") || !mainLabel.hasKeyword("INSTRU") ||
      mainLabel["MISSION"][0] != "New Horizons" || mainLabel["INSTRU"][0] != "lei") {
    QString msg = QObject::tr("Input file [%1] does not appear to be a New Horizons LEISA FITS "
                              "file. Input file label value for MISSION is [%2], "
                              "INSTRU is [%3]").
@@ -38,6 +39,7 @@ void IsisMain() {
  }

  // This is a seven-extension fits file. Only import the primary image for now.
  importFits.SetOrganization(ProcessImport::BIL);
  importFits.setProcessFileStructure(0);

  Cube *output = importFits.SetOutputCube("TO");
+6 −6
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ using namespace std;
using namespace Isis;

void translateLabels(Pvl &fitsLabel, Cube *ocube);
void flip(Buffer &in);
//void flip(Buffer &in);

void IsisMain() {

@@ -459,9 +459,9 @@ void translateLabels(Pvl &fitsLabel, Cube *ocube) {
}


void flip(Buffer &in) {
  for(int i = 0; i < in.size() / 2; i++) {
    swap(in[i], in[in.size() - i - 1]);
  }
}
//void flip(Buffer &in) {
//  for(int i = 0; i < in.size() / 2; i++) {
//    swap(in[i], in[in.size() - i - 1]);
//  }
//}