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


C++ MatrixXi::rows方法代码示例

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


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

示例1: compute_weights

void TW_CALL SkinningCallback::compute_weights(void * clientData)
{
  Skinning * skinning = scast(clientData);
  skinning->auto_dof = false;
  verbose("Computing BBW weights\n");
  // Determine which Bones have weights
  bool success = distribute_weight_indices(skinning->skel->roots);
  if(!success)
  {
    return;
  }
  // Gather samples along controls
  MatrixXd S;
  gather_samples(skinning->skel->roots,10,S);
  VectorXi IM;
  faces_first(skinning->V,skinning->F,IM);
  skinning->Tets = 
    skinning->Tets.unaryExpr(bind1st(mem_fun( static_cast<VectorXi::Scalar&
    (VectorXi::*)(VectorXi::Index)>(&VectorXi::operator())),
    &IM)).eval();
  // Surface vertices
  MatrixXd SV = 
    skinning->V.block(0,0,skinning->F.maxCoeff()+1,skinning->V.cols());
  // Remesh at control samples
  MatrixXd VS = cat(1,SV,S);
  // Boundary faces
  MatrixXi BF;
  cout<<"tetgen begin()"<<endl;
  int status = 
    igl::tetgen::tetrahedralize(
      VS,skinning->F,"Ypq100",skinning->V,skinning->Tets,BF);
  cout<<"tetgen end()"<<endl;
  if(BF.rows() != skinning->F.rows())
  {
    //assert(BF.maxCoeff() == skinning->F.maxCoeff());
    verbose("^%s: Warning: boundary faces != orignal faces\n",__FUNCTION__);
  }
  if(status != 0)
  {
    verbose(
        "************************************************************\n"
        "************************************************************\n"
        "************************************************************\n"
        "************************************************************\n"
        "* ^%s: tetgen failed. Just meshing convex hull\n"
        "************************************************************\n"
        "************************************************************\n"
        "************************************************************\n"
        "************************************************************\n"
        ,__FUNCTION__);
    status =
      igl::tetgen::tetrahedralize(
        VS,skinning->F,"q1.414",skinning->V,skinning->Tets,BF);
    assert(skinning->F.maxCoeff() < skinning->V.rows());
    if(status != 0)
    {
      verbose("^%s: tetgen failed again.\n",__FUNCTION__);
      return;
    }
  }
#ifdef __APPLE__
    launch_medit(skinning->V,skinning->Tets,skinning->F,false);
#endif
  skinning->initialize_mesh();

  // Get boundary conditions
  VectorXi b;
  MatrixXd bc;
  boundary_conditions(skinning->V,skinning->Tets,skinning->skel->roots,b,bc);

  //    call BBW 
  igl::bbw::BBWData bbw_data;
  bbw_data.active_set_params.max_iter = 10;
  success = igl::bbw::bbw(
    skinning->V,
    skinning->Tets,
    b,
    bc,
    bbw_data,
    skinning->OW
    );
  skinning->OW = 
    (skinning->OW.array().colwise() / 
      skinning->OW.rowwise().sum().array()).eval();
  if(!success)
  {
    return;
  }
  // Clear extra weights
  skinning->skel->set_editing(false);
  skinning->EW.resize(skinning->OW.rows(),0);
  skinning->initialize_weights();
}
开发者ID:zhuangfangwang,项目名称:FAST,代码行数:93,代码来源:SkinningCallback.cpp

示例2: main

