Skip to content

Commit

Permalink
Update docs with new separator
Browse files Browse the repository at this point in the history
  • Loading branch information
jni committed Nov 18, 2023
1 parent b981290 commit 6ef8a0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions doc/examples/visualizing_3d_skeletons.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ all_paths = [
```

```{code-cell} ipython3
paths_table = skan.summarize(skeleton)
paths_table = skan.summarize(skeleton, separator='_')
```

```{code-cell} ipython3
paths_table['path-id'] = np.arange(skeleton.n_paths)
paths_table['path_id'] = np.arange(skeleton.n_paths)
```

First, we color by random path ID, showing each path in a distinct color using the matplotlib "tab10" qualitative palette. (Coloring by path ID directly results in "bands" of nearby paths receiving the same color.)

```{code-cell} ipython3
paths_table['random-path-id'] = np.random.default_rng().permutation(skeleton.n_paths)
paths_table['random_path_id'] = np.random.default_rng().permutation(skeleton.n_paths)
```

```{code-cell} ipython3
Expand All @@ -70,7 +70,7 @@ skeleton_layer = viewer.add_shapes(
shape_type='path',
properties=paths_table,
edge_width=0.5,
edge_color='random-path-id',
edge_color='random_path_id',
edge_colormap='tab10',
)
```
Expand All @@ -85,9 +85,9 @@ napari.utils.nbscreenshot(viewer)
We can also demonstrate that most of these branches are in one skeleton, with a few stragglers around the edges, by coloring by skeleton ID:

```{code-cell} ipython3
skeleton_layer.edge_color = 'skeleton-id'
skeleton_layer.edge_color = 'skeleton_id'
# for now, we need to set the face color as well
skeleton_layer.face_color = 'skeleton-id'
skeleton_layer.face_color = 'skeleton_id'
```

```{code-cell} ipython3
Expand All @@ -99,10 +99,10 @@ napari.utils.nbscreenshot(viewer)
Finally, we can color the paths by a numerical property, such as their length.

```{code-cell} ipython3
skeleton_layer.edge_color = 'branch-distance'
skeleton_layer.edge_color = 'branch_distance'
skeleton_layer.edge_colormap = 'viridis'
# for now, we need to set the face color as well
skeleton_layer.face_color = 'branch-distance'
skeleton_layer.face_color = 'branch_distance'
skeleton_layer.face_colormap = 'viridis'
```

Expand Down
12 changes: 6 additions & 6 deletions doc/getting_started/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Let's go back to the red blood cell image to illustrate this graph.

```{code-cell} ipython3
from skan import Skeleton, summarize
branch_data = summarize(Skeleton(skeleton0, spacing=spacing_nm))
branch_data = summarize(Skeleton(skeleton0, spacing=spacing_nm), separator='_')
branch_data.head()
```

Expand All @@ -156,7 +156,7 @@ Next come the coordinates in natural space, the Euclidean distance between the p
This data table follows the "tidy data" paradigm, with one row per branch, which allows fast exploration of branch statistics. Here, for example, we plot the distribution of branch lengths according to branch type:

```{code-cell} ipython3
branch_data.hist(column='branch-distance', by='branch-type', bins=100);
branch_data.hist(column='branch_distance', by='branch_type', bins=100);
```

We can see that junction-to-junction branches tend to be longer than junction-to-endpoint and junction isolated branches, and that there are no cycles in our dataset.
Expand All @@ -165,7 +165,7 @@ We can also represent this visually with the `overlay_euclidean_skeleton`, which

```{code-cell} ipython3
draw.overlay_euclidean_skeleton_2d(image0, branch_data,
skeleton_color_source='branch-type');
skeleton_color_source='branch_type');
```

## 2. Comparing different skeletons
Expand Down Expand Up @@ -194,7 +194,7 @@ def skeletonize(images, spacings_nm):
skeletons = skeletonize(images, spacings_nm)
tables = [summarize(Skeleton(skeleton, spacing=spacing))
tables = [summarize(Skeleton(skeleton, spacing=spacing), separator='_')
for skeleton, spacing in zip(skeletons, spacings_nm)]
for filename, dataframe in zip(files, tables):
Expand All @@ -210,8 +210,8 @@ Now, however, we have a tidy data table with information about the sample origin
```{code-cell} ipython3
import seaborn as sns
j2j = (table[table['branch-type'] == 2].
rename(columns={'branch-distance':
j2j = (table[table['branch_type'] == 2].
rename(columns={'branch_distance':
'branch distance (nm)'}))
per_image = j2j.groupby('filename').median()
per_image['infected'] = ['infected' if 'inf' in fn else 'normal'
Expand Down

0 comments on commit 6ef8a0d

Please sign in to comment.