Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
melissawm committed Dec 27, 2023
1 parent d76fb5c commit d67d9fe
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 81 deletions.
4 changes: 2 additions & 2 deletions docs/howtos/layers/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ common editing tasks on connected components (keep the `contiguous` box checked)

* Deleting a connected component
![Deleting selected labels](../../images/delete_label.webm)
Select the background label with the `color picker`, then use the
Select the background label with the `color picker` or press `x`, then use the
`fill bucket` to set all pixels of the
connected component to background.

Expand All @@ -321,7 +321,7 @@ common editing tasks on connected components (keep the `contiguous` box checked)
* Splitting a connected component
![Using the paintbrush tool to split a label into two](../../images/split_label.webm)
Splitting a connected component will introduce an additional object.
* Press `m` to select a label not already in use.
* Select the background label with the `color picker` or press `x`.
* Use the `paintbrush` tool to draw a dividing line where you want to split
the component.
* Assign the new label to one of the parts with the `fill bucket`.
Expand Down
5 changes: 4 additions & 1 deletion docs/howtos/layers/surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ For more information about layers, refer to [Layers at a glance](../../guides/la

```{note}
Surface layers can be created only programmatically, i.e. in the console, or
using a script, not from the GUI.
using a script, not from the GUI. Please refer to
[A simple example](#a-simple-example) and use the code there to add a surface
layer first, then explore the GUI controls.
```
```
## When to use the surface layer
Expand Down
62 changes: 31 additions & 31 deletions docs/howtos/layers/tracks.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,6 @@ For example, when displaying tracks of different classes/types, one could
automatically set the color of the individual tracks by their respective
class/type.

## GUI controls for the `tracks` layer

* Color by - there is a dropdown for this but at present the only choice is
`track_id`.
* Colormap - choose a colormap from the dropdown. These are explained in
[the colormaps section](./surface.md#working-with-colormaps) of
_Using the surface layer_.
* Blending - choose `opaque`, `translucent`, `translucent no depth`, `minimum`
or `additive` from the dropdown. Refer to the
[Blending layers](blending-layers) section of _Layers at a glance_ for an
explanation of each type of blending.
* Opacity - click and hold the circle on the opacity slider bar and adjust it to
any value between 0.00 (clear) and 1.00 (completely opaque).
* Tail width - adjusting the tail width gives the track the appearance of being
narrower or wider. At the minimum value, the track looks like a one-pixel
line.
* Tail length - adjusting the tail length gives the track the appearance of
being shorter or longer. At the minimum value, it looks something like a
dotted line, at the maximum value it almost looks like an unbroken line.
* Head length - Adjusting the head length gives the track the appearance of
being longer. If it is adjusted to the maximum value, the tracks look like
stripes. At the minimum value, the tracks flash across the canvas and
disappear before starting again.
* Tail - check this box to see the tracks. If it is not checked, you will not be
able to see the tracks at all.
* Show ID - check this box to display a previously assigned `track_id` label for
each track. Assigning values to `track_id` is explained in
[Tracks data](#tracks-data) below.
* Graph - check this box to display a previously created graph as explained in
[](#arguments-of-view_tracks-and-add_tracks).

## A simple example

You can create a new viewer and add a set of tracks in one go using the
Expand Down Expand Up @@ -108,6 +77,37 @@ napari.run()

![image: tracks simple demo](../../images/tracks_simple_demo.webm)

## GUI controls for the `tracks` layer

* Color by - there is a dropdown for this but at present the only choice is
`track_id`.
* Colormap - choose a colormap from the dropdown. These are explained in
[the colormaps section](./surface.md#working-with-colormaps) of
_Using the surface layer_.
* Blending - choose `opaque`, `translucent`, `translucent no depth`, `minimum`
or `additive` from the dropdown. Refer to the
[Blending layers](blending-layers) section of _Layers at a glance_ for an
explanation of each type of blending.
* Opacity - click and hold the circle on the opacity slider bar and adjust it to
any value between 0.00 (clear) and 1.00 (completely opaque).
* Tail width - adjusting the tail width gives the track the appearance of being
narrower or wider. At the minimum value, the track looks like a one-pixel
line.
* Tail length - adjusting the tail length gives the track the appearance of
being shorter or longer. At the minimum value, it looks something like a
dotted line, at the maximum value it almost looks like an unbroken line.
* Head length - Adjusting the head length gives the track the appearance of
being longer. If it is adjusted to the maximum value, the tracks look like
stripes. At the minimum value, the tracks flash across the canvas and
disappear before starting again.
* Tail - check this box to see the tracks. If it is not checked, you will not be
able to see the tracks at all.
* Show ID - check this box to display a previously assigned `track_id` label for
each track. Assigning values to `track_id` is explained in
[Tracks data](#tracks-data) below.
* Graph - check this box to display a previously created graph as explained in
[](#arguments-of-view_tracks-and-add_tracks).

## Arguments of `view_tracks` and `add_tracks`

Both `view_tracks` and `add_tracks` have the following docstrings:
Expand Down
96 changes: 49 additions & 47 deletions docs/howtos/layers/vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ For more information about layers, refer to [Layers at a glance](../../guides/la

```{note}
Vector layers can be added only programmatically, i.e., in the console, or using
a script, not from the GUI.
a script, not from the GUI. Please refer to
[A simple example](#a-simple-example) and use the code there to add a vectors
layer first, then explore the GUI controls.
```

## When to use the `vectors` layer
Expand All @@ -31,6 +33,52 @@ visualize large vector fields, for example if you are doing polarization
microscopy. You can adjust the color, width, and length of all the vectors from
the console or from the GUI.

## A simple example

You can create a new viewer and add vectors in one go using the
{meth}`napari.view_vectors` method, or if you already have an existing viewer,
you can add vectors to it using `viewer.add_vectors`. The API of both methods is
the same. In these examples we'll mainly use `add_vectors` to overlay vectors
onto an existing image.

In this example, we will overlay vectors on the image of a photographer:

```{code-cell} python
import napari
import numpy as np
from skimage import data
# create vector data
n = 250
vectors = np.zeros((n, 2, 2), dtype=np.float32)
phi_space = np.linspace(0, 4 * np.pi, n)
radius_space = np.linspace(0, 100, n)
# assign x-y projection
vectors[:, 1, 0] = radius_space * np.cos(phi_space)
vectors[:, 1, 1] = radius_space * np.sin(phi_space)
# assign x-y position
vectors[:, 0] = vectors[:, 1] + 256
# add the image
viewer = napari.view_image(data.camera(), name='photographer')
# add the vectors
vectors_layer = viewer.add_vectors(vectors, edge_width=3)
```

```{code-cell} python
:tags: [hide-input]
from napari.utils import nbscreenshot
nbscreenshot(viewer, alt_text="Vectors overlaid on an image")
```

```{code-cell} python
:tags: [remove-cell]
viewer.close()
```

## Using the GUI to manipulate vectors

Before you can use the GUI to manipulate vectors, you must load a vector layer.
Expand Down Expand Up @@ -81,52 +129,6 @@ both 2D and 3D:

![image: nD vectors](../../images/nD_vectors.webm)

## A simple example

You can create a new viewer and add vectors in one go using the
{meth}`napari.view_vectors` method, or if you already have an existing viewer,
you can add vectors to it using `viewer.add_vectors`. The API of both methods is
the same. In these examples we'll mainly use `add_vectors` to overlay vectors
onto an existing image.

In this example, we will overlay vectors on the image of a photographer:

```{code-cell} python
import napari
import numpy as np
from skimage import data
# create vector data
n = 250
vectors = np.zeros((n, 2, 2), dtype=np.float32)
phi_space = np.linspace(0, 4 * np.pi, n)
radius_space = np.linspace(0, 100, n)
# assign x-y projection
vectors[:, 1, 0] = radius_space * np.cos(phi_space)
vectors[:, 1, 1] = radius_space * np.sin(phi_space)
# assign x-y position
vectors[:, 0] = vectors[:, 1] + 256
# add the image
viewer = napari.view_image(data.camera(), name='photographer')
# add the vectors
vectors_layer = viewer.add_vectors(vectors, edge_width=3)
```

```{code-cell} python
:tags: [hide-input]
from napari.utils import nbscreenshot
nbscreenshot(viewer, alt_text="Vectors overlaid on an image")
```

```{code-cell} python
:tags: [remove-cell]
viewer.close()
```

## Arguments of `view_vectors` and `add_vectors`

{meth}`~napari.view_layers.view_vectors` and {meth}`~napari.Viewer.add_vectors`
Expand Down

0 comments on commit d67d9fe

Please sign in to comment.