bool
RemapWidget::getVolumeInfo(QString volfile,
			   int &skipheaderbytes,
			   uchar &voxelType,
			   int &voxelUnit,
			   float &vx, float &vy, float &vz,
			   QString &description,
			   QList<float> &rawMap,
			   QList<uchar> &pvlMap,
			   int &depth,
			   int &width,
			   int &height)
{
  NcError err(NcError::verbose_nonfatal);

  NcFile pvlFile(volfile.toAscii().data(), NcFile::ReadOnly);

  if (!pvlFile.is_valid())
    {
      QMessageBox::information(0, "Error",
       QString("%1 is not a valid preprocessed volume file").arg(volfile));
      return false;
    }

  int i;
  NcAtt *att;
  char *attval;
  QString pvalue;

  att = pvlFile.get_att("description");
  if (att)
    {
      attval = att->as_string(0);
      description = attval;
      delete [] attval;
    }

  att = pvlFile.get_att("voxeltype");
  if (att)
    {
      attval = att->as_string(0);
      pvalue = attval;
      if (pvalue == "unsigned char")
	voxelType = Raw2Pvl::_UChar;
      if (pvalue == "char")
	voxelType = Raw2Pvl::_Char;
      if (pvalue == "unsigned short")
	voxelType = Raw2Pvl::_UShort;
      if (pvalue == "short")
	voxelType = Raw2Pvl::_Short;
      if (pvalue == "int")
	voxelType = Raw2Pvl::_Int;
      if (pvalue == "float")
	voxelType = Raw2Pvl::_Float;
      delete [] attval;
    }


  att = pvlFile.get_att("voxelunit");
  if (att)
    { 
      attval = att->as_string(0);
      pvalue = attval;
      voxelUnit = Raw2Pvl::_Nounit;
      if (pvalue == "angstrom")
	voxelUnit = Raw2Pvl::_Angstrom;
      else if (pvalue == "nanometer")
	voxelUnit = Raw2Pvl::_Nanometer;
      else if (pvalue == "micron")
	voxelUnit = Raw2Pvl::_Micron;
      else if (pvalue == "millimeter")
	voxelUnit = Raw2Pvl::_Millimeter;
      else if (pvalue == "centimeter")
	voxelUnit = Raw2Pvl::_Centimeter;
      else if (pvalue == "meter")
	voxelUnit = Raw2Pvl::_Meter;
      else if (pvalue == "kilometer")
	voxelUnit = Raw2Pvl::_Kilometer;
      else if (pvalue == "parsec")
	voxelUnit = Raw2Pvl::_Parsec;
      else if (pvalue == "kiloparsec")
	voxelUnit = Raw2Pvl::_Kiloparsec;
      delete [] attval;
    }
  
  
  att = pvlFile.get_att("gridsize");
  if (att)
    {
      depth = att->as_int(0);
      width = att->as_int(1);
      height = att->as_int(2);
    }

  att = pvlFile.get_att("voxelsize");
  if (att)
    {
      vx = att->as_float(0);
      vy = att->as_float(1);
      vz = att->as_float(2);
    }

  att = pvlFile.get_att("skipheaderbytes");
  if (att)
    skipheaderbytes = att->as_int(0);
  
  att = pvlFile.get_att("mapraw");
  if (att)
    {
      for(i=0; i<att->num_vals(); i++)
	rawMap.append(att->as_float(i));
  
      att = pvlFile.get_att("mappvl");
      for(i=0; i<att->num_vals(); i++)
	pvlMap.append(att->as_ncbyte(i));
    }

  pvlFile.close();
  return true;
}