OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimAlphaSensorSupportData Class Reference

#include <ossimAlphaSensorSupportData.h>

Inheritance diagram for ossimAlphaSensorSupportData:
ossimObject ossimReferenced

Public Types

enum  PolynomialDegrees {
  MAX_DEGREE = 10, MAX_TERMS = MAX_DEGREE + 1, SCAN_ANGLE_DEG = 2, ROLL_DEG = 7,
  PITCH_DEG = 5, HEADING_DEG = 4, LON_DEG = 2, LAT_DEG = 2,
  ALT_DEG = 2
}
 

Public Member Functions

 ossimAlphaSensorSupportData ()
 
virtual bool readSupportFiles (const ossimFilename &hdrFile)
 
virtual bool readSupportFiles (const ossimEnviHeader &hdr)
 
virtual bool readHdrFile (const ossimFilename &hdrFile)
 
virtual bool readHdrFile (const ossimEnviHeader &hdr)
 
virtual bool readInsGpsFile (const ossimFilename &txtFile)
 
bool isHSI () const
 
const ossimDptgetImageSize () const
 
const ossim_float64getRollBias () const
 
const ossim_float64getPitchBias () const
 
const ossim_float64getHeadingBias () const
 
const ossim_float64getFov () const
 
const ossim_float64getSlitRot () const
 
const std::vector< ossim_float64 > & getRollPoly () const
 
const std::vector< ossim_float64 > & getPitchPoly () const
 
const std::vector< ossim_float64 > & getHeadingPoly () const
 
const std::vector< ossim_float64 > & getLonPoly () const
 
const std::vector< ossim_float64 > & getLatPoly () const
 
const std::vector< ossim_float64 > & getAltPoly () const
 
const std::vector< ossim_float64 > & getScanPoly () const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Protected Member Functions

void reset ()
 
 ossimAlphaSensorSupportData (const ossimAlphaSensorSupportData &src)
 
ossimAlphaSensorSupportDataoperator= (const ossimAlphaSensorSupportData &src)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

bool m_isHSI
 
ossimString m_sensorType
 
ossimDpt m_imageSize
 
ossim_float64 m_rollBias
 
ossim_float64 m_pitchBias
 
ossim_float64 m_headingBias
 
ossim_float64 m_fov
 
ossim_float64 m_slitRot
 
std::vector< ossimPolynom< ossim_float64, 1 >::VAR_TUPLE > m_imgLine
 
std::vector< ossim_float64m_roll
 
std::vector< ossim_float64m_pitch
 
std::vector< ossim_float64m_heading
 
std::vector< ossim_float64m_lon
 
std::vector< ossim_float64m_lat
 
std::vector< ossim_float64m_alt
 
std::vector< ossim_float64m_scanAng
 
std::vector< ossim_float64m_rollPolyCoef
 
std::vector< ossim_float64m_pitchPolyCoef
 
std::vector< ossim_float64m_headingPolyCoef
 
std::vector< ossim_float64m_lonPolyCoef
 
std::vector< ossim_float64m_latPolyCoef
 
std::vector< ossim_float64m_altPolyCoef
 
std::vector< ossim_float64m_scanAngPolyCoef
 

Detailed Description

Definition at line 12 of file ossimAlphaSensorSupportData.h.

Member Enumeration Documentation

◆ PolynomialDegrees

Constructor & Destructor Documentation

◆ ossimAlphaSensorSupportData() [1/2]

ossimAlphaSensorSupportData::ossimAlphaSensorSupportData ( )

Definition at line 14 of file ossimAlphaSensorSupportData.cpp.

References reset().

15  : m_isHSI(false),
16  m_sensorType(),
17  m_imageSize(),
21  m_fov(ossim::nan()),
23  m_imgLine(),
24  m_roll(),
25  m_pitch(),
26  m_heading(),
27  m_lon(),
28  m_lat(),
29  m_alt(),
30  m_scanAng(),
34  m_lonPolyCoef(),
35  m_altPolyCoef(),
37 {
38  reset();
39 }
std::vector< ossim_float64 > m_pitchPolyCoef
std::vector< ossim_float64 > m_alt
std::vector< ossim_float64 > m_headingPolyCoef
std::vector< ossim_float64 > m_heading
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
std::vector< ossim_float64 > m_altPolyCoef
std::vector< ossim_float64 > m_pitch
std::vector< ossim_float64 > m_lat
std::vector< ossim_float64 > m_scanAngPolyCoef
std::vector< ossim_float64 > m_rollPolyCoef
std::vector< ossimPolynom< ossim_float64, 1 >::VAR_TUPLE > m_imgLine
std::vector< ossim_float64 > m_lonPolyCoef
std::vector< ossim_float64 > m_lon
std::vector< ossim_float64 > m_roll
std::vector< ossim_float64 > m_scanAng

