You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fibertube/DEMO.md
+51-35Lines changed: 51 additions & 35 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,23 @@
1
-
# Demo Workshop
1
+
# Demo
2
2
In this demo, you will be introduced to the main scripts of this project as you apply them on simple data.
3
3
<br><br>
4
-
Our main objective is better understand and quantify the fundamental limitations of tractography algorithms, and how they might evolve as we approach microscopy resolution where individual axons can be seen, tracked or segmented. To do so, we will be evaluating tractography's ability to reconstruct individual white matter fiber strands at various simulated extreme resolutions.
4
+
Our main objective is better understand and quantify the fundamental limitations of tractography algorithms, and how they might evolve as we approach microscopy resolution where individual axons can be seen. To do so, we will be evaluating tractography's ability to reconstruct individual white matter fiber strands at various simulated extreme resolutions.
5
5
## Terminology
6
6
Here is a list of terms and definitions used in this project.
7
7
8
8
General:
9
9
- Axon: Bio-physical object. Portion of the nerve cell that carries out the electrical impulse to other neurons. (On the order of 0.1 to 1um)
10
-
- Streamline: Virtual object. Series of equidistant 3D coordinates approximating an underlying fiberous structure.
10
+
- Streamline: Virtual object. Series of 3D coordinates approximating an underlying fiber structure.
11
11
12
12
Fibertube Tracking:
13
-
- Centerline: Virtual object. Series of equidistant 3D coordinates representing the directional information of a fibertube.
14
-
- Fibertube: Virtual representation of an axon. It is composed of a centerline and a single diameter for its whole length.
15
-
- Fibertube segment: Because centerlines are made of discrete coordinates, fibertubes end up being composed of a series of equally lengthed adjacent cylinders. A fibertube segment is any single one of those cylinders.
16
-
- Fibertube Tractography: The application of a tractography algorithm directly on fibertubes to reconstruct them. Contrary to traditional white matter fiber tractography, fibertube tractography does not rely on a discretized grid of fODFs or peaks.
13
+
- Fibertube: Virtual representation of an axon. Tube obtained from combining a diameter to a streamline.
14
+
- Centerline: Virtual object. Streamline passing through the center of a tubular structure.
15
+
- Fibertube segment: Cylindrical segment of a fibertube that comes as a result of the discretization of its centerline.
16
+
- Fibertube Tractography: The computational tractography method that reconstructs fibertubes. Contrary to traditional white matter fiber tractography, fibertube tractography does not rely on a discretized grid of fODFs or peaks. It directly tracks and reconstructs fibertubes, i.e. streamlines that have an associated diameter.
17
+
18
+
19
+

17
20
18
-

19
21
20
22
## Methodology
21
23
This project can be split into 3 major steps:
@@ -33,9 +35,9 @@ This project can be split into 3 major steps:
33
35
34
36
The data required to perform fibertube tractography comes in two files:
35
37
-`./centerlines.trk` contains the entire ground-truth of the DISCO dataset.
36
-
-`./diameters.txt` contains the diameters.
38
+
-`./diameters.txt` contains the diameter to be applied to each centerline in the centerlines.trk file above.
37
39
38
-

40
+

39
41
40
42
The first thing to do is resample `centerlines.trk` so that each centerline is formed of
Next, we want to filter out intersecting fibertubes, to make the data anatomically plausible and remove any partial volume effect.
52
54
53
-

55
+

54
56
55
57
This is accomplished using `scil_tractogram_filter_collisions.py`. <br>
56
58
@@ -69,6 +71,12 @@ After a short wait, you should get something like:
69
71
70
72
As you may have guessed from the output name, this script automatically combines the diameter to the centerlines as data_per_streamline in the output tractogram. This is why we named it "fibertubes.trk".
71
73
74
+
If you wish to know how many fibertubes are left after filtering, you can run the following command:
75
+
76
+
```scil_tractogram_print_info.py fibertube.txt```
77
+
78
+
79
+
72
80
## Visualising collisions
73
81
By calling:
74
82
```
@@ -80,19 +88,20 @@ In white and lower opacity is the original tractogram passed as `--ref_tractogra
80
88

81
89
82
90
### Fibertube metrics
83
-
Before we get into tracking. Here is an overview of the metrics that we saved in `metrics.txt`:
91
+
Before we get into tracking. Here is an overview of the metrics that we saved in `metrics.txt`. They are all expressed in mm:
84
92
85
93
-`min_external_distance`: Smallest distance separating two fibertubes, outside their diameter.
86
94
-`max_voxel_anisotropic`: Diagonal vector of the largest possible anisotropic voxel that would not intersect two fibertubes.
87
95
-`max_voxel_isotropic`: Isotropic version of max_voxel_anisotropic made by using the smallest component. <br>
-`max_voxel_rotated`: Largest possible isotropic voxel obtainable if the tractogram is rotated. It is only usable if the entire tractogram is rotated according to [rotation_matrix].
-`rotation_matrix`: 4D transformation matrix representing the rotation to be applied on the tractogram to align max_voxel_rotated with the coordinate system (see scil_tractogram_apply_transform.py).
92
99
93
-

100
+

94
101
<br>
95
-

102
+
103
+

