86 m_file.seekg(0, std::ios_base::beg);
90 while (
m_file.read(readBuf, 80) &&
m_file.gcount() == 80) {
100 while (line.substr(0, 3) !=
"END") {
103 if (line.substr(0, 1) !=
" " && line.substr(0, 1) !=
"/") {
109 if (label.name() ==
"COMMENT" || label.name() ==
"HISTORY") {
110 label += line.
ToQt();
114 if (line.substr(0,1) ==
"'") {
124 label += value.
ToQt();
128 if (line.size() > 0) {
130 label.addComment(line.
ToQt());
132 if (line != line.
Token(
"[")) {
155 m_file.seekg(jump, std::ios_base::cur);
165 int bytesPerPixel = 0;
166 bytesPerPixel = (int)((*fitsLabel)[
"BITPIX"]);
167 bytesPerPixel = fabs(bytesPerPixel);
170 unsigned int axis1 = 1;
171 axis1 =
toInt((*fitsLabel)[
"NAXIS1"]);
173 unsigned int axis2 = 1;
175 axis2 =
toInt((*fitsLabel)[
"NAXIS2"]);
178 unsigned int axis3 = 1;
180 axis3 =
toInt((*fitsLabel)[
"NAXIS3"]);
183 jump = (int)(ceil(bytesPerPixel * axis1 * axis2 * axis3 / 2880.0) * 2880.0);
184 m_file.seekg(jump, std::ios_base::cur);
195 QString msg = QObject::tr(
"The FITS file does not contain a section header that looks "
196 "like it describes an image [%1]").arg(
m_name.toString());
212 QString msg = QObject::tr(
"The requested label number [%1], from file [%2] is "
213 "past the last image in this FITS file. Image count is [%3]").arg(labelNumber).
219 QString msg = QObject::tr(
"The FITS label has not been initialized, call setFitsFile first");
223 QString msg = QObject::tr(
"The requested FITS label number does not exist from file [%1]").arg(
m_name.toString());
227 return *(*m_fitsLabels)[labelNumber];
244 inst +=
PvlKeyword(
"StartTime", fitsLabel[
"DATE-OBS"][0]);
247 inst +=
PvlKeyword(
"Target", fitsLabel[
"OBJECT"][0]);
250 inst +=
PvlKeyword(
"InstrumentId", fitsLabel[
"INSTRUME"][0]);
253 inst +=
PvlKeyword(
"SpacecraftName", fitsLabel[
"OBSERVER"][0]);
270 m_file.open(fitsFile.expanded().toLocal8Bit().constData(), std::ios::in | std::ios::binary);
273 QString msg = QObject::tr(
"Unable to open FITS formatted file [%1]").arg(fitsFile.toString());
282 if (label[
"SIMPLE"][0] ==
"F") {
283 QString msg = QObject::tr(
"The file [%1] can not be processed. It is an unsupported format.").
284 arg(fitsFile.toString());
304 QString msg = QObject::tr(
"The requested label number [%1], from file [%2] is "
305 "past the last image in this FITS file [%3]").arg(labelNumber).
310 PvlGroup label = *(*m_fitsLabels)[labelNumber];
320 switch (
toInt(label[
"BITPIX"][0])) {
322 type = Isis::UnsignedByte;
325 type = Isis::SignedWord;
328 msg =
"Signed 32 bit integer (int) pixel type is not supported at this time";
335 msg =
"Signed 64 bit integer (long) pixel type is not supported at this time";
342 msg =
"Unknown pixel type [" + label[
"BITPIX"][0] +
"] is not supported for imported";
357 if (
toInt(label[
"NAXIS"][0]) == 2) {
359 toInt(label[
"NAXIS2"][0]), 1);
361 else if (
toInt(label[
"NAXIS"][0]) == 3) {
363 toInt(label[
"NAXIS2"][0]),
toInt(label[
"NAXIS3"][0]));
366 QString msg =
"NAXIS count of [" + label[
"NAXIS"][0] +
"] is not supported at this time";
372 if (
toInt(label[
"NAXIS"][0]) == 2) {
374 1,
toInt(label[
"NAXIS2"][0]));
376 else if (
toInt(label[
"NAXIS"][0]) == 3) {
378 toInt(label[
"NAXIS3"][0]),
toInt(label[
"NAXIS2"][0]));
381 QString msg =
"NAXIS count of [" + label[
"NAXIS"][0] +
"] is not supported at this time";