◆ ossimAlphaSensorSupportData() [2/2]

ossimAlphaSensorSupportData::ossimAlphaSensorSupportData ( const ossimAlphaSensorSupportData src)
protected

Definition at line 693 of file ossimAlphaSensorSupportData.cpp.

694 {
695 }

Member Function Documentation

◆ getAltPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getAltPoly ( ) const

Definition at line 681 of file ossimAlphaSensorSupportData.cpp.

References m_altPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

682 {
683  return m_altPolyCoef;
684 }
std::vector< ossim_float64 > m_altPolyCoef

◆ getFov()

const ossim_float64 & ossimAlphaSensorSupportData::getFov ( ) const

Definition at line 646 of file ossimAlphaSensorSupportData.cpp.

References m_fov.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

647 {
648  return m_fov;
649 }

◆ getHeadingBias()

const ossim_float64 & ossimAlphaSensorSupportData::getHeadingBias ( ) const

Definition at line 641 of file ossimAlphaSensorSupportData.cpp.

References m_headingBias.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

642 {
643  return m_headingBias;
644 }

◆ getHeadingPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getHeadingPoly ( ) const

Definition at line 666 of file ossimAlphaSensorSupportData.cpp.

References m_headingPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

667 {
668  return m_headingPolyCoef;
669 }
std::vector< ossim_float64 > m_headingPolyCoef

◆ getImageSize()

const ossimDpt & ossimAlphaSensorSupportData::getImageSize ( ) const

◆ getLatPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getLatPoly ( ) const

Definition at line 676 of file ossimAlphaSensorSupportData.cpp.

References m_latPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

677 {
678  return m_latPolyCoef;
679 }
std::vector< ossim_float64 > m_latPolyCoef

◆ getLonPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getLonPoly ( ) const

Definition at line 671 of file ossimAlphaSensorSupportData.cpp.

References m_lonPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

672 {
673  return m_lonPolyCoef;
674 }
std::vector< ossim_float64 > m_lonPolyCoef

◆ getPitchBias()

const ossim_float64 & ossimAlphaSensorSupportData::getPitchBias ( ) const

Definition at line 636 of file ossimAlphaSensorSupportData.cpp.

References m_pitchBias.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

637 {
638  return m_pitchBias;
639 }

◆ getPitchPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getPitchPoly ( ) const

Definition at line 661 of file ossimAlphaSensorSupportData.cpp.

References m_pitchPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

662 {
663  return m_pitchPolyCoef;
664 }
std::vector< ossim_float64 > m_pitchPolyCoef

◆ getRollBias()

const ossim_float64 & ossimAlphaSensorSupportData::getRollBias ( ) const

Definition at line 631 of file ossimAlphaSensorSupportData.cpp.

References m_rollBias.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

632 {
633  return m_rollBias;
634 }

◆ getRollPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getRollPoly ( ) const

Definition at line 656 of file ossimAlphaSensorSupportData.cpp.

References m_rollPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

657 {
658  return m_rollPolyCoef;
659 }
std::vector< ossim_float64 > m_rollPolyCoef

◆ getScanPoly()

const std::vector< ossim_float64 > & ossimAlphaSensorSupportData::getScanPoly ( ) const

Definition at line 686 of file ossimAlphaSensorSupportData.cpp.

References m_scanAngPolyCoef.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

687 {
688  return m_scanAngPolyCoef;
689 }
std::vector< ossim_float64 > m_scanAngPolyCoef

◆ getSlitRot()

const ossim_float64 & ossimAlphaSensorSupportData::getSlitRot ( ) const

Definition at line 651 of file ossimAlphaSensorSupportData.cpp.

References m_slitRot.

Referenced by ossimAlphaSensorHRI::initialize(), and ossimAlphaSensorHSI::initialize().

652 {
653  return m_slitRot;
654 }

◆ isHSI()

bool ossimAlphaSensorSupportData::isHSI ( ) const
inline

◆ operator=()

ossimAlphaSensorSupportData & ossimAlphaSensorSupportData::operator= ( const ossimAlphaSensorSupportData src)
protected

Definition at line 697 of file ossimAlphaSensorSupportData.cpp.

699 {
700  return *this;
701 }

◆ readHdrFile() [1/2]