104
+
96
105
97
106
> [!NOTE]
98
107
> This information can be useful for analyzing the reconstruction obtained through tracking, as well as for performing track density imaging.
We're finally at the tracking phase! Using the script `scil_fibertube_tracking.py`, you are able to track without relying on a discretized grid of directions or fODFs. Instead, you will be propagating a streamline through fibertubes and degrading the resolution by using a `blur_radius`. The way it works is as follows:
102
111
103
112
### Tracking
104
-
When the tracking algorithm is about to select a new direction to propagate the current streamline, it will build a sphere of radius `blur_radius` and pick randomely from all the fibertube segments intersecting with it. The larger the intersection volume, the more likely a fibertube segment is to be picked and used as a tracking direction. This makes fibertube tracking inherently probabilistic.
113
+
When the tracking algorithm is about to select a new direction to propagate the current streamline, it will build a sphere of radius `blur_radius` and pick randomly from all the fibertube segments intersecting with it. The larger the intersection volume, the more likely a fibertube segment is to be picked and used as a tracking direction. This makes fibertube tracking inherently probabilistic.
105
114
Theoretically, with a `blur_radius` of 0, any given set of coordinates has either a single tracking direction because it is within a fibertube, or no direction at all from being out of one. In fact, this behavior won't change until the diameter of the sphere is larger than the smallest distance separating two fibertubes. When this happens, more than one fibertubes will intersect the `blur_radius` sphere and introduce partial volume effect.
106
115
107
116
@@ -124,36 +133,42 @@ By using the `scil_fibertube_score_tractogram.py` script, you are able to obtain
124
133
125
134
VC: "Valid Connection": Represents a streamline that ended in the final
126
135
segment of the fibertube in which it was seeded.
127
-
IC: "Invalid Connection": Represents a streamline that ended in the final
128
-
segment of another fibertube.
129
-
NC: "No Connection": Contains streamlines that have not ended in the final
130
-
segment of any fibertube.
136
+
IC: "Invalid Connection": Represents a streamline that ended in the first or
137
+
final segment of another fibertube.
138
+
NC: "No Connection": Contains streamlines that have not ended in the first or
139
+
final segment of any fibertube.
131
140
132
-
A "coordinate absolute error" is the distance in mm between a streamline
141
+
The "absolute error" of a coordinate is the distance in mm between this streamline
133
142
coordinate and the closest point on its corresponding fibertube. The average
134
143
of all coordinate absolute errors of a streamline is called the "Mean absolute
135
144
error" or "mae".
136
145
137
146
Computed metrics:
138
-
- truth_vc_ratio
147
+
- truth_vc_ratio <br>
139
148
Proportion of VC.
140
-
- truth_ic_ratio
149
+
- truth_ic_ratio <br>
141
150
Proportion of IC.
142
-
- truth_nc_ratio
151
+
- truth_nc_ratio <br>
143
152
Proportion of NC.
144
-
- res_vc_ratio
145
-
Proportion of VC at the resolution of the blur_radius parameter.
146
-
- res_ic_ratio
147
-
Proportion of IC at the resolution of the blur_radius parameter.
148
-
- res_nc_ratio
149
-
Proportion of NC at the resolution of the blur_radius parameter.
150
-
- mae_min
153
+
- res_vc_ratio <br>
154
+
Proportion of VC at the resolution of the blur_radius parameter. The
155
+
streamline passes at a distance of at most [blur_darius] away from
156
+
the last segment of its fibertube.
157
+
- res_ic_ratio <br>
158
+
Proportion of IC at the resolution of the blur_radius parameter. The
159
+
streamline passes at a distance of at most [blur_darius] away from the
160
+
first or last segment of another fibertube.
161
+
- res_nc_ratio <br>
162
+
Proportion of NC at the resolution of the blur_radius parameter. The
163
+
streamline does not pass below [blur_radius] away from the first or
164
+
last segment of any fibertube.
165
+
- mae_min <br>
151
166
Minimum MAE for the tractogram.
152
-
- mae_max
167
+
- mae_max <br>
153
168
Maximum MAE for the tractogram.
154
-
- mae_mean
169
+
- mae_mean <br>
155
170
Average MAE for the tractogram.
156
-
- mae_med
171
+
- mae_med <br>
157
172
Median MAE for the tractogram.
158
173
159
174
Let's do:
@@ -177,6 +192,7 @@ giving us the following output in `reconstruction_metrics.txt`:
177
192
}
178
193
```
179
194
180
-
This data tells us that none of our streamline managed to stay within the fibertube in which it was seeded (`"truth_vc_ratio": 0.0`). However, 40% of streamlinea are at most one `blur_radius` away from the end of their respective fibertube (`"res_vc_ratio": 0.4`). Lastly, we notice that the streamline with the "worst" trajectory was on average 5.5um away from its fibertube (`"mae_max": 0.0055722481609273775`). We can suspect that it started very good early on, but eventually drifted further than 10um, rendering it a NC.
195
+
This data tells us that none of our streamline managed to stay within the fibertube in which it was seeded (`"truth_vc_ratio": 0.0`). However, 40% of streamlines are at most one `blur_radius` away from the end of their respective fibertube (`"res_vc_ratio": 0.4`). Lastly, we notice that the streamline with the "worst" trajectory was on average 5.5um away from its fibertube (`"mae_max": 0.0055722481609273775`). We can suspect that it started very good early on, but eventually drifted further than 10um, rendering it a NC.
0 commit comments