int main(int argc, char *argv[])
{
    const char *inLabelExt = ".txt";
    const char *outScoreFile = NULL;
    bool bShowConfusion = false;

    // process commandline arguments
    DRWN_BEGIN_CMDLINE_PROCESSING(argc, argv)
        DRWN_CMDLINE_STR_OPTION("-inLabels", inLabelExt)
        DRWN_CMDLINE_STR_OPTION("-outScores", outScoreFile)
        DRWN_CMDLINE_BOOL_OPTION("-confusion", bShowConfusion)
    DRWN_END_CMDLINE_PROCESSING(usage());

    if (DRWN_CMDLINE_ARGC != 1) {
        usage();
        return -1;
    }

    drwnCodeProfiler::tic(drwnCodeProfiler::getHandle("main"));

    // read list of evaluation images
    const char *evalList = DRWN_CMDLINE_ARGV[0];

    DRWN_LOG_MESSAGE("Reading evaluation list from " << evalList << "...");
    vector<string> baseNames = drwnReadFile(evalList);
    DRWN_LOG_MESSAGE("...read " << baseNames.size() << " images");

    const int nLabels = gMultiSegRegionDefs.maxKey() + 1;
    drwnConfusionMatrix confusion(nLabels);
    vector<double> scores(baseNames.size());

    // process results
    DRWN_LOG_MESSAGE("Processing results (" << inLabelExt << ")...");
    int hProcessImage = drwnCodeProfiler::getHandle("processImage");
    for (int i = 0; i < (int)baseNames.size(); i++) {
        drwnCodeProfiler::tic(hProcessImage);
        string lblFilename = gMultiSegConfig.filename("lblDir", baseNames[i], "lblExt");
        string resFilename = gMultiSegConfig.filebase("outputDir", baseNames[i]) + string(inLabelExt);
        DRWN_LOG_STATUS("..." << baseNames[i] << " (" << (i + 1) << " of "
            << baseNames.size() << ")");

        // read ground-truth labels
        MatrixXi actualLabels;
        //drwnReadUnknownMatrix(actualLabels, lblFilename.c_str());
        drwnLoadPixelLabels(actualLabels, lblFilename.c_str(), nLabels);

        // read inferred labels
        MatrixXi predictedLabels(actualLabels.rows(), actualLabels.cols());
        drwnReadMatrix(predictedLabels, resFilename.c_str());

        DRWN_ASSERT((predictedLabels.rows() == actualLabels.rows()) &&
            (predictedLabels.cols() == actualLabels.cols()));

        // accumulate results for this image
        drwnConfusionMatrix imageConfusion(nLabels);
        for (int y = 0; y < actualLabels.rows(); y++) {
            for (int x = 0; x < actualLabels.cols(); x++) {
                if (actualLabels(y, x) < 0) continue;
                imageConfusion.accumulate(actualLabels(y, x), predictedLabels(y, x));
            }
        }

        scores[i] = imageConfusion.accuracy();

        // add to dataset results
        confusion.accumulate(imageConfusion);

        drwnCodeProfiler::toc(hProcessImage);
    }

    // display results
    if (bShowConfusion) {
        confusion.printRowNormalized(cout, "--- Class Confusion Matrix ---");
        confusion.printPrecisionRecall(cout, "--- Recall/Precision (by Class) ---");
        confusion.printF1Score(cout, "--- F1-Score (by Class) ---");
        confusion.printJaccard(cout, "--- Intersection/Union Metric (by Class) ---");
    }

    DRWN_LOG_MESSAGE("Overall class accuracy: " << confusion.accuracy() << " (" << evalList << ")");
    DRWN_LOG_MESSAGE("Average class accuracy: " << confusion.avgRecall() << " (" << evalList << ")");
    DRWN_LOG_MESSAGE("Average jaccard score:  " << confusion.avgJaccard() << " (" << evalList << ")");

    // write scores
    if (outScoreFile != NULL) {
        ofstream ofs(outScoreFile);
        DRWN_ASSERT_MSG(!ofs.fail(), outScoreFile);
        for (int i = 0; i < (int)scores.size(); i++) {
            ofs << scores[i] << "\n";
        }
        ofs.close();
    }

    // clean up and print profile information
    drwnCodeProfiler::toc(drwnCodeProfiler::getHandle("main"));
    drwnCodeProfiler::print();
    return 0;
}
开发者ID:MLDL,项目名称:drwn,代码行数:97,代码来源:scorePixelLabels.cpp

示例3: main