bool ossimAlphaSensorSupportData::readHdrFile ( const ossimFilename hdrFile)
virtual

Definition at line 177 of file ossimAlphaSensorSupportData.cpp.

References ossimEnviHeader::open().

Referenced by readSupportFiles().

178 {
179  bool result = false;
180  ossimEnviHeader hdr;
181  if ( hdr.open(hdrFile) )
182  {
183  result = readHdrFile( hdr );
184  }
185  return result;
186 }
virtual bool readHdrFile(const ossimFilename &hdrFile)
bool open(const ossimFilename &file)
Opens an envi header.
Class for reading and writing an ENVI (The Environment for Visualizing Images) header file...

◆ readHdrFile() [2/2]

bool ossimAlphaSensorSupportData::readHdrFile ( const ossimEnviHeader hdr)
virtual

Definition at line 188 of file ossimAlphaSensorSupportData.cpp.

References ossimString::contains(), ossimString::empty(), ossimFilename::file(), ossimEnviHeader::getBands(), ossimEnviHeader::getFile(), ossimEnviHeader::getLines(), ossimEnviHeader::getSamples(), ossimEnviHeader::getSensorType(), ossimEnviHeader::getValue(), m_fov, m_headingBias, m_imageSize, m_isHSI, m_pitchBias, m_rollBias, m_sensorType, m_slitRot, ossimString::size(), ossimString::toDouble(), ossimDpt::x, and ossimDpt::y.

189 {
190  bool result = false;
191 
192  while( 1 )
193  {
194  // Required stuff will break from loop if not found/valid.
195 
196  m_sensorType = hdr.getSensorType();
197  if ( m_sensorType.empty() ) break;
198 
199  if ( m_sensorType == "Unknown" )
200  {
201  // Make an assumption from file name...
202  if ( hdr.getFile().file().contains( ossimString("HSI") ) )
203  {
204  m_sensorType = "ACES_YOGI-HSI";
205  }
206  else if ( hdr.getFile().file().contains( ossimString("HRI") ) )
207  {
208  m_sensorType = "ACES_YOGI-HRI2";
209  }
210  }
211 
212  if ( m_sensorType == "Unknown" )
213  {
214  break; // Get out...
215  }
216 
217  // Set the hsi flag:
218  if ( m_sensorType.contains("HSI") || (hdr.getBands() > 7 ) ) // arbitrary...
219  {
220  m_isHSI = true;
221  }
222  else
223  {
224  m_isHSI = false;
225  }
226 
227  m_imageSize.x = hdr.getSamples();
228  m_imageSize.y = hdr.getLines();
229  if ( !m_imageSize.x || !m_imageSize.y ) break;
230 
231  ossimString value;
232 
233  hdr.getValue("roll bias", value);
234  if ( value.size() )
235  {
237  }
238  else
239  {
240  break;
241  }
242 
243  hdr.getValue("pitch bias", value);
244  if ( value.size() )
245  {
247  }
248  else
249  {
250  break;
251  }
252 
253  hdr.getValue("heading bias", value);
254  if ( value.size() )
255  {
257  }
258  else
259  {
260  break;
261  }
262 
263  hdr.getValue("fpa fov deg", value);
264  if ( value.size() )
265  {
266  m_fov = ossimString::toDouble(value);
267  }
268  else
269  {
270  break;
271  }
272 
273  hdr.getValue("slit rotation deg", value);
274  if ( value.size() )
275  {
277  }
278  else
279  {
280  // Removed requirement. Missing in some support data and always 0 when present.
281  if ( traceDebug() )
282  {
284  << "Missing: \"slit rotation deg\"\n";
285  }
286  }
287 
288  if (traceDebug())
289  {
291  << "ossimAlphaSensorSupportData::readHdrFile DEBUG:"
292  << "\n getSensorType = " << m_sensorType
293  << "\n getSamples = " << m_imageSize.x
294  << "\n getLines = " << m_imageSize.y
295  << "\n roll bias = " << m_rollBias
296  << "\n pitch bias = " << m_pitchBias
297  << "\n heading bias = " << m_headingBias
298  << "\n fpa fov deg = " << m_fov
299  << "\n slit rotation deg = " << m_slitRot
300  << "\n";
301  }
302 
303  // Last two lines of while forever. If we get here, set status true and break out.
304  result = true;
305  break;
306  }
307 
308  return result;
309 
310 } // End: bool ossimAlphaSensorSupportData::readHdrFile(const ossimEnviHeader& )
double y
Definition: ossimDpt.h:165
bool contains(char aChar) const
Definition: ossimString.h:58
const ossimFilename & getFile() const
ossim_uint32 getLines() const
std::string::size_type size() const
Definition: ossimString.h:405
ossim_uint32 getBands() const
double toDouble() const
ossim_uint32 getSamples() const
ossimString getSensorType() const
double x
Definition: ossimDpt.h:164
bool empty() const
Definition: ossimString.h:411
bool getValue(const ossimString &key, ossimString &value) const
Gets value for key.
ossimFilename file() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ readInsGpsFile()

