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


C++ Segmentation::process方法代码示例

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


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

示例1: test_crosschannelregistration

void test_crosschannelregistration(UnitTest &ut) {

  ut.begin_test_set("CrossChannelRegistration");

  Segmentation<uint16> segmenter;

  EuclideanDistanceMap<uint16> edm;
  Watershed<uint16> wat;
  Invert<uint16> inv;
  NWThreshold<uint16> nwt(5,0.5,60000,NWThreshold<uint16>::mask_type_square);//0.75 beautiful

  SwiftImage<uint16> c1a_i1("./Images/smallfake2/c1_a.tif");
  cout << "Load complete" << endl;
  SwiftImage<uint16> c1a_i2 = nwt.process(c1a_i1);
  cout << "Thresholding complete" << endl;
  SwiftImage<uint16> c1a_i3 = edm.process(c1a_i2);
  cout << "EDM complete" << endl;
  SwiftImage<uint16> c1a_i4 = inv.process(c1a_i3);
  cout << "INV complete" << endl;
  SwiftImage<uint16> c1a_i5 = wat.process(c1a_i4);
  cout << "Wat complete" << endl;
  SwiftImage<uint16> c1a_i6 = c1a_i2 && c1a_i5;
  vector<SwiftImageObject<> > c1a_objs1 = segmenter.process(c1a_i6);
  
  SwiftImage<uint16> c2a_i1("./Images/smallfake2/c2_a.tif");
  cout << "Load complete" << endl;
  SwiftImage<uint16> c2a_i2 = nwt.process(c2a_i1);
  cout << "Thresholding complete" << endl;
  SwiftImage<uint16> c2a_i3 = edm.process(c2a_i2);
  cout << "EDM complete" << endl;
  SwiftImage<uint16> c2a_i4 = inv.process(c2a_i3);
  cout << "INV complete" << endl;
  SwiftImage<uint16> c2a_i5 = wat.process(c2a_i4);
  cout << "Wat complete" << endl;
  SwiftImage<uint16> c2a_i6 = c2a_i2 && c2a_i5;
  vector<SwiftImageObject<> > c2a_objs1 = segmenter.process(c2a_i6);
  
  SwiftImage<uint16> c1t_i1("./Images/smallfake2/c1_t.tif");
  cout << "Load complete" << endl;
  SwiftImage<uint16> c1t_i2 = nwt.process(c1t_i1);
  cout << "Thresholding complete" << endl;
  SwiftImage<uint16> c1t_i3 = edm.process(c1t_i2);
  cout << "EDM complete" << endl;
  SwiftImage<uint16> c1t_i4 = inv.process(c1t_i3);
  cout << "INV complete" << endl;
  SwiftImage<uint16> c1t_i5 = wat.process(c1t_i4);
  cout << "Wat complete" << endl;
  SwiftImage<uint16> c1t_i6 = c1t_i2 && c1t_i5;
  vector<SwiftImageObject<> > c1t_objs1 = segmenter.process(c1t_i6);
  
  SwiftImage<uint16> c2t_i1("./Images/smallfake2/c2_t.tif");
  cout << "Load complete" << endl;
  SwiftImage<uint16> c2t_i2 = nwt.process(c2t_i1);
  cout << "Thresholding complete" << endl;
  SwiftImage<uint16> c2t_i3 = edm.process(c2t_i2);
  cout << "EDM complete" << endl;
  SwiftImage<uint16> c2t_i4 = inv.process(c2t_i3);
  cout << "INV complete" << endl;
  SwiftImage<uint16> c2t_i5 = wat.process(c2t_i4);
  cout << "Wat complete" << endl;
  SwiftImage<uint16> c2t_i6 = c2t_i2 && c2t_i5;
  vector<SwiftImageObject<> > c2t_objs1 = segmenter.process(c2t_i6);
  
 
  // Now have c1_objs1 and c2_objs1 for registration

  vector<vector<SwiftImageObject<> > > a_cycles;
  a_cycles.push_back(c1a_objs1);
  a_cycles.push_back(c2a_objs1);
  
  vector<vector<SwiftImageObject<> > > t_cycles;
  t_cycles.push_back(c1t_objs1);
  t_cycles.push_back(c2t_objs1);

  ChannelRegistration<> chanreg(c2a_i6.image_width(),c2a_i6.image_height());
  vector<vector<SwiftImageCluster<> > > a_clusters = chanreg.process_channel_registration(a_cycles,SwiftImageCluster<>::base_a);
  vector<vector<SwiftImageCluster<> > > c_clusters = chanreg.process_channel_registration(t_cycles,SwiftImageCluster<>::base_c);
  vector<vector<SwiftImageCluster<> > > g_clusters = chanreg.process_channel_registration(a_cycles,SwiftImageCluster<>::base_g);
  vector<vector<SwiftImageCluster<> > > t_clusters = chanreg.process_channel_registration(t_cycles,SwiftImageCluster<>::base_t);
 
  CrossChannelRegistration<> crosschanreg(c2a_i6.image_width(),c2a_i6.image_height(),true,3);
  vector<vector<SwiftImageCluster<> > > all_clusters = crosschanreg.process_crosschannel_registration(a_clusters,
                                                                                                      c_clusters,
                                                                                                      g_clusters,
                                                                                                      t_clusters);


  for(int n=0;n<all_clusters.size();n++) {
    ut.test(static_cast<int>(all_clusters[n].size()),2);
  }
   
  ut.test(static_cast<int>(all_clusters.size()),5);
  
  // Cluster 1, Cycle 1
  ut.test(static_cast<int>(all_clusters[0][0].features[SwiftImageCluster<>::base_a].size()),1);
  ut.test(static_cast<int>(all_clusters[0][0].features[SwiftImageCluster<>::base_t].size()),1);
  ut.test(static_cast<int>(all_clusters[0][0].features[SwiftImageCluster<>::base_g].size()),1);
  ut.test(static_cast<int>(all_clusters[0][0].features[SwiftImageCluster<>::base_c].size()),1);

  ut.test(all_clusters[0][0].features[SwiftImageCluster<>::base_a][0].pixels[0].pos.x,1);
//.........这里部分代码省略.........
开发者ID:emmaggie,项目名称:swift,代码行数:101,代码来源:test_crosschannelregistration.cpp


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