Skip to content

Commit 6f403c4

Browse files
authored
Merge pull request #676 from bnmajor/update-docs
DOCS: Add docs on the new CLI feature
2 parents c7a192b + cf903b3 commit 6f403c4

File tree

4 files changed

+73
-3
lines changed

4 files changed

+73
-3
lines changed

docs/deployments.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,51 @@ jupyter lab
6666

6767
If you'd rather interact with remotely hosted notebooks in JupyterLab you can
6868
also open them in Binder: [![Open in Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/InsightSoftwareConsortium/itkwidgets/main?labpath=examples%2F)
69+
70+
## Command Line (CLI)
71+
72+
To enable quick inspection of your 3D data in the browser or in your terminal you can install the command-line tool.
73+
74+
```bash
75+
pip install 'itkwidgets[cli]>=1.0a35'
76+
playwright install --with-deps chromium
77+
```
78+
Previewing data in the terminal requires support for the iterm2 inline image protocol. Examples of terminals with this support include [wezterm](https://wezfurlong.org/wezterm/), [VSCode's Terminal](https://code.visualstudio.com/updates/v1_80#_image-support) (with VSCode >= v1.80), and [iTerm2](https://iterm2.com/index.html).
79+
80+
**Note**: If you are using VSCode but are not seeing the images output in the terminal confirm that you are on version `1.80` or later. You may also need to make sure that `Integrated: Gpu Acceleration` is set to `on` rather than `auto`. Find this under `File > Preferences > Settings` and search for `Gpu Acceleration`.
81+
82+
For basic usage the following flags are most commonly used:
83+
84+
**Data Input**
85+
* `-i, --image`: The path to an image data file. This flag is optional and the image data can also be passed in as the first argument without a flag.
86+
* `-l, --label-image`: Path to a label image data file
87+
* `-p, --point-set`: Path to a point set data file
88+
* `--reader`: Backend to use to read the data file(s) (choices: "ngff_zarr", "zarr", "itk", "tifffile", "imageio")
89+
90+
**For use with browser output**
91+
* `-b, --browser`: Render to a browser tab instead of the terminal.
92+
* `--repl`: Start interactive REPL after launching viewer. This allows you to programmatically interact with and update the viewer.
93+
94+
**For use with terminal or browser output**
95+
* `--verbose`: Print all log messages to stdout. Defaults to supressing log messages.
96+
* `-r, --rotate`: Continuously rotate the camera around the scene in volume rendering mode.
97+
* `-m, --view-mode`: Only relevant for 3D scenes (choices: "x", "y", "z", "v")
98+
99+
### Examples
100+
101+
View the data in the terminal while rotating the camera:
102+
```bash
103+
itkwidgets path/to/data -r
104+
```
105+
![Image rotating in terminal](images/terminal_rotate.gif)
106+
107+
View the image data in the browser and then programatically set the label image:
108+
```bash
109+
itkwidgets -i path/to/data --reader itk --repl
110+
```
111+
112+
```python
113+
>>> import itk
114+
>>> label = itk.imread("path/to/label_image")
115+
>>> viewer.set_label_image(label)
116+
```

docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Setup your system for development:
77
```bash
88
git clone https://github.com/InsightSoftwareConsortium/itkwidgets.git
99
cd itkwidgets
10-
pip install -e ".[test,lab,notebook]"
10+
pip install -e ".[test,lab,notebook,cli]"
1111
pytest
1212
pytest --nbmake examples/*.ipynb
1313
```

docs/images/terminal_rotate.gif

2.71 MB
Loading

docs/quick_start_guide.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ For Google Colab run:
4444
pip install 'itkwidgets>=1.0a23'
4545
```
4646

47+
### Command Line (CLI)
48+
49+
```bash
50+
pip install 'itkwidgets[cli]>=1.0a35'
51+
playwright install --with-deps chromium
52+
```
53+
4754
## Example Notebooks
4855

4956
Example Notebooks can be accessed locally by cloning the repository:
@@ -60,6 +67,8 @@ cd itkwidgets/examples
6067

6168
## Usage
6269

70+
### Notebook
71+
6372
In Jupyter, import the view function:
6473

6574
```python
@@ -78,5 +87,18 @@ For information on additional options, see the view function docstring:
7887
view?
7988
```
8089

81-
See the [deployments](deployments.md) section for a more detailed overview of additional notebook
82-
options as well as other ways to run and interact with your notebooks.
90+
### CLI
91+
92+
```bash
93+
itkwidgets path/to/image -b # open viewer in browser -OR-
94+
95+
itkwidgets path/to/image # display preview in terminal
96+
```
97+
98+
For information on additional options, see the help:
99+
100+
```bash
101+
itkwidgets --help
102+
```
103+
104+
See the [deployments](deployments.md) section for a more detailed overview of additional options as well as other ways to run and interact with the itkwidgets.

0 commit comments

Comments
 (0)