]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/kernel/include/vtkDijkstraImageData.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / kernel / include / vtkDijkstraImageData.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26
27  
28  
29  #ifndef __VTK__VTK__DIJKSTRA__IMAGE__DATA__H
30  #define __VTK__VTK__DIJKSTRA__IMAGE__DATA__H
31  
32  #include "vtkPolyDataSource.h"
33  #include "vtkImageData.h"
34  #include "vtkPoints.h"
35  #include "vtkCellArray.h"
36  #include "vtkPolyData.h"
37
38  
39  class vtkIntArray;
40  class vtkDataArray;
41  class vtkPriorityQueue;
42  class vtkIdList;
43  class vtkDijkstraImageData : public vtkPolyDataSource
44  {
45    public:
46    static vtkDijkstraImageData *New();
47    vtkTypeMacro(vtkDijkstraImageData,vtkPolyDataSource);
48    void PrintSelf(ostream& os, vtkIndent indent);
49    
50    vtkSetMacro(SourceID,int);
51    vtkGetMacro(SourceID,int);
52  
53  
54    vtkSetMacro(SinkID,int);
55    vtkGetMacro(SinkID,int);
56  
57    vtkGetObjectMacro(Parent,vtkIntArray);
58  
59    
60    
61    virtual void SetBoundaryScalars(vtkDataArray*);
62    vtkGetObjectMacro(BoundaryScalars,vtkDataArray);
63  
64    
65    vtkSetMacro(NumberOfInputPoints,int);
66    vtkGetMacro(NumberOfInputPoints,int);
67    
68    
69    vtkSetMacro(NumberOfGraphNodes,int);
70    vtkGetMacro(NumberOfGraphNodes,int);
71    
72    
73    vtkIdList* GetShortestPathIdList();
74    
75    
76    vtkSetMacro(UseInverseDistance,int);
77    vtkGetMacro(UseInverseDistance,int);
78    
79   
80    vtkSetMacro(UseInverseSquaredDistance,int);
81    vtkGetMacro(UseInverseSquaredDistance,int);
82  
83   
84    vtkSetMacro(UseInverseExponentialDistance,int);
85    vtkGetMacro(UseInverseExponentialDistance,int);
86  
87    vtkSetMacro(UseSquaredDistance,int);
88    vtkGetMacro(UseSquaredDistance,int);
89  
90        
91    // Description:
92    unsigned long GetMTime();
93    
94    // path operations
95    void InitTraversePath();
96    int GetNextPathNode();
97    int GetNumberOfPathNodes();
98    
99  
100    void SetInput(vtkImageData*);
101    vtkImageData* GetInput();
102    
103    
104    void CreateGraph(vtkImageData *inData);
105    void DeleteGraph();
106    void FindNeighbors(vtkIdList *list,int id, vtkDataArray *scalars); 
107    
108    int findClosestPointInGraph(vtkDataArray *scalars,int id,int dim0,int dim1, int dim2); 
109    
110  
111   
112    
113    void InitSingleSource(int startv);
114   
115    void RunDijkstra(vtkDataArray *scalars,int source, int sink);
116    
117    float EdgeCost(vtkDataArray *scalars, int u, int v);
118    void BuildShortestPath(int start,int end);
119   
120          
121    
122    
123    int SourceID;
124    
125    
126    int SinkID;  
127    
128    
129    vtkDataArray *BoundaryScalars;
130  
131   
132    int NumberOfInputPoints;
133    int NumberOfGraphNodes;
134  
135    int UseInverseDistance;
136    int UseInverseSquaredDistance;
137    int UseInverseExponentialDistance;
138    int UseSquaredDistance;
139  
140   
141    
142    vtkPriorityQueue *PQ;
143  
144    
145    vtkIdList *ShortestPathIdList;
146    
147    vtkIntArray *Parent;
148    
149    vtkIntArray *Visited;  
150   
151   
152    int PathPointer;
153   
154    int StopWhenEndReached;
155
156
157    vtkPoints *puntos; 
158    vtkCellArray *lineas;
159    vtkImageData *input;
160
161
162
163         void init(vtkImageData *inData);
164
165         void printPointData(int pointID);
166
167         float fuerzaAtraccion(int u, float w);
168         
169  
170  protected:
171    vtkDijkstraImageData();
172    ~vtkDijkstraImageData();
173     void Execute();
174
175    
176    FILE *logger;
177  
178  private:
179 //   vtkDijstraImageData(const vtkDijkstraImageData&);
180    void operator=(const vtkDijkstraImageData&);
181  };
182  
183  #endif //__VTK__VTK__DIJKSTRA__IMAGE__DATA__H
184  
185  
186  
187