// This code demonstrates how to read the image
// data from a TIFF file and print it out.
#include <iostream>
#include "CTiffFile.h"
using namespace std;
using namespace arc;
int main()
{
try {
CTiffFile cTiff( "Image.tif", CTiffFile::READMODE );
long lRows = cTiff.GetRows();
long lCols = cTiff.GetCols();
unsigned short *pBuf = ( unsigned short * )cTiff.Read();
if ( pBuf != NULL )
{
for ( long i=0; i<( lRows * lCols ); i++ )
cout << "pBuf[ " << i << " ]: " << pBuf[ i ] << endl;
}
}
catch ( std::exception &e )
{
cerr << "Exception Occurred: " << e.what() << endl;
}
catch ( ... )
{
cerr << "System Exception Occurred!" << endl;
}
}
© Astronomical Research Cameras, Inc.