//.........这里部分代码省略.........
//            //   Convert time to samples if sample number is negative
//            //
//            for p = 1:size(events,1)
//                if events(p,1) < 0
//                    events(p,1) = events(p,2)*raw.info.sfreq;
//                end
//            end
//            //
//            //    Select the columns of interest (convert to integers)
//            //
//            events = int32(events(:,[1 3 4]));
//            //
//            //    New format?
//            //
//            if events(1,2) == 0 && events(1,3) == 0
//                fprintf(1,'The text event file %s is in the new format\n',eventname);
//                if events(1,1) ~= raw.first_samp
//                    error(me,'This new format event file is not compatible with the raw data');
//                end
//            else
//                fprintf(1,'The text event file %s is in the old format\n',eventname);
//                //
//                //   Offset with first sample
//                //
//                events(:,1) = events(:,1) + raw.first_samp;
//            end
        }
    }

    //
    //    Select the desired events
    //
    qint32 count = 0;
    MatrixXi selected = MatrixXi::Zero(1, events.rows());
    for (p = 0; p < events.rows(); ++p)
    {
        if (events(p,1) == 0 && events(p,2) == event)
        {
            selected(0,count) = p;
            ++count;
        }
    }
    selected.conservativeResize(1, count);
    if (count > 0)
        printf("%d matching events found\n",count);
    else
    {
        printf("No desired events found.\n");
        return 0;
    }


    fiff_int_t event_samp, from, to;
    MatrixXd timesDummy;

    MNEEpochDataList data;

    MNEEpochData* epoch = NULL;

    MatrixXd times;

    for (p = 0; p < count; ++p)
    {
        //
        //       Read a data segment
        //
开发者ID:GBeret,项目名称:mne-cpp,代码行数:67,代码来源:main.cpp

示例4: main


//.........这里部分代码省略.........
//            //   Convert time to samples if sample number is negative
//            //
//            for p = 1:size(events,1)
//                if events(p,1) < 0
//                    events(p,1) = events(p,2)*raw.info.sfreq;
//                end
//            end
//            //
//            //    Select the columns of interest (convert to integers)
//            //
//            events = int32(events(:,[1 3 4]));
//            //
//            //    New format?
//            //
//            if events(1,2) == 0 && events(1,3) == 0
//                fprintf(1,'The text event file %s is in the new format\n',eventname);
//                if events(1,1) ~= raw.first_samp
//                    error(me,'This new format event file is not compatible with the raw data');
//                end
//            else
//                fprintf(1,'The text event file %s is in the old format\n',eventname);
//                //
//                //   Offset with first sample
//                //
//                events(:,1) = events(:,1) + raw.first_samp;
//            end
        }
    }

    //
    //    Select the desired events
    //
    qint32 count = 0;
    MatrixXi selected = MatrixXi::Zero(1, events.rows());
    for (p = 0; p < events.rows(); ++p)
    {
        if (events(p,1) == 0 && events(p,2) == event)
        {
            selected(0,count) = p;
            ++count;
        }
    }
    selected.conservativeResize(1, count);
    if (count > 0)
        printf("%d matching events found\n",count);
    else
    {
        printf("No desired events found.\n");
        return 0;
    }


    fiff_int_t event_samp, from, to;
    MatrixXd timesDummy;

    MNEEpochDataList data;

    MNEEpochData* epoch = NULL;

    MatrixXd times;

    for (p = 0; p < count; ++p)
    {
        //
        //       Read a data segment
        //
开发者ID:eh1255,项目名称:mne-cpp,代码行数:67,代码来源:main.cpp

示例5: main

int main(int argc, char *argv[]) {
    cout << "Usage: " << argv[0] << " [FILENAME].[off|obj|ply] [1-7] [sl]"
         << endl;
    cout << "where 1-7 is the cost function to use" << endl;
    cout << "      s = save images at all decimation steps" << endl;
    cout << "      l = disable lighting" << endl;
    cout << endl;
    cout << "Keybindings:" << endl;
    cout << "  [space]  toggle animation." << endl;
    cout << "  'r'  reset." << endl;
    cout << "  '1'  edge collapse." << endl;
    cout << "  '2'  vertex split." << endl;
    cout << "  's'  save screenshot." << endl;
    cout << "  'c'  switch color mode." << endl;
    cout << "  'f'  cycle cost function." << endl;
    cout << endl;
    // Load a closed manifold mesh
    string filename;
    if (argc >= 2) {
        filename = argv[1];
    } else {
        return 0;
    }
    if (argc >= 3) {
        int idx = stoi(argv[2]) - 1;
        cost_function_n = idx;
        if (idx >= 0 && idx < cost_functions.size())
            shortest_edge_and_midpoint = *(cost_functions.begin() + idx);
    }

    if (!igl::read_triangle_mesh(filename, OV, OF)) {
        cout << "could not read mesh from \"" << filename << "\"" << endl;
        return 1;
    }

    // compute normals
    igl::per_face_normals(OV, OF, normals);

    // Prepare array-based edge data structures and priority queue
    // EMAP is a map from faces to edges.
    // Index into it like EMAP(face + i*F.rows()) where i is an edge index
    // between 0 and 2 corresponding to the three edges of a triangle.
    VectorXi EMAP;

    // E is a map from edges to vertices. Given some edge index e,
    // E(e, 0) and E(e, 1) are the two vertices that the edge is composed of.
    MatrixXi E;

    // EF is a map from edges to faces. For some edge index e,
    // EF(e, 0) and E(e, 1) are the two faces that contain the edge e.
    MatrixXi EF;

    // EI is a map from edges to face corners. For some edge index e,
    // EI(e, 0) is the index i such that EMAP(EF(e, 0) + i*F.rows()) == e and
    // EI(e, 1) is the index i such that EMAP(EF(e, 1) + i*F.rows()) == e.
    MatrixXi EI;

    typedef std::set<std::pair<double, int>> PriorityQueue;
    // Q stores the list of possible edge collapses and their costs
    PriorityQueue Q;
    std::vector<PriorityQueue::iterator> Qit;
    // If an edge were collapsed, we'd collapse it to these points:
    MatrixXd C;

    // Keep some info on edge collapses for reversal and debug reasons
    int num_collapsed;
    std::vector<MeshModification> mods;
    std::vector<int> iters;
    int total_decimations = 0;

    const auto &reset_view = [&]() {
        viewer.data.clear();
        viewer.data.set_mesh(V, F);
        switch (color_mode) {
        case DISTANCE_VISUALIZATION:
            generate_distance_field();
        case COST_VISUALIZATION:
            viewer.data.set_colors(colors);
            break;
        case SOLID:
            viewer.data.set_colors(RowVector3d(1.0, 1.0, 1.0));
            break;
        }
        viewer.data.set_face_based(false);
    };

    // Function to reset original mesh and data structures
    const auto &reset = [&]() {
        total_decimations = 0;
        mods.clear();
        iters.clear();
        F = OF;
        V = OV;
        igl::edge_flaps(F, E, EMAP, EF, EI);
        Qit.resize(E.rows());

        C.resize(E.rows(), V.cols());
        colors.resize(V.rows(), 3);
        colors.setZero();
        VectorXd costs(V.rows());
//.........这里部分代码省略.........
开发者ID:nwoeanhinnogaehr,项目名称:cmput414,代码行数:101,代码来源:main.cpp

示例6: main


//.........这里部分代码省略.........
//            for p = 1:size(events,1)
//                if events(p,1) < 0
//                    events(p,1) = events(p,2)*raw.info.sfreq;
//                end
//            end
//            //
//            //    Select the columns of interest (convert to integers)
//            //
//            events = int32(events(:,[1 3 4]));
//            //
//            //    New format?
//            //
//            if events(1,2) == 0 && events(1,3) == 0
//                fprintf(1,'The text event file %s is in the new format\n',eventname);
//                if events(1,1) ~= raw.first_samp
//                    error(me,'This new format event file is not compatible with the raw data');
//                end
//            else
//                fprintf(1,'The text event file %s is in the old format\n',eventname);
//                //
//                //   Offset with first sample
//                //
//                events(:,1) = events(:,1) + raw.first_samp;
//            end
        }
    }

//    std::cout << "Events:\n" << events << std::endl;

    //
    //    Select the desired events
    //
    qint32 count = 0;
    MatrixXi selected = MatrixXi::Zero(1, events.rows());
    for (p = 0; p < events.rows(); ++p)
    {
        if (events(p,1) == 0 && events(p,2) == eveNum)
        {
            selected(0,count) = p;
            ++count;
        }
    }
    selected.conservativeResize(1, count);
    if (count > 0)
        printf("%d matching events found\n",count);
    else
    {
        printf("No desired events found.\n");
        return 0;
    }


    fiff_int_t event_samp, from, to;
    MatrixXd timesDummy;

    MNEEpochDataList data;

    MNEEpochData* epoch = NULL;

    MatrixXd times;

    for (p = 0; p < count; ++p)
    {
        //
        //       Read a data segment
        //
开发者ID:BulatSuleymanoff,项目名称:mne-cpp,代码行数:67,代码来源:main.cpp

示例7: main


//.........这里部分代码省略.........
//            //   Convert time to samples if sample number is negative
//            //
//            for p = 1:size(events,1)
//                if events(p,1) < 0
//                    events(p,1) = events(p,2)*raw.info.sfreq;
//                end
//            end
//            //
//            //    Select the columns of interest (convert to integers)
//            //
//            events = int32(events(:,[1 3 4]));
//            //
//            //    New format?
//            //
//            if events(1,2) == 0 && events(1,3) == 0
//                fprintf(1,'The text event file %s is in the new format\n',eventname);
//                if events(1,1) ~= raw.first_samp
//                    error(me,'This new format event file is not compatible with the raw data');
//                end
//            else
//                fprintf(1,'The text event file %s is in the old format\n',eventname);
//                //
//                //   Offset with first sample
//                //
//                events(:,1) = events(:,1) + raw.first_samp;
//            end
        }
    }

    //
    //    Select the desired events
    //
    qint32 count = 0;
    MatrixXi selected = MatrixXi::Zero(1, events.rows());