bool ossimAlphaSensorSupportData::readInsGpsFile ( const ossimFilename txtFile)
virtual

Definition at line 312 of file ossimAlphaSensorSupportData.cpp.

Referenced by readSupportFiles().

313 {
314  bool result = true;
315 
316  static const char M[] = "ossimAlphaSensorSupportData::readInsGpsFile";
317 
318  if (traceDebug())
319  {
321  << M << " entered:\n" << "file: " << file << "\n";
322  }
323 
324  std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->
325  createIstream( file, std::ios_base::in);
326 
327  if ( in && in->good() )
328  {
329  ossim_float64 inum;
330  ossim_float64 roll;
331  ossim_float64 pitch;
332  ossim_float64 heading;
333  ossim_float64 lon;
334  ossim_float64 lat;
335  ossim_float64 alt;
336  ossim_float64 scanAng;
337  int res;
338  int frm;
339  const ossim_float64 BOGUS = -99999.0; // To detect read error/missing value.
340  ossim_float64 timeCode = BOGUS;
341 
342  std::vector< ossim_uint32 > lines;
343 
344  if (traceDebug())
345  {
347  << "ossimAlphaSensorSupportData::readInsGpsFile DEBUG:" << std::endl;
348  ossimNotify(ossimNotifyLevel_DEBUG)<<std::setprecision(8);
349  ossimNotify(ossimNotifyLevel_DEBUG)<<std::setiosflags(std::ios_base::scientific);
350 
351  }
352 
353  // Format: line,roll,pitch,heading,lon,lat,alt,scanAngle,reserved,frame,time
354 
355  // Check the first line. Some data has a phantom line, some starts with good data.
356  std::string line1;
357  std::getline( *in, line1 );
358  ossim_uint32 fields = 0;
359  if ( line1.size() )
360  {
361  std::string s;
362  std::istringstream tmpStr( line1 );
363  while ( !tmpStr.eof() )
364  {
365  tmpStr >> s;
366  if ( s.size() )
367  {
368  ++fields;
369  s.clear();
370  }
371  }
372  if ( fields == 11 )
373  {
374  // First line is valid.
375  in->seekg( 0, std::ios_base::beg );
376  }
377  }
378 
379  while( !in->eof() )
380  {
381  // To detect read error/missing value. Check eof was missing last line.
382  timeCode = BOGUS;
383 
384  *in >> inum >> roll >> pitch >> heading >> lon >> lat
385  >> alt >> scanAng >> res >> frm >> timeCode;
386 
387  // if(!in.eof())
388  if ( timeCode != BOGUS )
389  {
390  lines.push_back(inum);
391  m_roll.push_back(roll);
392  m_pitch.push_back(pitch);
393  m_heading.push_back(heading);
394  m_lon.push_back(lon);
395  m_lat.push_back(lat);
396  m_alt.push_back(alt);
397  m_scanAng.push_back(scanAng);
398  }
399  }
400 
401  // Make sure we have a value per line
402  if( (lines.size() < m_imageSize.y) || (lines.size() < 10) )
403  {
404  return false;
405  }
406 
407  // Load independent variable (line number, referenced to first line)
408  vector< ossimPolynom< ossim_float64 , 1 >::VAR_TUPLE >::iterator pit;
409  m_imgLine.resize(lines.size());
410  int j;
411  for (pit=m_imgLine.begin(), j=0; pit!=m_imgLine.end(); ++pit,++j)
412  {
413  pit->push_back(lines[j]-lines[0]);
414  }
415 
416  // Dependent variable solutions follow...
417  double rms=0.0;
418 
419  // Exponent sets
420  std::vector< ossimPolynom<ossim_float64,1>::EXPT_SET > expSet;
421  expSet.resize(MAX_TERMS);
423  for (int numExp=1; numExp<=MAX_TERMS; ++numExp)
424  {
425  for(int o=0; o<numExp ; ++o)
426  {
427  et[0]=o;
428  expSet[numExp-1].insert(et);
429  }
430  }
431 
432  // Polynomial classes
433  // scanAngle
435  // orientation angles (roll, pitch, heading)
439  // position (longitude, latitude, altitude)
443 
444  // Solve for polynomial coefficients
445  if (m_isHSI)
446  {
447  result = saPoly.SLSfit(expSet[SCAN_ANGLE_DEG], m_imgLine, m_scanAng, &rms);
448  if (traceDebug())
449  {
451  << "\n SA poly deg, rms error = "
452  << SCAN_ANGLE_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
453  }
454  }
455  if (result)
456  {
457  result = rPoly.SLSfit(expSet[ROLL_DEG], m_imgLine, m_roll, &rms);
458  if (traceDebug())
459  {
461  << "\n R poly deg, rms error = "
462  << ROLL_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
463  }
464 
465  if (result)
466  {
467  result = pPoly.SLSfit(expSet[PITCH_DEG], m_imgLine, m_pitch, &rms);
468  if (traceDebug())
469  {
471  << "\n P poly deg, rms error = "
472  << PITCH_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
473  }
474 
475  if (result)
476  {
477  result = hPoly.SLSfit(expSet[HEADING_DEG], m_imgLine, m_heading, &rms);
478  if (traceDebug())
479  {
481  << "\n H poly deg, rms error = "
482  << HEADING_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
483  }
484 
485  if (result)
486  {
487  result = lonPoly.SLSfit(expSet[LON_DEG], m_imgLine, m_lon, &rms);
488  if (traceDebug())
489  {
491  << "\n Lon poly deg, rms error = "
492  << LON_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
493  }
494 
495  if (result)
496  {
497  result = latPoly.SLSfit(expSet[LAT_DEG], m_imgLine, m_lat, &rms);
498  if (traceDebug())
499  {
501  << "\n Lat poly deg, rms error = "
502  << LAT_DEG << ", " << ossim::radiansToDegrees(rms) << " deg\n";
503  }
504 
505  if (result)
506  {
507  result = altPoly.SLSfit(expSet[ALT_DEG], m_imgLine, m_alt, &rms);
508  if (traceDebug())
509  {
511  << "\n Alt poly deg, rms error = "
512  << ALT_DEG << ", " << rms << " mtr" << std::endl;
513  }
514  }
515  }
516  }
517  }
518  }
519  }
520 
521  if (result)
522  {
523  // Save coefficients
525  for (it = rPoly.getMonoms().begin(); it != rPoly.getMonoms().end() ; ++it )
526  {
527  m_rollPolyCoef.push_back(it->second);
528  }
529  for (it = pPoly.getMonoms().begin(); it != pPoly.getMonoms().end() ; ++it )
530  {
531  m_pitchPolyCoef.push_back(it->second);
532  }
533  for (it = hPoly.getMonoms().begin(); it != hPoly.getMonoms().end() ; ++it )
534  {
535  m_headingPolyCoef.push_back(it->second);
536  }
537  for (it = lonPoly.getMonoms().begin(); it != lonPoly.getMonoms().end() ; ++it )
538  {
539  m_lonPolyCoef.push_back(it->second);
540  }
541  for (it = latPoly.getMonoms().begin(); it != latPoly.getMonoms().end() ; ++it )
542  {
543  m_latPolyCoef.push_back(it->second);
544  }
545  for (it = altPoly.getMonoms().begin(); it != altPoly.getMonoms().end() ; ++it )
546  {
547  m_altPolyCoef.push_back(it->second);
548  }
549  if (m_isHSI)
550  {
551  for (it = saPoly.getMonoms().begin(); it != saPoly.getMonoms().end() ; ++it )
552  {
553  m_scanAngPolyCoef.push_back(it->second);
554  }
555  }
556  else
557  {
558  m_scanAngPolyCoef.push_back(0.0);
559  }
560  }
561 
562 
563  if (traceDebug())
564  {
565  if (result)
566  {
567  vector<ossim_float64> inp(1);
568  inp[0] = 510.0;
569  ossimNotify(ossimNotifyLevel_DEBUG) << "\n Test eval line number = " << inp[0] << endl;
570  if (m_isHSI)
571  {
573  ossim_float64 sa = saPoly.eval(inp);
574  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n sa="<<sa<<endl;
575  }
577  ossim_float64 rr = rPoly.eval(inp);
578  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n r="<<rr<<endl;
579 
581  ossim_float64 pp = pPoly.eval(inp);
582  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n p="<<pp<<endl;
583 
585  ossim_float64 hh = hPoly.eval(inp);
586  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n h="<<hh<<endl;
587 
589  ossim_float64 lon = lonPoly.eval(inp);
590  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n lon="<<lon<<endl;
591 
593  ossim_float64 lat = latPoly.eval(inp);
594  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n lat="<<lat<<endl;
595 
597  ossim_float64 alt = altPoly.eval(inp);
598  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n alt="<<alt<<endl;
599  }
600  else
601  {
603  << " ...polynomial solution error for file: " << file << std::endl;
604  }
605  }
606  }
607  else
608  {
609  result = false;
610  if (traceDebug())
611  {
613  << "Could not open: " << file << "\n";
614  }
615  }
616 
617  if (traceDebug())
618  {
620  << M << " exit status = " << ( result ? "true" : "false" ) << "\n";
621  }
622 
623  return result;
624 }
std::vector< ossim_float64 > m_pitchPolyCoef
std::vector< ossim_float64 > m_alt
std::vector< ossim_float64 > m_headingPolyCoef
T eval(const VAR_TUPLE &v) const
evaluation : needs DIM values as input
Definition: ossimPolynom.h:219
std::vector< ossim_float64 > m_heading
double y
Definition: ossimDpt.h:165
template class for multivariate polynom algebra
Definition: ossimPolynom.h:38
bool SLSfit(const EXPT_SET &expset, const std::vector< VAR_TUPLE > obs_input, const std::vector< T > obs_output, T *prms=NULL)
Standard least squares Modified version of LMSfit that uses standard NEWMAT inverse as alternative to...
Definition: ossimPolynom.h:700
static StreamFactoryRegistry * instance()
std::istream & getline(std::istream &is, ossimString &str, char delim)
Definition: ossimString.h:916
std::vector< ossim_float64 > m_altPolyCoef
double radiansToDegrees(double x)
Definition: ossimCommon.h:257
double ossim_float64
unsigned int ossim_uint32
std::vector< ossim_float64 > m_pitch
std::vector< int > EXP_TUPLE
inner types
Definition: ossimPolynom.h:44
const MONOM_MAP & getMonoms() const
Definition: ossimPolynom.h:145
std::vector< ossim_float64 > m_lat
std::vector< ossim_float64 > m_scanAngPolyCoef
std::vector< ossim_float64 > m_latPolyCoef
std::vector< ossim_float64 > m_rollPolyCoef
std::vector< ossimPolynom< ossim_float64, 1 >::VAR_TUPLE > m_imgLine
std::ostream & print(std::ostream &os) const
I/O.
Definition: ossimPolynom.h:370
std::vector< ossim_float64 > m_lonPolyCoef
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32
std::vector< ossim_float64 > m_lon
std::vector< ossim_float64 > m_roll
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::vector< ossim_float64 > m_scanAng

