コード例 #1
0
ファイル: COSBindingNode.cpp プロジェクト: jasonhogan/sti
void COSBindingNode::prune()
{
	CosNaming::Name_var contextName;

	for(unsigned i=0; i < branches(); i++) {
		_branches.at(i)->prune();
	}

	//If all branches are dead, mark this node as dead.  It will later be unbound by its parent node.
	if (allBranchesDead()) {
		_isDead = true;
	}

	//Unbind all dead branches
	for (unsigned i = 0; i < branches(); i++) {
		if (_branches.at(i)->isDead()) {
			contextName = omni::omniURI::stringToName(
				_branches.at(i)->getName().c_str());

			context->unbind(contextName);
		}
	}

	//if (isDead()) {
	//	//		unregisterNode();
	//}
}
コード例 #2
0
void BaseTreeView::restoreLayout(KConfig *config, const QString &group)
{
  KListView::restoreLayout(config, group);
  KConfigGroupSaver saver(config, group);
  setShowToolTips( config->readBoolEntry("ShowToolTips", true) );

  if (! m_saveOpenFolder || ! qConfig.saveTrees)
    return;

  BaseTreeBranch *btb;
  KFileTreeBranchIterator it( branches() );
  int maxBranch = config->readNumEntry("NumOpenFolderList", 0);
  for (int i = 1; i <= maxBranch; ++i)
  {
    QStringList folderList = QuantaCommon::readPathListEntry(config, "OpenFolderList" + QString::number(i));
    if (folderList.count() > 1) {
      KURL rootURL = (*folderList.begin());
      folderList.remove(folderList.begin());  // remove the root URL
      KFileTreeBranchIterator it( branches() );
      for ( ; it.current(); ++it)
      {
        if ((*it)->rootUrl() == rootURL) {
          btb = dynamic_cast<BaseTreeBranch *>( (*it) );
          if (btb) {
            btb->folderToOpen = folderList;
            btb->reopenFolder();
            break;
          }
        }
      }
    }
  }
}
コード例 #3
0
ファイル: scangallery.cpp プロジェクト: KDE/kooka
FileTreeViewItem *ScanGallery::findItemByUrl(const KUrl &url, FileTreeBranch *branch)
{
    KUrl u(url);
    if (u.protocol()=="file")				// for local files,
    {
        QDir d(url.path());				// ensure path is canonical
        u.setPath(d.canonicalPath());
    }
    kDebug() << "URL search for" << u;

    // Prepare a list of branches to search.  If the parameter 'branch'
    // is set, search only in the specified branch. If it is NULL, search
    // all branches.
    FileTreeBranchList branchList;
    if (branch!=NULL) branchList.append(branch);
    else branchList = branches();

    FileTreeViewItem *foundItem = NULL;
    for (FileTreeBranchList::const_iterator it = branchList.constBegin();
         it!=branchList.constEnd(); ++it)
    {
        FileTreeBranch *branchloop = (*it);
        FileTreeViewItem *ftvi = branchloop->findItemByUrl(u);
        if (ftvi!=NULL)
        {
            foundItem = ftvi;
            kDebug() << "found item for" << ftvi->url();
            break;
        }
    }

    return (foundItem);
}
コード例 #4
0
ファイル: COSBindingNode.cpp プロジェクト: jasonhogan/sti
bool COSBindingNode::allBranchesDead()
{
	bool dead = true;

	for (unsigned i = 0; i < branches(); i++) {
		dead &= _branches.at(i)->isDead();
	}

	return hasBranches() && dead; // true if all branches of this node are dead
}
コード例 #5
0
ファイル: scangallery.cpp プロジェクト: KDE/kooka
void ScanGallery::updateParent(const FileTreeViewItem *curr)
{
    FileTreeBranch *branch = branches().at(0);		/* There should be at least one */
    if (branch==NULL) return;

    KUrl dir = itemDirectory(curr);
    kDebug() << "Updating directory" << dir;
    branch->updateDirectory(dir);

    FileTreeViewItem *parent = branch->findItemByUrl(dir);
    if (parent!=NULL) parent->setExpanded(true);	/* Ensure parent is expanded */
}
コード例 #6
0
void K3bFileTreeView::followUrl( const KURL& url )
{
  // TODO: first try the current branch
  KFileTreeBranchIterator it( branches() );
  for( ; *it; ++it ) {
    if( !d->branchDeviceMap.contains( *it ) )
      if( KFileTreeViewItem* item = (*it)->findTVIByURL( url ) ) {
	setCurrentItem( item );
	setSelected(item, true);
	ensureItemVisible( item );
	return;
      }
  }
}
コード例 #7
0
ファイル: scangallery.cpp プロジェクト: KDE/kooka
void ScanGallery::slotSelectDirectory(const QString &branchName, const QString &relPath)
{
    kDebug() << "branch" << branchName << "path" << relPath;

    FileTreeViewItem *item;
    if (!branchName.isEmpty()) item = findItemInBranch(branchName, relPath);
    else item = findItemInBranch(branches().at(0), relPath);
							// assume the 1st/only branch
    if (item==NULL) return;

    scrollToItem(item);
    setCurrentItem(item);
    slotItemActivated(item);				// load thumbnails, etc.
}
コード例 #8
0
DvcsJob::JobStatus GitRunner::currentBranch()
{
    DvcsJob::JobStatus status = branches();
    if (status != DvcsJob::JobSucceeded)
        return status;
    // Every branch is listed in one line. so first split by lines,
    // then look for the branch marked with a "*".
    QStringList list = m_result.split('\n');
    QString tmp = list.takeFirst();
    while (!tmp.contains('*', Qt::CaseInsensitive))
        tmp = list.takeFirst();

    tmp.remove(0, 2);
    m_result = tmp;
    return status;
}
コード例 #9
0
ファイル: COSBindingNode.cpp プロジェクト: jasonhogan/sti
void COSBindingNode::printNode(unsigned int offset)
{
	unsigned i;
	
	for(i = 0; i < offset; i++)
		std::cerr << "*";
	std::cerr << name << " ";
	if( isLeaf() )
		std::cerr << (isDead() ? "(Dead)" : "(Alive)");
	std::cerr << std::endl;

	for(i = 0; i < branches(); i++)
	{
		(*this)[i].printNode(offset + 1);
	}
}
コード例 #10
0
void BaseCheckoutWizardPage::slotRefreshBranches()
{
    if (!isBranchSelectorVisible())
        return;
    // Refresh branch list on demand. This is hard to make
    // automagically since there can be network slowness/timeouts, etc.
    int current;
    const QStringList branchList = branches(repository(), &current);
    d->ui.branchComboBox->clear();
    d->ui.branchComboBox->setEnabled(branchList.size() > 1);
    if (!branchList.isEmpty()) {
        d->ui.branchComboBox->addItems(branchList);
        if (current >= 0 && current < branchList.size())
            d->ui.branchComboBox->setCurrentIndex(current);
    }
    slotChanged();
}
コード例 #11
0
void BaseTreeView::slotReloadAllTrees()
{
  QPtrStack<BaseTreeBranch> stack;
  BaseTreeBranch *btb;
  KFileTreeBranchIterator it( branches() );
  for ( ; it.current(); ++it)
  {
    btb = dynamic_cast<BaseTreeBranch *>( (*it) );
    if (btb && btb->rootUrl().isLocalFile()) {
      stack.push(btb);
    }
  }
  while (! stack.isEmpty())
  {
    reload(stack.pop());
  }
}
コード例 #12
0
void BaseTreeView::slotDocumentClosed(const KURL& url)
{
  KFileTreeViewItem * item;
  KFileTreeBranchIterator it( branches() );
  for ( ; it.current(); ++it)
  {
    item = (*it)->findTVIByURL(url);
    if (item)
    {
      item->repaint();
    }
  }
/*  QListViewItemIterator iter(this);
  for ( ; iter.current(); ++iter )
  {
    iter.current()->repaint();
  }*/
}
コード例 #13
0
ファイル: scangallery.cpp プロジェクト: KDE/kooka
bool ScanGallery::prepareToSave(const ImageMetaInfo *info)
{
    if (info==NULL) kDebug() << "no image info";
    else kDebug() << "type" << info->getImageType();

    delete mSaver; mSaver = NULL;			// recreate with clean info

    // Resolve where to save the new image when it arrives
    FileTreeViewItem *curr = highlightedFileTreeViewItem();
    if (curr==NULL)					// into root if nothing is selected
    {
        FileTreeBranch *branch = branches().at(0);	// there should be at least one
        if (branch!=NULL)
        {						// if user has created this????
            curr = findItemInBranch(branch, i18n("Incoming/"));
            if (curr==NULL) curr = branch->root();
        }

        if (curr==NULL) return (false);			// should never happen
        curr->setSelected(true);
    }

    mSavedTo = curr;					// note for selecting later

    // Create the ImgSaver to use later
    KUrl dir(itemDirectory(curr));			// where new image will go
    mSaver = new ImgSaver(dir);				// create saver to use later

    if (info!=NULL)					// have image information,
    {							// tell saver about it
        ImgSaver::ImageSaveStatus stat = mSaver->setImageInfo(info);
        if (stat==ImgSaver::SaveStatusCanceled) return (false);
    }

    return (true);					// all ready to save
}
コード例 #14
0
void BaseTreeView::saveLayout(KConfig *config, const QString &group)
{
  KListView::saveLayout(config, group);
  if (! m_saveOpenFolder || ! qConfig.saveTrees)
    return;

  KConfigGroupSaver saver(config, group);
  BaseTreeBranch *btb;
  int i = 0;
  KFileTreeBranchIterator it( branches() );
  for ( ; it.current(); ++it)
  {
    btb = dynamic_cast<BaseTreeBranch *>( (*it) );
    if (btb && btb->rootUrl().isLocalFile()) {
      ++i;
      QStringList folderList;
      // remember the root url so that I find the branch on restore
      folderList.append(btb->rootUrl().url());
      btb->addOpenFolder(&folderList);
      config->writePathEntry("OpenFolderList" + QString::number(i), folderList);
    }
  }
  config->writeEntry("NumOpenFolderList", i);
}
コード例 #15
0
ファイル: COSBindingNode.cpp プロジェクト: jasonhogan/sti
bool COSBindingNode::hasBranches() const
{
	return ( branches() > 0 );
}
コード例 #16
0
ファイル: JetUtilities.C プロジェクト: CmsHI/CVS_CmsHi
void HiForest::correlateTracks(TTree* jetTree, Jets& jets, bool allEvents, bool smeared){ 

   vector<TBranch*> branches(0);

   if(allEvents || currentEvent == 0){

     if(1){
      jtChg = new Float_t[maxEntry];
      jtNeut = new Float_t[maxEntry];
      jtEM = new Float_t[maxEntry];

      jtChgGen = new Float_t[maxEntry];
      jtNeutGen = new Float_t[maxEntry];
      jtEMGen = new Float_t[maxEntry];

     

      jtPtMax = new Float_t[maxEntry];
      jtPtMean = new Float_t[maxEntry];
      jtPtMeanW = new Float_t[maxEntry];

      jtLeadType = new Int_t[maxEntry];
     }

      tjDeltaEtaLead = new Float_t[maxEntryTrack];
      tjDeltaPhiLead = new Float_t[maxEntryTrack];
      zLead = new Float_t[maxEntryTrack];

      tjDeltaEtaSubLead = new Float_t[maxEntryTrack];
      tjDeltaPhiSubLead = new Float_t[maxEntryTrack];
      zSubLead = new Float_t[maxEntryTrack];

      zOldLead = new Float_t[maxEntryTrack];
      zOldSubLead = new Float_t[maxEntryTrack];


      zSingleLead = new Float_t[maxEntryTrack];
      zLabLead = new Float_t[maxEntryTrack];

      tjDeltaThetaLead = new Float_t[maxEntryTrack];
      tjDeltaThetaLabLead = new Float_t[maxEntryTrack];
      tjDeltaThetaSingleLead = new Float_t[maxEntryTrack];


      zSingleSubLead = new Float_t[maxEntryTrack];
      zLabSubLead = new Float_t[maxEntryTrack];

      tjDeltaThetaSubLead = new Float_t[maxEntryTrack];
      tjDeltaThetaLabSubLead = new Float_t[maxEntryTrack];
      tjDeltaThetaSingleSubLead = new Float_t[maxEntryTrack];


      corrLead = new Float_t[maxEntryTrack];
      corrSubLead = new Float_t[maxEntryTrack];

      branches.push_back(jetTree->Branch("jtChg",jtChg,"jtChg[nref]/F"));
      branches.push_back(jetTree->Branch("jtNeut",jtNeut,"jtNeut[nref]/F"));
      branches.push_back(jetTree->Branch("jtEM",jtEM,"jtEM[nref]/F"));
      branches.push_back(jetTree->Branch("jtChgGen",jtChgGen,"jtChgGen[nref]/F"));
      branches.push_back(jetTree->Branch("jtNeutGen",jtNeutGen,"jtNeutGen[nref]/F"));
      branches.push_back(jetTree->Branch("jtEMGen",jtEMGen,"jtEMGen[nref]/F"));
      branches.push_back(jetTree->Branch("jtPtMax",jtPtMax,"jtPtMax[nref]/F"));
      branches.push_back(jetTree->Branch("jtPtMean",jtPtMean,"jtPtMean[nref]/F"));
      branches.push_back(jetTree->Branch("jtPtMeanW",jtPtMeanW,"jtPtMeanW[nref]/F"));
      branches.push_back(jetTree->Branch("jtLeadType",jtLeadType,"jtLeadType[nref]/I"));

      branches.push_back(trackTree->Branch("tjDetaLead",tjDeltaEtaLead,"tjDetaLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDphiLead",tjDeltaPhiLead,"tjDphiLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zLead",zLead,"zLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDetaSubLead",tjDeltaEtaSubLead,"tjDetaSubLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDphiSubLead",tjDeltaPhiSubLead,"tjDphiSubLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zSubLead",zSubLead,"zSubLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zOldLead",zOldLead,"zOldLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zOldSubLead",zOldSubLead,"zOldSubLead[nTrk]/F"));

      branches.push_back(trackTree->Branch("zSingleLead",zSingleLead,"zSingleLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zSingleSubLead",zSingleSubLead,"zSingleSubLead[nTrk]/F"));

      branches.push_back(trackTree->Branch("zLabLead",zLabLead,"zLabLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("zLabSubLead",zSubLead,"zLabSubLead[nTrk]/F"));

      branches.push_back(trackTree->Branch("tjDthetaLead",tjDeltaThetaLead,"tjDthetaLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDthetaLabLead",tjDeltaThetaLabLead,"tjDthetaLabLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDthetaSingleLead",tjDeltaThetaSingleLead,"tjDthetaSingleLead[nTrk]/F"));

      branches.push_back(trackTree->Branch("tjDthetaSubLead",tjDeltaThetaSubLead,"tjDthetaSubLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDthetaLabSubLead",tjDeltaThetaLabSubLead,"tjDthetaLabSubLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("tjDthetaSingleSubLead",tjDeltaThetaSingleSubLead,"tjDthetaSingleSubLead[nTrk]/F"));


      branches.push_back(trackTree->Branch("corrLead",corrLead,"corrLead[nTrk]/F"));
      branches.push_back(trackTree->Branch("corrSubLead",corrSubLead,"corrSubLead[nTrk]/F"));

      jetTree->SetAlias("jtFracChg","jtChg/jtpt");
      jetTree->SetAlias("jtFracNeut","jtNeut/jtpt");
      jetTree->SetAlias("jtFracEM","jtFracEM/jtpt");
      jetTree->SetAlias("refFracChg","jtChg/refpt");
      jetTree->SetAlias("refFracNeut","jtNeut/refpt");
      jetTree->SetAlias("refFracEM","jtFracEM/refpt");
      jetTree->SetAlias("jtFracChgGen","jtChgGen/jtpt");
      jetTree->SetAlias("jtFracNeutGen","jtNeutGen/refpt");
      jetTree->SetAlias("jtFracEMGen","jtFracEMGen/refpt");

      trackTree->SetAlias("tjDRlead","sqrt(tjDetaLead*tjDetaLead+tjDphiLead*tjDphiLead)");
      trackTree->SetAlias("tjDRsublead","sqrt(tjDetaSubLead*tjDetaSubLead+tjDphiSubLead*tjDphiSubLead)");

   }

   double correctionFactors[4] = {0,0,0,0};

   for (int i=0; allEvents ? i<GetEntries() : 1;i++){
      if(i % 1000 == 0) cout<<"Processing Event : "<<i<<endl;
      if(allEvents){
	 jetTree->GetEntry(i);
	 trackTree->GetEntry(i);
	 hltTree->GetEntry(i);
      }

      int cbin = evt.hiBin;
      if(collisionMode == cPP) cbin = 33;

      double eventEta = 0;
      if(hasDiJet(jets)) eventEta = (jets.jteta[jtLead]+jets.jteta[jtSubLead])/2.;

      for(int j = 0; j < jets.nref; ++j){

	jtChg[j] = 0;
        jtNeut[j] = 0;
        jtEM[j] = 0;

	jtPtMax[j] = 0;
        jtPtMean[j] = 0;
        jtPtMeanW[j] = 0;

	jtLeadType[j] = 0;

	 for (int t = 0; t < track.nTrk; ++t) {

	   double jetPt = jets.jtpt[j];
	   if(smeared)jetPt = jets.smpt[j];

	    if(j == jtLead){
	       tjDeltaEtaLead[t] = track.trkEta[t] - jets.jteta[j];
	       tjDeltaPhiLead[t] = deltaPhi(track.trkPhi[t],jets.jtphi[j]);

	       zOldLead[t] = track.trkPt[t]/jetPt;
	       zLead[t] = getProjectedZ(jetPt,jets.jteta[j],jets.jtphi[j],track.trkPt[t],track.trkEta[t],track.trkPhi[t],eventEta);
	       //	       cout<<"jtpt : "<<jets.jtpt[j]<<"  spt : "<<jets.smpt[j]<<endl;

	       corrLead[t] = trackCorrections[0]->GetCorr(track.trkPt[t],track.trkEta[t],jetPt,cbin,correctionFactors);
	    }
	    if(j == jtSubLead){
	       tjDeltaEtaSubLead[t] = track.trkEta[t] - jets.jteta[j];
               tjDeltaPhiSubLead[t] = deltaPhi(track.trkPhi[t],jets.jtphi[j]);
               zSubLead[t] = getProjectedZ(jetPt,jets.jteta[j],jets.jtphi[j],track.trkPt[t],track.trkEta[t],track.trkPhi[t],eventEta);
               zOldSubLead[t] = track.trkPt[t]/jetPt;
               corrSubLead[t] = trackCorrections[1]->GetCorr(track.trkPt[t],track.trkEta[t],jetPt,cbin,correctionFactors);
	    }

	    double dr = deltaR(track.trkEta[t],track.trkPhi[t],jets.jteta[j],jets.jtphi[j]);
	    if(dr > cone) continue;
	    if(jtPtMax[j] < track.trkPt[t]) jtPtMax[j] = track.trkPt[t];
	    jtChg[j] += track.trkPt[t];
	    
	 }
      }
      for(unsigned int ib = 0; ib < branches.size(); ++ib){
         branches[ib]->Fill();
      }
   }
  
   return;
}
コード例 #17
0
ファイル: JetUtilities.C プロジェクト: CmsHI/CVS_CmsHi
void HiForest::sortJets(TTree* jetTree, Jets& jets, double etaMax, double ptMin, bool allEvents, int smearType){

  jetsmear::JetResolution* res = 0;
  if(smearType==0){
    res = new jetsmear::JetResolution();
  }

  vector<TBranch*> branches(0);

   if(allEvents || currentEvent == 0){
      branches.push_back(jetTree->Branch("Lead",&jtLead,"Lead/I"));
      branches.push_back(jetTree->Branch("SubLead",&jtSubLead,"SubLead/I"));
      branches.push_back(jetTree->Branch("HasDijet",&jtHasDijet,"HasDijet/O"));
      branches.push_back(jetTree->Branch("HasLeadingJet",&jtHasLeadingJet,"HasLeadingJet/O"));

      if(smearType==0 && !mc){
	branches.push_back(jetTree->Branch("smpt",jets.smpt,"smpt[nref]/F"));
      }

      jetTree->SetAlias("AJ","(jtpt[Lead]-jtpt[SubLead])/(jtpt[Lead]+jtpt[SubLead])");
      jetTree->SetAlias("dijetEta","(jteta[Lead]+jteta[SubLead])/2.");
   }

   vector<JetIndex> vecs;
   vecs.reserve(maxEntry);

   for (int i=0; allEvents ? i<GetEntries() : 1;i++){
      if(verbose && i % 50000 == 0) cout<<"Processing Event : "<<i<<endl;
 
     if(allEvents){
	jetTree->GetEntry(i);
      }

      vecs.clear();

      if(smearType == 0)res->roll();
	      
      for(int j = 0; j < jets.nref; ++j){
	//         if(jets.jtpt[j] < ptMin) continue;
	 if(fabs(jets.jteta[j]) > etaMax) continue;
	 
	 JetIndex entry;
	 entry.pt = jets.jtpt[j];
	 entry.index = j;

	 if(smearType == 0){
	   entry.pt += res->getFluct(jets,j);
	   if(collisionMode == cPbPb && i>=0) cout<<"Flucted"<<endl;
	   jets.smpt[j] = entry.pt;
	   jets.jtpt[j] = entry.pt;
	 }
	 vecs.push_back(entry);
      }

      sort(vecs.begin(),vecs.end(),comparePt);

      jtLead=-1;
      jtSubLead=-1;
      jtHasLeadingJet = 0;
      jtHasDijet = 0;

      if(vecs.size() > 0){
	 jtLead = vecs[0].index;
	 if(smearType == 0 && jets.smpt[jtLead] > 100) jtHasLeadingJet = 1;
	 if(smearType != 0 && jets.jtpt[jtLead] > 100) jtHasLeadingJet = 1;
      }

      if(vecs.size() > 1){
	 jtSubLead = vecs[1].index;
	 if(smearType == 0 &&jets.smpt[jtSubLead] > 40){
           jtHasDijet = jtHasLeadingJet && fabs(deltaPhi(jets.jtphi[jtLead],jets.jtphi[jtSubLead])) > 2.*3.1415926/3.;
         }
	 if(smearType != 0 && jets.jtpt[jtSubLead] > 40){
	   jtHasDijet = jtHasLeadingJet && fabs(deltaPhi(jets.jtphi[jtLead],jets.jtphi[jtSubLead])) > 2.*3.1415926/3.;
	 }
      }

      for(int ib = 0; ib < branches.size(); ++ib){
	 branches[ib]->Fill();
      }

   }
   
   return;
}
コード例 #18
0
ファイル: Sim.cpp プロジェクト: mellery451/rippled
std::size_t
Sim::branches() const
{
    return branches(allPeers);
}
コード例 #19
0
bool prune_branch(NeuronTree nt, NeuronTree & result)
{
	double thres = 0.05;

	V3DLONG siz = nt.listNeuron.size();
	vector<V3DLONG> branches(siz,0); //number of branches on the pnt: 0-tip, 1-internal, >=2-branch
	for (V3DLONG i=0;i<siz;i++)
	{
		if (nt.listNeuron[i].pn<0) continue;
		V3DLONG pid = nt.hashNeuron.value(nt.listNeuron[i].pn);
		branches[pid]++;
	}
	
	double diameter = calculate_diameter(nt, branches);
	printf("diameter=%.3f\n",diameter);
	

	//calculate the shortest edge starting from each tip point
	vector<bool> to_prune(siz, false);
	for (V3DLONG i=0;i<siz;i++)
	{
		if (branches[i]!=0) continue;
		//only consider tip points
		vector<V3DLONG> segment;
		double edge_length = 0;
		V3DLONG cur = i;
		V3DLONG pid;
		do
		{
			NeuronSWC s = nt.listNeuron[cur];
			segment.push_back(cur);
			pid = nt.hashNeuron.value(s.pn);
			edge_length += DIST(s, nt.listNeuron[pid]);
			cur = pid;
		}
		while (branches[pid]==1 && pid>0);
		if (pid<0)
		{
			printf("The input tree has only 1 root point. Please check.\n");
			return false;
		}
		if (edge_length < diameter * thres)
		{
			for (int j=0;j<segment.size();j++)
				to_prune[segment[j]] = true;
		}
	}



	//prune branches
	result.listNeuron.clear();
	result.hashNeuron.clear();
	for (V3DLONG i=0;i<siz;i++)
	{
		if (!to_prune[i])
		{
			NeuronSWC s = nt.listNeuron[i];
			result.listNeuron.append(s);
			result.hashNeuron.insert(nt.listNeuron[i].n, result.listNeuron.size()-1);
		}
	}

	return true;
}
コード例 #20
0
ファイル: patch.cpp プロジェクト: svn2github/texmacs
array<patch>
branches (patch p, int i, int j) {
  ASSERT (0 <= i && i <= nr_branches (p), "index out of range");
  ASSERT (i <= j && j <= nr_branches (p), "index out of range");
  return range (branches (p), i, j);
}