//    std::cout << "Events:\n" << events << std::endl;
    for (p = 0; p < events.rows(); ++p)
    {
        if (events(p,1) == 0 && events(p,2) == event)
        {
            selected(0,count) = p;
            ++count;
        }
    }
    selected.conservativeResize(1, count);
    if (count > 0)
        printf("%d matching events found\n",count);
    else
    {
        printf("No desired events found.\n");
        return 0;
    }


    fiff_int_t event_samp, from, to;
    MatrixXd timesDummy;

    MNEEpochDataList data;

    MNEEpochData* epoch = NULL;

    MatrixXd times;

    for (p = 0; p < count; ++p)
    {
        //
        //       Read a data segment
开发者ID:GBeret,项目名称:mne-cpp,代码行数:67,代码来源:main.cpp

示例8: BMEclustering

RcppExport SEXP BMEclustering(SEXP mat, SEXP moda, SEXP nb_cluster, SEXP partition_initiale, SEXP nb_init,SEXP stop_criterion){
	srand(time(0));

	MatrixXi data=convertMatrix<MatrixXi,NumericMatrix>(mat);
	VectorXi modalite=convertvector<VectorXi,NumericVector>(moda);
	datafile dataF(data,modalite);

	NumericMatrix red=convertMatrix<NumericMatrix,MatrixXi>(dataF.Get_mat_datafile());
	VectorXi partition_vbles=convertvector<VectorXi,NumericVector>(partition_initiale);
	MatrixXi m;
	int g=as<int>(nb_cluster);
	//int borne=as<int>(nbiter);
	m.resize(g,partition_vbles.rows());
	for (int k=0;k<g;k++){
		m.row(k)=partition_vbles;
	}
	NumericMatrix test=convertMatrix<NumericMatrix,MatrixXi>(m);
	int nbinit=as<int>(nb_init);
	int borne=as<int>(stop_criterion);
	MCMCAlgo ref(dataF,m,m.rows(),2,1,2,6,borne);
	for (int ini=0;ini<nbinit;ini++){
		MCMCAlgo test(dataF,m,m.rows(),2,1,2,6,borne);
		if (test.Get_best_bic()>ref.Get_best_bic()){
			ref=test;
		}
	}
	//sauvegarde des caractéristiques du modèle
	NumericMatrix model=convertMatrix<NumericMatrix,MatrixXi>(ref.Get_best_omega());
	double bic=ref.Get_best_bic();
	double likelihood=ref.Get_best_like();
	NumericMatrix probapost=convertMatrix<NumericMatrix,MatrixXd>(ref.Sauv_probapost());
	NumericVector localise=convertvector<NumericVector,VectorXi>(dataF.Get_localise());

	vector< vector< NumericVector > > tau;
	vector< vector< vector< NumericVector > > > delta;
	vector< vector< vector< NumericVector > > > alpha;
	vector< vector< double > > rho;
	tau.resize(g);
	rho.resize(g);
	delta.resize(g);
	alpha.resize(g);
	for (int k=0;k<g;k++){
		tau[k].resize(ref.Get_best_omega().row(k).maxCoeff()+1);
		rho[k].resize(ref.Get_best_omega().row(k).maxCoeff()+1);
		delta[k].resize(ref.Get_best_omega().row(k).maxCoeff()+1);
		alpha[k].resize(ref.Get_best_omega().row(k).maxCoeff()+1);
		for (int b=0;b<=ref.Get_best_omega().row(k).maxCoeff();b++){
		//for (int b=0;b<2;b++){
			//vectblock[k][b]=ref.Get_rho(k,b);
			//vector < VectorXd > passe=ref.Get_alpha(k,b);
			if ((ref.Get_best_omega().row(k).array()==b).count()>0){
				vector<VectorXd> passe=ref.Get_alpha(k,b);
				alpha[k][b].resize((ref.Get_best_omega().row(k).array()==b).count());
				for (int loc=0;loc<((ref.Get_best_omega().row(k).array()==b).count());loc++){
					alpha[k][b][loc]=convertvector<NumericVector,VectorXd>(passe[loc]);
				}
			}
			if ((ref.Get_best_omega().row(k).array()==b).count()>1){
				MatrixXi passe=ref.Get_delta(k,b);
				delta[k][b].resize(passe.cols());
				tau[k][b]=convertvector<NumericVector,VectorXd>(ref.Get_tau(k,b));
				for (int loc=0;loc<passe.cols();loc++){
					delta[k][b][loc]=convertvector<NumericVector,VectorXi>(passe.col(loc));
				}
				//delta[k][b]=convertMatrix<NumericMatrix,MatrixXi>(ref.Get_delta(k,b));
				rho[k][b]=ref.Get_rho(k,b);
			}
		}
	}

	List param=List::create(Rcpp::Named("tau")=tau,Rcpp::Named("rho")=rho,Rcpp::Named("delta")=delta,Rcpp::Named("alpha")=alpha,Rcpp::Named("proportions")=convertvector<NumericVector,VectorXd>(ref.Get_propor()));
    List desc_model = List::create(Rcpp::Named("sigma")=model,Rcpp::Named("bic")=bic,Rcpp::Named("likelihood")=likelihood,Rcpp::Named("probapost")=probapost,Rcpp::Named("partition")=localise,Rcpp::Named("nbcluster")=nb_cluster,Rcpp::Named("parameters")=param);

    return desc_model;
}
开发者ID:rforge,项目名称:clustericat,代码行数:75,代码来源:BMEclustering.cpp

示例9: setLabels

void drwnNNGraphImageData::setLabels(const MatrixXi& labels)
{
    DRWN_ASSERT(((size_t)labels.rows() == height()) && ((size_t)labels.cols() == width()));
    _labels = labels;
}
开发者ID:dzenteno2,项目名称:drwn,代码行数:5,代码来源:drwnNNGraph.cpp

示例10: mexFunction

void mexFunction(
  int nlhs, mxArray *plhs[], 
  int nrhs, const mxArray *prhs[])
{
  using namespace std;
  using namespace Eigen;
  using namespace igl;
  using namespace igl::matlab;

  igl::matlab::MexStream mout;        
  std::streambuf *outbuf = cout.rdbuf(&mout);
  //mexPrintf("Compiled at %s on %s\n",__TIME__,__DATE__);

  MatrixXd P,V,C,N;
  MatrixXi F;
  VectorXi I;
  VectorXd S;
  SignedDistanceType type;
  parse_rhs(nrhs,prhs,P,V,F,type);

  if(F.rows() > 0)
  {
    switch(V.cols())
    {
      case 2:
      {
        // Persistent data not supported for 2D
        signed_distance(P,V,F,type,S,I,C,N);
        break;
      }
      case 3:
      {
        if(g_sign_type != type || g_V != V || g_F != F)
        {
          g_V = V;
          g_F = F;
          g_sign_type = type;
          // Clear the tree
          g_tree.deinit();

          // Prepare distance computation
          g_tree.init(V,F);
          switch(type)
          {
            default:
              assert(false && "Unknown SignedDistanceType");
            case SIGNED_DISTANCE_TYPE_DEFAULT:
            case SIGNED_DISTANCE_TYPE_WINDING_NUMBER:
              g_hier.set_mesh(V,F);
              g_hier.grow();
              break;
            case SIGNED_DISTANCE_TYPE_PSEUDONORMAL:
              // "Signed Distance Computation Using the Angle Weighted Pseudonormal"
              // [Bærentzen & Aanæs 2005]
              per_face_normals(V,F,g_FN);
              per_vertex_normals(V,F,PER_VERTEX_NORMALS_WEIGHTING_TYPE_ANGLE,
                g_FN,g_VN);
              per_edge_normals(
                V,F,PER_EDGE_NORMALS_WEIGHTING_TYPE_UNIFORM,
                g_FN,g_EN,g_E,g_EMAP);
              break;
          }
        }

        N.resize(P.rows(),3);
        S.resize(P.rows(),1);
        I.resize(P.rows(),1);
        C.resize(P.rows(),3);
        //for(int p = 0;p<P.rows();p++)
        igl::parallel_for(P.rows(),[&](const int p)
        {
          const Eigen::RowVector3d q(P(p,0),P(p,1),P(p,2));
          double s,sqrd;
          Eigen::RowVector3d c;
          int i;
          switch(type)
          {
            default:
              assert(false && "Unknown SignedDistanceType");
            case SIGNED_DISTANCE_TYPE_DEFAULT:
            case SIGNED_DISTANCE_TYPE_WINDING_NUMBER:
              signed_distance_winding_number(
                g_tree,g_V,g_F,g_hier,q,s,sqrd,i,c);
              break;
            case SIGNED_DISTANCE_TYPE_PSEUDONORMAL:
            {
              RowVector3d n(0,0,0);
              signed_distance_pseudonormal(
                g_tree,g_V,g_F,g_FN,g_VN,g_EN,g_EMAP,
                q,s,sqrd,i,c,n);
              N.row(p) = n;
              break;
            }
          }
          I(p) = i;
          S(p) = s*sqrt(sqrd);
          C.row(p) = c;
        },10000);
        break;
      }
//.........这里部分代码省略.........
开发者ID:alecjacobson,项目名称:gptoolbox,代码行数:101,代码来源:signed_distance.cpp

示例11: main


//.........这里部分代码省略.........
//            //   Convert time to samples if sample number is negative
//            //
//            for p = 1:size(events,1)
//                if events(p,1) < 0
//                    events(p,1) = events(p,2)*raw.info.sfreq;
//                end
//            end
//            //
//            //    Select the columns of interest (convert to integers)
//            //
//            events = int32(events(:,[1 3 4]));
//            //
//            //    New format?
//            //
//            if events(1,2) == 0 && events(1,3) == 0
//                fprintf(1,'The text event file %s is in the new format\n',eventname);
//                if events(1,1) ~= raw.first_samp
//                    error(me,'This new format event file is not compatible with the raw data');
//                end
//            else
//                fprintf(1,'The text event file %s is in the old format\n',eventname);
//                //
//                //   Offset with first sample
//                //
//                events(:,1) = events(:,1) + raw.first_samp;
//            end
        }
    }

    //
    //    Select the desired events
    //
    qint32 count = 0;
    MatrixXi selected = MatrixXi::Zero(1, events.rows());
    for (p = 0; p < events.rows(); ++p)
    {
        if (events(p,1) == 0 && events(p,2) == event)
        {
            selected(0,count) = p;
            ++count;
        }
    }
    selected.conservativeResize(1, count);
    if (count > 0)
        printf("%d matching events found\n",count);
    else
    {
        printf("No desired events found.\n");
        return 0;
    }


    fiff_int_t event_samp, from, to;
    MatrixXd timesDummy;

    MNEEpochDataList data;

    MNEEpochData* epoch = NULL;

    MatrixXd times;

    for (p = 0; p < count; ++p)
    {
        //
        //       Read a data segment
        //
开发者ID:Lx37,项目名称:mne-cpp,代码行数:67,代码来源:main.cpp


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