int main(int argc, char **argv) { if (argc < 6) { printf("usage: leitura arqin.raw width height slices dslices colormap\n"); exit(1); } glutInit(&argc, argv); //glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowPosition(100, 100); glutInitWindowSize(640, 640); glutCreateWindow("Teste de Vizualizacao com textura 3D"); glutDisplayFunc(&DrawGLScene); glutIdleFunc(&DrawGLScene); glutReshapeFunc(&ReSizeGLScene); glutKeyboardFunc(&keyPressed); glutMotionFunc(MoveMouseBotaoPressionado); glutPassiveMotionFunc(MoveMouse); glutMouseFunc(GerenciaMouse); raw = readRAW(argc, argv); GLenum err = glewInit(); if (GLEW_OK != err) { fprintf(stderr, "Error: %s\n", glewGetErrorString(err)); } if (glewIsSupported("GL_VERSION_2_1")) printf("Ready for OpenGL 2.1\n"); else { printf("OpenGL 2.1 not supported\n"); exit(1); } if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4) printf("Ready for GLSL - vertex, fragment, and geometry units\n"); else { printf("Not totally ready :( \n"); exit(1); } if(argc==7) colorMapRead(argv[6],cm); else { createColorMap(cm); //colorMapWrite("teste.map", cm); //colorMapRead("teste.map", cm); } InitGL(640, 640); /* Start Event Processing Engine */ glutMainLoop(); return 1; }
/** Executes the algorithm * @throw invalid_argument if the detection delay time is different for different monitors * @throw FileError if there was a problem opening the file or its format * @throw MisMatch<int> if not very spectra is associated with exaltly one detector * @throw IndexError if there is a problem converting spectra indexes to spectra numbers, which would imply there is a problem with the workspace * @throw runtime_error if the SpectraDetectorMap had not been filled */ void LoadDetectorInfo::exec() { // get the infomation that will be need from the user selected workspace, assume it exsists because of the validator in init() m_workspace = getProperty("Workspace"); m_numHists = static_cast<int>(m_workspace->getNumberHistograms()); // when we change the X-values will care take to maintain sharing. I have only implemented maintaining sharing where _all_ the arrays are initiall common m_commonXs = WorkspaceHelpers::sharedXData(m_workspace); // set the other member variables to their defaults m_FracCompl = 0.0; m_monitors.clear(); m_monitOffset = UNSETOFFSET; m_error = false; m_moveDets = getProperty("RelocateDets"); if( m_moveDets ) { Geometry::IObjComponent_const_sptr sample = m_workspace->getInstrument()->getSample(); if( sample ) m_samplePos = sample->getPos(); } // get the user selected filename std::string filename = getPropertyValue("DataFilename"); // load the data from the file using the correct algorithm depending on the assumed type of file if ( filename.find(".dat") == filename.size()-4 || filename.find(".DAT") == filename.size()-4 ) { readDAT(filename); } if ( filename.find(".sca") == filename.size()-4 || filename.find(".SCA") == filename.size()-4 ) { readDAT(filename); } if ( filename.find(".raw") == filename.size()-4 || filename.find(".RAW") == filename.size()-4) { readRAW(filename); } if (m_error) { g_log.warning() << "Note workspace " << getPropertyValue("Workspace") << " has been changed so if you intend to fix detector mismatch problems by running " << name() << " on this workspace again is likely to corrupt it" << std::endl; } }