Ejemplo n.º 1
0
void EditPatchMod::RemoveSubSelSet(TSTR &setName)
{
	MaybeFixupNamedSels();
	
	ModContextList mcList;
	INodeTab nodes;
	
	if (!ip)
		return;	
	
	ip->GetModContexts(mcList, nodes);
	
	for (int i = 0; i < mcList.Count(); i++)
	{
		EditPatchData *patchData =(EditPatchData*)mcList[i]->localData;
		if (!patchData)
			continue;		
		patchData->BeginEdit(ip->GetTime());
		GenericNamedSelSetList &sel = patchData->GetSelSet(this);
		sel.RemoveSet(setName);
	}
	// Remove the modifier's entry
	RemoveSet(setName, selLevel);
	ip->ClearCurNamedSelSet();
	SetupNamedSelDropDown();
	nodes.DisposeTemporary();
}
Ejemplo n.º 2
0
void DiffWatershed(Image *grad, ImageForest *fst, Set *Obj, Set *Bkg, Set *Rm)
{
  AdjRel *A=NULL;
  GQueue *Q=NULL;
  Pixel   u,v;
  int     i,p,q,n,tmp,Cmax=MaximumValue(grad);
  Set    *aux, *Frontier=NULL;
  Image  *cost=fst->cost,*pred=fst->pred,*label=fst->label,*root=fst->root;

  n     = grad->ncols*grad->nrows;
  Q     = CreateGQueue(Cmax+1,n,cost->val);
  A     = Circular(1.5);

  if (Rm != NULL) { // Treat removed trees
    Frontier = ForestRemoval(fst,Rm,A);
    while (Frontier != NULL) {
      p = RemoveSet(&Frontier);
      InsertGQueue(&Q,p);
    }
  }
 
  /* Trivial path initialization for new seeds */

  aux = Obj;
  while(aux != NULL){
    p=aux->elem;
    if (Q->L.elem[p].color == GRAY) { /* p is also a frontier pixel,
		but the priority is it as a seed. */
      RemoveGQueueElem(Q,p);
    }
    label->val[p]=1; cost->val[p]=0; root->val[p]=p; pred->val[p]=NIL; 
    InsertGQueue(&Q,p);
    aux = aux->next;
  }

  aux = Bkg;
  while(aux != NULL){
    p=aux->elem;
    if (Q->L.elem[p].color == GRAY) { /* p is also a frontier pixel,
		but the priority is it as a seed. */
      RemoveGQueueElem(Q,p);
    }
    label->val[p]=0; cost->val[p]=0; root->val[p]=p; pred->val[p]=NIL;
    InsertGQueue(&Q,p);
    aux = aux->next;
  }

  /* Path propagation */

  while (!EmptyGQueue(Q)){
    p   = RemoveGQueue(Q);
    u.x = p%grad->ncols;
    u.y = p/grad->ncols;
    for (i=1; i < A->n; i++) {
      v.x = u.x + A->dx[i];
      v.y = u.y + A->dy[i];
      if (ValidPixel(grad,v.x,v.y)){
	q   = v.x + grad->tbrow[v.y];
	if (Q->L.elem[q].color != BLACK) {
	  tmp = MAX(cost->val[p] , grad->val[q]);
	  if ((tmp < cost->val[q])||(pred->val[q]==p)){
	    if (Q->L.elem[q].color == GRAY) { 
	      RemoveGQueueElem(Q,q);
	    }
	    cost->val[q]  = tmp;
	    label->val[q] = label->val[p];
	    root->val[q]  = root->val[p];
	    pred->val[q]  = p; 
	    InsertGQueue(&Q,q);
	  }
	}
      }
    }
  }

  DestroyGQueue(&Q);
  DestroyAdjRel(&A);
}
Ejemplo n.º 3
0
void CG3DRenderToGL::AddSet(CG3DGlobalSet::SetType type, CG3DGlobalSet* set)
{
	set->AddRef();
	RemoveSet(type);
	m_Sets[type] = set;
}