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

Removed 12 prefix and 12 suffix pixels from the ingested mvic tdi image and...

Removed 12 prefix and 12 suffix pixels from the ingested mvic tdi image and adjusted the camera model accordingly

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/isis3NewHorizons@5972 41f8697f-d340-4b68-9986-7bafba869bb8
parent 064d3929
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ void IsisMain() {
  ProcessImportFits pfits;

  pfits.setFitsFile(FileName(ui.GetFileName("FROM")));
  pfits.setProcessFileStructure(0);
  pfits.setProcessFileStructure(ui.GetInteger("IMAGENUMBER"));

  Cube *output = pfits.SetOutputCube("TO");

+23 −5
Original line number Diff line number Diff line
@@ -6,17 +6,20 @@
    Import fits files into Isis format
  </brief>
  <description>
    This program will import fits (Flexible Image Transport System) files into 
    Isis format. Only simple fits files are accepted. Extensions are not 
    support and files with no initial data, NAXIS = 0 , implying extensions with 
    data, are not supported either. Some common header data is transfered to 
    Isis labels. Primary image data is transfered completely and reliably.
    This program will import fits (Flexible Image Transport System) image files into 
    ISIS format. FITS files with extensions are supported upto and including the first  non-image
    extension. Images follwing the first  non-image extension can not be accessed
    (i.e., NAXIS = 0 , implying extensions with data, are not supported). Some common header data
     is transfered to the ISIS labels. Primary image data is transfered completely.
  </description>
  
  <history>
    <change name="Mackenzie Boyd" date="2009-10-27">
      Original version
    </change> 
    <change name="Stuart Sides" date="2014-08-29">
      Added the ability to read image extensions.
    </change> 
  </history>

  <seeAlso>
@@ -61,6 +64,21 @@
        </filter>
      </parameter>
    </group>

    <group name="Controls">
      <parameter name="IMAGENUMBER">
        <type>integer</type>
        <default><item>0</item></default>
        <brief>
          A fits file to be converted to an ISIS cube
        </brief>
        <description>
          Use this parameter to select which image to extract from the FITS file. The primary image
          is 0, the first  image extension is 1, the second image extension is 2, and so on. NOTE: 
          Image extensions following any non-image extension can not be accessed.
        </description>
      </parameter>
    </group>
  </groups>

  <examples>
+70 −0
Original line number Diff line number Diff line
@@ -508,6 +508,56 @@ namespace Isis {
    p_saveDataPost = true;
  };


  /**
   * This method returns the number of file header bytes
   */ 
  int ProcessImport::FileHeaderBytes() const {
    return p_fileHeaderBytes;
  }


  /**
   * This method returns the number of file trailer bytes 
   */ 
  int ProcessImport::FileTrailerBytes() const {
    return p_fileTrailerBytes;
  }


  /**
   * This method returns the number of data header bytes 
   */ 
  int ProcessImport::DataHeaderBytes() const {
    return p_dataHeaderBytes;
  }


  /**
   * This method returns the number of data trailer bytes
   */ 
  int ProcessImport::DataTrailerBytes() const {
    return p_fileTrailerBytes;
  }


  /**
   * This method returns the number of data prefix bytes 
   */ 
  int ProcessImport::DataPrefixBytes() const {
    return p_dataPreBytes;
  }


  /**
   * This method returns the number of data duffix bytes 
   */ 
  int ProcessImport::DataSuffixBytes() const {
    return p_dataPostBytes;
  }



  /**
   * 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
@@ -1051,6 +1101,7 @@ namespace Isis {
    }
  }


  /**
   * Process the import data as a band sequential file.
   *
@@ -1976,5 +2027,24 @@ namespace Isis {
      throw IException(IException::User, msg, _FILEINFO_);
    }
  }


  /**
   * Sets the name of the input file to be read in the import StartProcess
   * method and verifies its existance.
   *
   * @param file The name of the input file to import.
   *
   * @throws Isis::iException::Message "File does not exist."
   */
  QString ProcessImport::InputFile() {
    if (p_inFile.size() <= 0) {
      QString msg = "No input file has been set";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
    return p_inFile;
  }

  
}
+9 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ namespace Isis {
      void StartProcess();
      void StartProcess(void funct(Isis::Buffer &out));
      void SetInputFile(const QString &file);
      QString InputFile();

      // SetOutputCube() is not virtual in the Process class, so the following
      // definitions for this method are the only ones that are allowed for
@@ -212,6 +213,14 @@ namespace Isis {
      void SaveDataTrailer();
      void SaveDataPrefix();
      void SaveDataSuffix();

      int FileHeaderBytes() const;
      int FileTrailerBytes() const;
      int DataHeaderBytes() const;
      int DataTrailerBytes() const;
      int DataPrefixBytes() const;
      int DataSuffixBytes() const;

      char *FileHeader();
      char *FileTrailer();
      std::vector<char *> DataHeader();
+29 −12
Original line number Diff line number Diff line
@@ -61,7 +61,8 @@ namespace Isis {


  /**
   * Extract all the FITS labels from the file. This includes the main and all extensions
   * Extract all the FITS labels from the file. This includes the labels for the main and each 
   * extensions 
   *
   */
  void ProcessImportFits::extractFitsLabels() {
@@ -273,14 +274,25 @@ namespace Isis {


  /**
   * Sets the Process file structure parameters based on the FITS labels of choice 
   * Sets the Process file structure parameters based on the FITS labels of choice. NOTE: The 
   * (DataPrefixBytes + DataSuffixByte) / PixelSize is subtracted from the number of samples before 
   * the output file is created. 
   *  
   * @param labelNumber FITS label number. zero (0) is the first/main label
   * @param labelNumber FITS label number. zero (0) is the first/main label. one (1) is the first 
   * extension, ... 
   * 
   */
  void ProcessImportFits::setProcessFileStructure(int labelNumber) {

    if (labelNumber >= m_fitsLabels->size()) {
      QString msg = QObject::tr("The requested label number, [%1], from file [%2] is "
                                "past the last image in this FITS file [%3]").arg(labelNumber).
                                arg(InputFile()).arg(m_fitsLabels->size()-1);
      throw IException(IException::User, msg, _FILEINFO_);
    }

    PvlGroup label = *(*m_fitsLabels)[labelNumber];
//    std::cout << label << std::endl;

    SetFileHeaderBytes((*m_headerSizes)[labelNumber] * 2880);
    SaveFileHeader();
@@ -299,16 +311,15 @@ namespace Isis {
        msg = "Signed 32 bit integer (int) pixel type is not supported at this time";
        throw IException(IException::User, msg, _FILEINFO_);
        break;
      case -32:
        type = Isis::Real;
        break;
      case 64:
        msg = "Signed 64 bit integer (long) pixel type is not supported at this time";
        throw IException(IException::User, msg, _FILEINFO_);
        break;
      case -32:
        type = Isis::Real;
        break;
      case -64:
        msg = "64 bit floating point (double) pixel type is not supported at this time";
        throw IException(IException::User, msg, _FILEINFO_);
        type = Isis::Double;
        break;
      default:
        msg = "Unknown pixel type [" + label["BITPIX"][0] + "] is not supported for imported";
@@ -319,13 +330,19 @@ namespace Isis {
    SetPixelType(type);

    // It is possible to have a NAXIS value of 0 meaning no data, the file could include
    // xtensions with data, however, those aren't supported yet
    // xtensions with data, however, those aren't supported because we need the code to know
    // how to skip over them.
    // NOTE: FITS files, at least the ones seen till now, do not specify a line prefix or suffix
    // 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 (toInt(label["NAXIS"][0]) == 2) {
      SetDimensions(toInt(label["NAXIS1"][0]), toInt(label["NAXIS2"][0]), 1);
      SetDimensions(toInt(label["NAXIS1"][0]) - (DataPrefixBytes()+DataSuffixBytes())/SizeOf(type),
                    toInt(label["NAXIS2"][0]), 1);
    }
    else if (toInt(label["NAXIS"][0]) == 3) {
      SetDimensions(toInt(label["NAXIS1"][0]), toInt(label["NAXIS2"][0]),
                    toInt(label["NAXIS3"][0]));
      SetDimensions(toInt(label["NAXIS1"][0]) - (DataPrefixBytes()+DataSuffixBytes())/SizeOf(type),
                    toInt(label["NAXIS2"][0]), toInt(label["NAXIS3"][0]));
    }
    else {
      QString msg = "NAXIS count of [" + label["NAXIS"][0] + "] is not supported at this time";
Loading