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


C++ FloatImage::copyImage方法代码示例

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


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

示例1: main

int main(int argc,char** argv)
{
  FloatImage img;
  FloatImage mask;
  LabelImage mask2;
  std::vector<FloatImage> atlasImages;
  MixtureSpec mixture;
  AtlasSpec atlas; 
  PdfEstimate hatf;
  Parameters params;  
  Population pop,selPop,popRuns;

  float maxMu,minMu,minVar,maxVar,mean;
  std::vector<float> lowLimit;
  std::vector<float> upLimit;  
  //  float* fitness;

  bool terminate;
  bool boolstatus;
  bool changed_n = false;

  int intstatus,i,j,itercount,rr,n; 
  int pveLabels,pureLabels;  

  if(argc < 5) {
    cout << "Genetic algorithm for mixture model optimization" << endl;
    cout << "Usage: gamixture [-unsigned] imagefile maskfile atlasfile fmmparamfile [paramaters]" << endl;
    cout << "Optional parameters are :" << endl;
    cout << "-alpha:             parameter for blended crossover, defaults to " << DEFAULT_ALPHA << endl;
    cout << "-size:              population size, defaults to " << DEFAULT_POPSIZE << endl;
    cout << "-terminationthr:    threshold for terminating the algorithm, defaults to "<< DEFAULT_TERMINATIONTHR << endl; 
    cout << "-xoverrate:         crossover rate, defaults to " << DEFAULT_XOVERRATE << endl;
    cout << "-maxgenerations:    maximum number of generations, defaults to " << DEFAULT_MAXGENERATIONS << endl;
    cout << "-sortpop            whether to use the permutation operator, defaults to " << DEFAULT_SORTPOP << endl;
    cout << "-parzenn            number of points for Parzen estimate (for approximate ML), defaults to " << DEFAULT_PARZENN << endl;
    cout << "-parzensigma        window width parameter for the Parzen estimate, defaults to " << DEFAULT_PARZENSIGMA << endl;         
    cout << "-equalvar           whether component densities should have equal variances, defaults to " << DEFAULT_EQUALVAR << endl;  
    cout << "-restarts           the number of individual runs of the GA, defaults to " << DEFAULT_RESTARTS << endl;  
   return(1);
  }
  intstatus = readImage(argv[1],img);
  if(intstatus != 0) {
    cout << "Could not read image file " << argv[1] << " " << intstatus << endl;
    return(2);
  }  
  cout << "Image dimensions: " << img.header.x_dim << " " << img.header.y_dim << " " << img.header.z_dim << endl;
  if(!(strcmp(argv[2],"default"))) {
    mask.copyImage(img);
    mask.thresholdImage(VERY_SMALL);
    mask2.thresholdImage(img,VERY_SMALL); //!?!?!?!
  }
  else {
    intstatus = readImage(argv[2],mask);
    if(intstatus != 0) {
      cout << "Could not read image (brainmask) file " << argv[2] << " " << intstatus << endl;
      return(3);
    }  
    mask.thresholdImage(0.0001);
    mask2.thresholdImage(mask,0.5);//!?!?!
  } 
   
  boolstatus = atlas.readAtlasSpec(argv[3]);
  if(boolstatus == false) {
    cout << "Could not read atlas file " << argv[3] << endl;
    return(4);
  }   
 
  intstatus = params.parseParams(argc - 4,&(argv[4]));
  if(intstatus != 0) {  
    cout << "Incorrect parameter value input" << endl;
    return(6);
  }
  if(atlas.n > 0) {
    atlasImages.resize(atlas.n);
    intstatus = atlas.readAtlasImages(atlasImages);
    if(intstatus != 0) {
      cout << "Could not read probabilistic atlas. Error: " << intstatus << endl;
    return(6);
    }  
    cout << "The atlas files have been read" << endl;
    if(atlas.maskAtlas(atlasImages,mask) == false) {
      cout << "Could not mask atlas" << endl;
      return(7);
    }  
    cout << "The atlas has been masked" << endl;
  }
  else {
   // taking care for the case where atlas->n == 0
   // then we assume that the atlas is defined by the mask
    atlas.n = 1;
    changed_n = true;
    atlasImages.resize(atlas.n);
    boolstatus = atlasImages[0].copyImage(mask);
  } 
  mixture.allocateMixtureSpec(atlas);
  
  // compute the number of pve labels and pure labels.
  // remember that pve labels have to have indeces greater than pure labels
  pureLabels = 0;
  pveLabels = 0;
//.........这里部分代码省略.........
开发者ID:BIC-MNI,项目名称:EZminc,代码行数:101,代码来源:gamixturemain.cpp


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