◆ readSupportFiles() [1/2]

bool ossimAlphaSensorSupportData::readSupportFiles ( const ossimFilename hdrFile)
virtual

Definition at line 47 of file ossimAlphaSensorSupportData.cpp.

References ossimEnviHeader::open().

48 {
49  bool readOK = false;
50 
51  // Read ENVI hdr file
52  ossimEnviHeader hdr;
53  if ( hdr.open(hdrFile) )
54  {
55  readOK= readSupportFiles( hdr );
56  }
57  return readOK;
58 }
virtual bool readSupportFiles(const ossimFilename &hdrFile)
bool open(const ossimFilename &file)
Opens an envi header.
Class for reading and writing an ENVI (The Environment for Visualizing Images) header file...

◆ readSupportFiles() [2/2]

bool ossimAlphaSensorSupportData::readSupportFiles ( const ossimEnviHeader hdr)
virtual

Definition at line 60 of file ossimAlphaSensorSupportData.cpp.

References ossimFilename::dirCat(), ossimString::empty(), ossimFilename::exists(), ossimFilename::expand(), ossimFilename::file(), ossimString::find(), ossimEnviHeader::getFile(), ossimString::gsub(), m_isHSI, ossimFilename::path(), readHdrFile(), readInsGpsFile(), and ossimString::replace().

