32    QList<PvlGroup *> *fitsImageLabels = 
new QList< PvlGroup * >;
 
   33    QList<PvlGroup *> *extraFitsLabels = 
new QList< PvlGroup * >;
 
   34    QList<int> *headerSizes = 
new QList < int >;
 
   35    QList<int> *dataStarts = 
new QList < int >;
 
   43    fileStream.seekg(0, std::ios_base::beg);
 
   46    while (fileStream.read(readBuf, 80) && fileStream.gcount() == 80) {
 
   56      while (line.substr(0, 3) != 
"END") {
 
   59        if (line.substr(0, 1) != 
" " && line.substr(0, 1) != 
"/") {
 
   62          if (QString::compare(label.
name(), 
"OBJECT", Qt::CaseInsensitive) == 0) {
 
   64            label.
addComment(
"NOTE: This keyword name was changed from 'OBJECT' in the original " 
   70          if (label.
name() == 
"COMMENT" || label.
name() == 
"HISTORY") {
 
   75            if (line.substr(0,1) == 
"'") {
 
   84              label += value.
ToQt();
 
   88            if (line.size() > 2) {
 
   91              if (line != line.
Token(
"[")) {
 
   96          fitsLabel->addKeyword(label);
 
   99        fileStream.read(readBuf, 80);
 
  106      fitsPvl.addGroup(*fitsLabel);
 
  107      headerSizes->append((
int)ceil(place / 2880.0));
 
  110      std::streamoff jump = 0;
 
  111      jump = headerSizes->last() * 2880 - place;
 
  112      fileStream.seekg(jump, std::ios_base::cur);
 
  114      dataStarts->append(fileStream.tellg());
 
  116      if (fitsLabel->hasKeyword(
"BITPIX") && fitsLabel->hasKeyword(
"NAXIS")) {
 
  118        if((
int)fitsLabel->findKeyword(
"NAXIS") > 0) {
 
  119          int bytesPerPixel = 0;
 
  120          bytesPerPixel = (int)((*fitsLabel)[
"BITPIX"]);
 
  121          bytesPerPixel = std::abs(bytesPerPixel);
 
  124          unsigned int axis1 = 1;
 
  125          axis1 = 
toInt((*fitsLabel)[
"NAXIS1"]);
 
  127          unsigned int axis2 = 1;
 
  128          if (fitsLabel->hasKeyword(
"NAXIS2")) {
 
  129            axis2 = 
toInt((*fitsLabel)[
"NAXIS2"]);
 
  132          unsigned int axis3 = 1;
 
  133          if (fitsLabel->hasKeyword(
"NAXIS3")) {
 
  134            axis3 = 
toInt((*fitsLabel)[
"NAXIS3"]);
 
  137          jump = (int)(ceil(bytesPerPixel * axis1 * axis2 * axis3 / 2880.0) * 2880.0);
 
  138          fileStream.seekg(jump, std::ios_base::cur);
 
  146          PvlGroup *extraLabelGroup = fitsImageLabels->last();
 
  147          extraLabelGroup->
setName(
"FitsExtras");
 
  148          extraFitsLabels->append(extraLabelGroup);
 
  150          fitsImageLabels->removeLast();
 
  151          headerSizes->removeLast();
 
  152          dataStarts->removeLast();
 
  154          fitsPvl.addGroup(*extraLabelGroup);
 
  157      else if (fitsImageLabels->size() > 1) {
 
  158        fitsImageLabels->removeLast();
 
  159        headerSizes->removeLast();
 
  160        dataStarts->removeLast();
 
  165        QString msg = QObject::tr(
"The FITS file does not contain a section header that appears " 
  166                                  "to describe an image.");