salut;
j'utilise visual c++ et vtk comme outils de d�v�loppement, dans mon projet.
Je travaille par la m�thode de contour actif, j'ai impl�ment� une fonctions pour ajouter ou supprimer des points de contour est un polydata(c'est un cercle), apr�s chaque it�ration,je n'ai aucun erreurs mais l'affichage de r�sulat �a marche pas (aucun affichage , il affiche dubug).
aidez moi stp
voil� mon code de fonction
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
void vtkSnake::ResampleSnake(vtkPolyData *snake,int dmax,int dmin)
{
 
 
 int numberOfPoints=snake->GetNumberOfPoints();
	int nbInputPoint,*inputPointsId;
 
	vtkPoints* points = snake->GetPoints();
	// get the number of point of the unregularized snake
	snake->GetLines()->GetCell(0,nbInputPoint,inputPointsId);
 
	for(int i=0;i<numberOfPoints;i++) {
             double pti[3];
	 points->GetPoint(inputPointsId[i],pti);
  // VERIFIER LES DISTANCES AVEC LA MOITIE DES POINTS SUIVANTS
	for(int idp=(1+numberOfPoints)/2;idp>0;idp--)
	{
		 double ptiFlw[3];
               points->GetPoint(inputPointsId[(idp+i)%numberOfPoints],ptiFlw);
               points->GetPoint(inputPointsId[idp],pti);
	double dist = sqrt(pow(ptiFlw[0]-pti[0],2)+pow(ptiFlw[1]-pti[1],2));
	 // si point eloignés
	    if(dist>dmin) continue;
	// Si point trop proch supprimer tous les point entre eux.
	 for(int k=0;k<idp;k++) 
	removeSnake(snake,inputPointsId[(i+1)%numberOfPoints]);
	break;
	}
	}
 
 
	for(int idp=0;idp<numberOfPoints;idp++)
	{
 
	double ptiFlw[3],pti[3];
 
           points->GetPoint(inputPointsId[(idp+1)%numberOfPoints],ptiFlw);
	points->GetPoint(inputPointsId[idp],pti);
          double dist = sqrt(pow(ptiFlw[0]-pti[0],2)+pow(ptiFlw[1]-pti[1],2));
	if(dist>dmax)
		{
			addSnake(snake,idp);
 
		}
	}
}
 
//-------------------------------------------------------------------------
void vtkSnake::addSnake(vtkPolyData *snake,int pos)
{
	int numberOfPoints=snake->GetNumberOfPoints();
	int nbInputPoint,*inputPointsId;
 
	vtkPoints* points = snake->GetPoints();
	// get the number of point of the unregularized snake
	snake->GetLines()->GetCell(0,nbInputPoint,inputPointsId);
           double ptiFlw[3],pti[3];
	points->GetPoint(inputPointsId[(pos+1)%numberOfPoints],ptiFlw);
	points->GetPoint(inputPointsId[pos],pti);
	double newX = (ptiFlw[0]+pti[0])/2.0;
	double newY = (ptiFlw[1]+pti[1])/2.0;
 
	int newId=points->InsertNextPoint(newX,newY,pti[2]);
	points->Modified();
 
	snake->GetLines()->InsertCellPoint(newId);
	snake->GetLines()->UpdateCellCount(numberOfPoints++);
	snake->Modified();
 
     numberOfPoints++;     			
 
 
}
 
//-------------------------------------------------------------------------
void vtkSnake::removeSnake(vtkPolyData *snake,int pos)
{
    int numberOfPoints=snake->GetNumberOfPoints();
	int nbInputPoint,*inputPointsId;
 
	snake->GetLines()->GetCell(0,nbInputPoint,inputPointsId);
     	snake->RemoveCellReference(inputPointsId[pos]);
	 snake->DeleteCell(inputPointsId[pos]);
	 snake->Modified();
     numberOfPoints--;
 
}