61 {
62  bool readOK = readHdrFile(hdr);
63 
64  ossimFilename txtFile = hdr.getFile();
65 
66  if ( readOK )
67  {
68  // Derive associated insgps.txt file name
69  if (m_isHSI)
70  {
71  // HSI:
72  // Associated file is located in /NavData, sub-directory of current container
73  // example:
74  // .hdr = "/data/AH/2012-06-15_20-00-29/HSI/Scan_00002/2012-06-15_20-00-29.HSI.Scan_00002.scene.corrected.hsi.hdr"
75  // .txt = "/data/AH/2012-06-15_20-00-29/HSI/Scan_00002/NavData/2012-06-15_20-00-29.HSI.Scan_00002.scene.insgps.txt"
76  // txtFile.insert(hdr.getFile().find_last_of('/'), "/NavData");
77  // txtFile.gsub("corrected.hsi.hdr", "insgps.txt");
78 
79  ossimFilename navDir = hdr.getFile().path();
80  navDir = navDir.dirCat("NavData");
81  if ( navDir.exists() )
82  {
83  txtFile = navDir.dirCat( hdr.getFile().file() );
84  txtFile.gsub("corrected.hsi.hdr", "insgps.txt");
85  }
86  else
87  {
88  //--
89  // Example header and inertial nav support(INS) data file paths:
90  //
91  // Header: /data/20131113/hsi/cal/001_001_hsi_cal_001.hsi.hdr
92  // INS: /data/20131113/hsi/nav/001_001_hsi_cal_001.txt
93  //---
94 
95  // Expand header file out to absolute path:
96  txtFile = hdr.getFile().expand();
97 
98  // Substitute the "cal" directory with "nav".
99  txtFile.gsub("cal/", "nav/");
100 
101  // Substitute the "hsi.hdr" directory with "txt".
102  txtFile.gsub("hsi.hdr", "txt");
103  }
104  }
105  else
106  {
107  // HRI:
108  // Associated file is located in ../NavData, parallel to current container
109  // There is one insgps.txt file common to multiple hdr files
110  // example:
111  // .hdr = "/data/AH/2012-06-15_20-00-29/HRI/HRI_2/2012-06-15_20-00-29.HRI_2.Strip_00004.corrected.hri.hdr"
112  // .txt = "/data/AH/2012-06-15_20-00-29/HRI/NavData/2012-06-15_20-00-29.HRI.Strip_00004.insgps.txt"
113 
114  // Replaced: 29 July 2013 (drb)
115  // txtFile = hdr.getFile().path();
116  // if ( txtFile.empty() )
117  // {
118  // txtFile = txtFile.dirCat("../NavData");
119  // }
120  // else
121  // {
122  // txtFile.replace(txtFile.find("HRI_"), 5, "NavData");
123  // }
124  // txtFile = txtFile.dirCat( hdr.getFile().file() );
125  // txtFile.replace(txtFile.find("HRI_"), 5, "HRI");
126  // txtFile.gsub("corrected.hri.hdr", "insgps.txt");
127  //
128  // with:
129 
130  ossimFilename navDir = hdr.getFile().path();
131  if ( navDir.empty() )
132  {
133  navDir = navDir.dirCat("../NavData");
134  }
135  else
136  {
137  std::string::size_type pos = navDir.find("HRI_");
138  if(pos!=std::string::npos)
139  {
140  navDir = navDir.replace(pos, 5, "NavData");
141  }
142  }
143  if ( navDir.exists() )
144  {
145  txtFile = navDir.dirCat( hdr.getFile().file() );
146  std::string::size_type pos = txtFile.find("HRI_");
147  if(pos!=std::string::npos)
148  {
149  txtFile.replace(pos, 5, "HRI");
150  }
151  txtFile.gsub("corrected.hri.hdr", "insgps.txt");
152  }
153  else
154  {
155  navDir = "../nav";
156  txtFile = navDir.dirCat( hdr.getFile().file() );
157  txtFile.gsub("hri.hdr", "txt");
158  }
159  }
160 
161  // Read .txt file
162  readOK = readInsGpsFile(txtFile);
163  }
164 
165  if (traceDebug())
166  {
168  << "ossimAlphaSensorSupportData::readSupportFiles DEBUG:"
169  << "\n hdrFile = " << hdr.getFile()
170  << "\n txtFile = " << txtFile
171  << std::endl;
172  }
173 
174  return readOK;
175 }
virtual bool readHdrFile(const ossimFilename &hdrFile)
ossimFilename expand() const
Method to do file name expansion.
const ossimFilename & getFile() const
bool exists() const
virtual bool readInsGpsFile(const ossimFilename &txtFile)
std::string & replace(std::string::size_type pos, std::string::size_type n, const std::string &s)
Replaces a substring of *this with the string s.
Definition: ossimString.h:870
ossimFilename dirCat(const ossimFilename &file) const
bool empty() const
Definition: ossimString.h:411
ossimFilename file() const
ossimString & gsub(const ossimString &searchKey, const ossimString &replacementValue, bool replaceAll=false)
Substitutes searchKey string with replacementValue and returns a reference to *this.
ossimFilename path() const
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ reset()

