当前位置: 首页>>代码示例>>C++>>正文


C++ Scanner::offsetView方法代码示例

本文整理汇总了C++中Scanner::offsetView方法的典型用法代码示例。如果您正苦于以下问题:C++ Scanner::offsetView方法的具体用法?C++ Scanner::offsetView怎么用?C++ Scanner::offsetView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scanner的用法示例。


在下文中一共展示了Scanner::offsetView方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: scanner


//.........这里部分代码省略.........
          if (endptr != endstr) {
                std::cerr << "Error setting --ndet to " << argv[optind+1] << std::endl;
                phm2helix_usage(argv[0]);
                return (1);
          }
          opt_nview = strtol(argv[optind+2], &endptr, 10);
          endstr = argv[optind+2] + strlen(argv[optind+2]);
          if (endptr != endstr) {
                std::cerr << "Error setting --nview to " << argv[optind+2] << std::endl;
                phm2helix_usage(argv[0]);
                return (1);
          }
          opt_PhmProg = argv[optind+3];

          if (opt_rotangle < 0) {
                if (optGeometryName.compare ("parallel") == 0)
                  opt_rotangle = 0.5;
                else
                  opt_rotangle = 1.0;
          }

          std::ostringstream desc;
          desc << "phm2helix: NDet=" << opt_ndet
                   << ", Nview=" << opt_nview
                   << ", NRay=" << opt_nray
                   << ", RotAngle=" << opt_rotangle
                   << ", OffsetView =" << opt_offsetview
                   << ", Geometry=" << optGeometryName
                   << ", PhantomProg=" << opt_PhmProg
                   << ", PhmFileName=" << opt_PhmFileName;
          if (opt_desc.length()) {
                desc << ": " << opt_desc;
          }
          opt_desc = desc.str();

          opt_rotangle *= TWOPI;

          int stat;
          char extcommand[100];
          if(opt_debug != 0)
                        std::cout  <<  opt_PhmProg  <<  " " << 0 << " " <<  opt_nview << " " << opt_PhmFileName  << std::endl;
           //extcommand <<  opt_PhmProg  <<  " " << 0 << " " <<  opt_nview << " " << opt_PhmFileName ;

          sprintf(extcommand, "%s %d %d %s",    opt_PhmProg.c_str(), 0, opt_nview, opt_PhmFileName.c_str() );

           stat = system( extcommand );
          if (stat != 0 )
                        std::cerr << "Error executing external phantom program " << opt_PhmProg << " with command " << extcommand << std::endl;

          phm.createFromFile (opt_PhmFileName.c_str());
          remove(opt_PhmFileName.c_str());

          Scanner scanner (phm, optGeometryName.c_str(), opt_ndet, opt_nview,
                                opt_offsetview, opt_nray, opt_rotangle, dOptFocalLength,
                                dOptCenterDetectorLength, dOptViewRatio, dOptScanRatio);
          if (scanner.fail()) {
                 std::cout << "Scanner Creation Error: " << scanner.failMessage()
                                                        << std::endl;
                 return (1);
          }

          Projections pjGlobal(scanner);


          for( int iView = 0; iView < opt_nview; iView++ ){
                if(opt_debug != 0)
                        std::cout  <<  opt_PhmProg  <<  " " << iView << " " <<  opt_nview << " " << opt_PhmFileName  << std::endl;
           //extcommand <<  opt_PhmProg  <<  " " << iView << " " <<  opt_nview << " " << opt_PhmFileName ;

                sprintf(extcommand, "%s %d %d %s",      
                        opt_PhmProg.c_str(), iView, opt_nview, 
                        opt_PhmFileName.c_str() );
                stat = system( extcommand );

                if (stat != 0 )
                        std::cerr << "Error executing external phantom program " << opt_PhmProg << " with command " << extcommand << std::endl;
                Phantom phmtmp;
                phmtmp.createFromFile (opt_PhmFileName.c_str());

                scanner.collectProjections (pjGlobal, phmtmp, iView,
                          1, scanner.offsetView(), true, opt_trace);
                remove(opt_PhmFileName.c_str());
          }


          pjGlobal.setCalcTime (timerProgram.timerEnd());
          pjGlobal.setRemark (opt_desc);
          pjGlobal.write (opt_outfile);
          if (opt_verbose) {
            phm.print (std::cout);
            std::cout << std::endl;
            std::ostringstream os;
            pjGlobal.printScanInfo (os);
            std::cout << os.str() << std::endl;
            std::cout << "  Remark: " << pjGlobal.remark() << std::endl;
            std::cout << "Run time: " << pjGlobal.calcTime() << " seconds\n";
          }
          
          return (0);
}
开发者ID:leila1349,项目名称:OPT_recon,代码行数:101,代码来源:phm2helix.cpp


注:本文中的Scanner::offsetView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。