41 #include "PlusConfigure.h" 49 extern unsigned _stklen = 16000;
54 #if defined(_WIN32) && !defined(__WINDOWS_H) 97 int main(
int argc,
unsigned char *argv[] )
100 pszLogFileName[] =
"CfgLog.txt",
101 szNDErrorString[MAX_ERROR_STRING_LENGTH + 1];
110 std::cout <<
"Determining system configuration using system.nif." << std::endl;
121 std::cout <<
"...OptotrakSetProcessingFlags" << std::endl;
123 if( OptotrakSetProcessingFlags( OPTO_LIB_POLL_REAL_DATA |
124 OPTO_CONVERT_ON_HOST |
125 OPTO_RIGID_ON_HOST ) )
130 std::cout <<
"...TransputerDetermineSystemCfg" << std::endl;
131 if( TransputerDetermineSystemCfg( NULL ) )
133 std::cerr <<
"Error in determining the system parameters." << std::endl;
137 vtkIGSIOAccurateTimer::Delay(1);
142 std::cout <<
"...TransputerLoadSystem" << std::endl;
143 if( TransputerLoadSystem(
"system" ) != OPTO_NO_ERROR_CODE )
151 vtkIGSIOAccurateTimer::Delay(1);
156 std::cout <<
"...TransputerInitializeSystem" << std::endl;
157 if( TransputerInitializeSystem( OPTO_LOG_ERRORS_FLAG | OPTO_LOG_MESSAGES_FLAG ) )
165 std::cout <<
"...OptotrakLoadCameraParameters" << std::endl;
166 if( OptotrakLoadCameraParameters(
"standard" ) )
174 std::cout <<
"...OptotrakSetupCollection" << std::endl;
175 if( OptotrakSetupCollection(
186 OPTOTRAK_NO_FIRE_MARKERS_FLAG | OPTOTRAK_BUFFER_RAW_FLAG | OPTOTRAK_GET_NEXT_FRAME_FLAG ) )
194 vtkIGSIOAccurateTimer::Delay(1);
199 std::cout <<
"...OptotrakActivateMarkers" << std::endl;
200 if( OptotrakActivateMarkers() )
204 vtkIGSIOAccurateTimer::Delay(1);
209 std::cout << std::endl << std::endl <<
"Sample Program Results:" << std::endl << std::endl;
210 std::cout << std::endl << std::endl <<
"3D Data Display" << std::endl;
211 for( uFrameCnt = 0; uFrameCnt < 10; ++uFrameCnt )
216 std::cout << std::endl;
217 if( DataGetLatest3D( &uFrameNumber, &uElements, &uFlags, p3dData ) )
225 std::cout <<
"Frame Number: " << uFrameNumber << std::endl;
226 std::cout <<
"Elements : " << uElements << std::endl;
227 std::cout <<
"Flags : " << std::hex << uFlags << std::endl;
233 std::cout << std::endl;
238 std::cout <<
"...OptotrakDeActivateMarkers" << std::endl;
239 if( OptotrakDeActivateMarkers() )
247 std::cout <<
"...OptotrakStopCollection" << std::endl;
248 OptotrakStopCollection( );
253 std::cout <<
"...TransputerShutdownSystem" << std::endl;
254 if( TransputerShutdownSystem() )
259 vtkIGSIOAccurateTimer::Delay(1);
265 std::cout << std::endl <<
"Determining system configuration using internal strings." << std::endl;
270 std::cout <<
"...OptotrakSetProcessingFlags" << std::endl;
271 if( OptotrakSetProcessingFlags( OPTO_USE_INTERNAL_NIF |
272 OPTO_LIB_POLL_REAL_DATA |
273 OPTO_CONVERT_ON_HOST |
274 OPTO_RIGID_ON_HOST ) )
284 std::cout <<
"...TransputerDetermineSystemCfg" << std::endl;
285 if( TransputerDetermineSystemCfg( pszLogFileName ) )
287 std::cerr <<
"Error in determining the system parameters." << std::endl;
291 vtkIGSIOAccurateTimer::Delay(1);
296 std::cout <<
"...TransputerLoadSystem" << std::endl;
297 if( TransputerLoadSystem(
"system" ) != OPTO_NO_ERROR_CODE )
302 vtkIGSIOAccurateTimer::Delay(1);
307 std::cout <<
"...TransputerInitializeSystem" << std::endl;
308 if( TransputerInitializeSystem( OPTO_LOG_ERRORS_FLAG | OPTO_LOG_MESSAGES_FLAG ) )
316 std::cout <<
"...OptotrakLoadCameraParameters" << std::endl;
317 if( OptotrakLoadCameraParameters(
"standard" ) )
325 std::cout <<
"...OptotrakSetupCollection" << std::endl;
326 if( OptotrakSetupCollection(
337 OPTOTRAK_NO_FIRE_MARKERS_FLAG | OPTOTRAK_BUFFER_RAW_FLAG | OPTOTRAK_GET_NEXT_FRAME_FLAG ) )
345 vtkIGSIOAccurateTimer::Delay(1);
350 std::cout <<
"...OptotrakActivateMarkers" << std::endl;
351 if( OptotrakActivateMarkers() )
356 vtkIGSIOAccurateTimer::Delay(1);
361 std::cout << std::endl << std::endl <<
"Sample Program Results:" << std::endl << std::endl;
362 std::cout << std::endl << std::endl <<
"3D Data Display" << std::endl;
363 for( uFrameCnt = 0; uFrameCnt < 10; ++uFrameCnt )
368 std::cout << std::endl;
369 if( DataGetLatest3D( &uFrameNumber, &uElements, &uFlags, p3dData ) )
377 std::cout <<
"Frame Number: " << uFrameNumber << std::endl;
378 std::cout <<
"Elements : " << uElements << std::endl;
379 std::cout <<
"Flags : " << std::hex << uFlags << std::endl;
381 std::cout << std::endl;
386 std::cout <<
"...OptotrakDeActivateMarkers" << std::endl;
387 if( OptotrakDeActivateMarkers() )
395 std::cout <<
"...OptotrakStopCollection" << std::endl;
396 OptotrakStopCollection( );
401 std::cout <<
"...TransputerShutdownSystem" << std::endl;
402 if( TransputerShutdownSystem() )
410 std::cout << std::endl <<
"Program execution complete." << std::endl;
417 std::cout << std::endl <<
"An error has occurred during execution of the program." << std::endl;
418 if( OptotrakGetErrorString( szNDErrorString,
419 MAX_ERROR_STRING_LENGTH + 1 ) == 0 )
421 std::cout << szNDErrorString;
424 std::cout << std::endl << std::endl <<
"...TransputerShutdownSystem" << std::endl;
425 TransputerShutdownSystem();
int main(int argc, unsigned char *argv[])