void ossimAlphaSensorSupportData::reset ( void  )
protected

Definition at line 41 of file ossimAlphaSensorSupportData.cpp.

References m_imageSize, and ossimDpt::makeNan().

Referenced by ossimAlphaSensorSupportData().

42 {
44 }
void makeNan()
Definition: ossimDpt.h:65

Member Data Documentation

◆ m_alt

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_alt
protected

Definition at line 76 of file ossimAlphaSensorSupportData.h.

◆ m_altPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_altPolyCoef
protected

Definition at line 85 of file ossimAlphaSensorSupportData.h.

Referenced by getAltPoly().

◆ m_fov

ossim_float64 ossimAlphaSensorSupportData::m_fov
protected

Definition at line 66 of file ossimAlphaSensorSupportData.h.

Referenced by getFov(), and readHdrFile().

◆ m_heading

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_heading
protected

Definition at line 73 of file ossimAlphaSensorSupportData.h.

◆ m_headingBias

ossim_float64 ossimAlphaSensorSupportData::m_headingBias
protected

Definition at line 65 of file ossimAlphaSensorSupportData.h.

Referenced by getHeadingBias(), and readHdrFile().

◆ m_headingPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_headingPolyCoef
protected

Definition at line 82 of file ossimAlphaSensorSupportData.h.

