Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
SkelGraph.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Extract Skeleton
4  Module: $HeadURL$
5  Language: C++
6  Date: $Date$
7  Version: $Revision$
8 
9  Copyright (c) Brigham and Women's Hospital (BWH) All Rights Reserved.
10 
11  See License.txt or http://www.slicer.org/copyright/copyright.txt for details.
12 
13 ==========================================================================*/
14 #ifndef _SKEL_GRAPH_H_
15 #define _SKEL_GRAPH_H_
16 
17 #include <list>
18 #include "coordTypes.h"
19 
20 using namespace std;
21 
22 typedef struct skel_branch_struct
23  {
24  int branchID; // == position in graph
25  double length;
26 
27  double acc_length; // for temporary use when searching maximal path
28  list<int> * acc_path;
29 
30  double max_length;
31  list<int> * max_path; // maximal path
32 
35  list<int> * end_1_neighbors; // id's == one can use advance for random access
36  list<int> * end_2_neighbors;
37  } skel_branch;
38 
39 class SkelGraph
40 {
41 private:
42 
43  // Extracted Graph
44  list<skel_branch> * graph;
45 
46  // To_Do list, only of temporary use for extract graph
47  list<skel_branch> * to_do;
48 
49  // endpoint list, only of temporary use
50  list<point> * endpoints;
51 
52  // Image to extract from
53  unsigned char *image;
54  int dim[3];
55  // Label image, only of temporary use
56  int *label_image;
57 
58  skel_branch * max_node; // for storage of start of maximal path
59  double max_length;
60 
61  // private routines
62 
63  void Add_new_elem_to_todo(skel_branch * & newElem);
64 
65  // adds a new element with default values to To_do list
66 
67  void find_endpoints();
68 
69  // find all endpoints in image
70 
71  int endpoint_Test(int x, int y, int z);
72 
73  // tests whether (x,y,z) is an endpoint
74 
75  void get_valid_neighbors(point *point1, std::list<point> * & neighbors);
76 
77  // returns a list of valid neighbors at act_point
78 
79  void ResetGraph();
80 
81 public:
82 
83  SkelGraph();
84  SkelGraph(SkelGraph * graph); // not fully implemented
85  ~SkelGraph();
86 
87  void PrintGraph();
88 
89  void Extract_skel_graph(unsigned char *orig_image, int orig_dim[3]);
90  // Extract skeletal graph
91 
92  void Extract_max_axis_in_graph();
93 
94  // extract maximal path between 2 points in the graph
95 
96  void Sample_along_axis(int n_dim, list<point> * axis_points);
97 
98  // sample along the medial axis and perpendicular to it
99 
100 };
101 
102 #endif
point * end_2_point
Definition: SkelGraph.h:34
LRU Cache.
list< int > * acc_path
Definition: SkelGraph.h:28
point * end_1_point
Definition: SkelGraph.h:33
struct skel_branch_struct skel_branch
list< int > * end_1_neighbors
Definition: SkelGraph.h:35
list< int > * max_path
Definition: SkelGraph.h:31
list< int > * end_2_neighbors
Definition: SkelGraph.h:36