Using trace in ossim for debugging:

To enable trace in an ossim application it is a simple matter of doing an ossim initialize. Code snip:

#include <ossim/init/ossimInit.h>
int main(int argc, char* argv[])
   // Adding the call to initialize will enable your application to use trace.
   ossimInit::instance()->initialize(argc, argv);

   // the rest of your application main:

   return 0;

To use trace in a trace enabled application use the -T option followed by some regular expression.


A call to image_info with no trace. The -d option is to tell image_info to do a "dump" on the file.
image_info -d image.tif

This will turn trace on for anything that starts with "ossim". Note the '-T ossim' option is being used.
Note: Since almost all classes in ossim start with "ossim" this will dump a LOT of stuff.
image_info -d -T ossim image.tif

This will turn trace on for anything matching ossimTiffInfo.
image_info -d -T ossimTiffInfo image.tif

This will turn trace on for anything matching ossimTiffInfo.
image_info -d -T ossimTiffInfo image.tif

The ossimTiffInfo class has two separate traces "ossimTiffInfo:debug" and "ossimTiffInfo:dump"[[BR]] This will turn on just "debug"
image_info -d -T ossimTiffInfo:debug image.tif

This will turn on trace for ossimTiffInfo AND ossimGeoTiff:
Note: The OR bar '|' and also the regular expression is quoted. Also the -i and -p options
were added so that the code would go into the ossimGeoTiff class for this example.
image_info -i -p -d -T "ossimTiffInfo|ossimGeoTiff" image.tif

This is a snip of a real image_info output turning trace on for ossimTiffInfo and ossimGeoTiff.
Note: This is not the whole dump just pieces for demo purposes.

$ image_info -i -p -d -T "ossimTiffInfo|ossimGeoTiff" imagery_HH.tif
DEBUG ossimGeoTiff::ossimGeoTiff: Entered...
DEBUG ossimGeoTiff::ossimGeoTiff: OSSIM_ID = $Id: ossimGeoTiff.cpp 14039 2009-0
2-26 23:35:49Z dburken $
DEBUG ossimGeoTiff::setOssimDatumName: theDatumName: WGE
Need to add double param support for projection = ossimEquDistCylProjection
theScale is empty...
ossimGeoTiff::addImageGeometry: Creating a bilinear projection
tiff.version: 42(classic)
tiff.byte_order: big_endian
system_byte_order: little_endian
DEBUG ossimTiffInfo::readTags: Offset to first ifd: 212115324
tiff.directory_offset: 212115324
DEBUG ossimTiffInfo::readTags:
ifd: 212115324
tags in directory: 20
DEBUG ossimTiffInfo::print DEBUG:
type: 3
count: 1
array size in bytes: 2
tiff.image0.image_width: 10507

Last modified 13 years ago Last modified on Apr 9, 2009, 11:16:04 AM