Referenced by getHeadingPoly().

◆ m_imageSize

ossimDpt ossimAlphaSensorSupportData::m_imageSize
protected

Definition at line 62 of file ossimAlphaSensorSupportData.h.

Referenced by getImageSize(), readHdrFile(), and reset().

◆ m_imgLine

std::vector< ossimPolynom<ossim_float64,1>::VAR_TUPLE > ossimAlphaSensorSupportData::m_imgLine
protected

Definition at line 70 of file ossimAlphaSensorSupportData.h.

◆ m_isHSI

bool ossimAlphaSensorSupportData::m_isHSI
protected

Definition at line 58 of file ossimAlphaSensorSupportData.h.

Referenced by readHdrFile(), and readSupportFiles().

◆ m_lat

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_lat
protected

Definition at line 75 of file ossimAlphaSensorSupportData.h.

◆ m_latPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_latPolyCoef
protected

Definition at line 84 of file ossimAlphaSensorSupportData.h.

Referenced by getLatPoly().

◆ m_lon

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_lon
protected

Definition at line 74 of file ossimAlphaSensorSupportData.h.

◆ m_lonPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_lonPolyCoef
protected

Definition at line 83 of file ossimAlphaSensorSupportData.h.

Referenced by getLonPoly().

◆ m_pitch

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_pitch
protected

Definition at line 72 of file ossimAlphaSensorSupportData.h.

◆ m_pitchBias

ossim_float64 ossimAlphaSensorSupportData::m_pitchBias
protected

Definition at line 64 of file ossimAlphaSensorSupportData.h.

Referenced by getPitchBias(), and readHdrFile().

◆ m_pitchPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_pitchPolyCoef
protected

Definition at line 81 of file ossimAlphaSensorSupportData.h.

Referenced by getPitchPoly().

◆ m_roll

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_roll
protected

Definition at line 71 of file ossimAlphaSensorSupportData.h.

◆ m_rollBias

ossim_float64 ossimAlphaSensorSupportData::m_rollBias
protected

Definition at line 63 of file ossimAlphaSensorSupportData.h.

Referenced by getRollBias(), and readHdrFile().

◆ m_rollPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_rollPolyCoef
protected

Definition at line 80 of file ossimAlphaSensorSupportData.h.

Referenced by getRollPoly().

◆ m_scanAng

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_scanAng
protected

Definition at line 77 of file ossimAlphaSensorSupportData.h.

◆ m_scanAngPolyCoef

std::vector< ossim_float64 > ossimAlphaSensorSupportData::m_scanAngPolyCoef
protected

Definition at line 86 of file ossimAlphaSensorSupportData.h.

Referenced by getScanPoly().

◆ m_sensorType

ossimString ossimAlphaSensorSupportData::m_sensorType
protected

Definition at line 61 of file ossimAlphaSensorSupportData.h.

Referenced by readHdrFile().

◆ m_slitRot

ossim_float64 ossimAlphaSensorSupportData::m_slitRot
protected

Definition at line 67 of file ossimAlphaSensorSupportData.h.

Referenced by getSlitRot(), and readHdrFile().


The documentation for this class was generated from the following files: