Newer
Older
# Command line interface
The library also includes a command line interface for easy access to some functionalities, and the convenience of using qim3d directly from your terminal.
This offers quick interactions, making it ideal for tasks that require efficiency or when certain functionalities need to run on a server.
!!! Example
```bash
qim3d gui --data-explorer
```

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## Graphical User Interfaces
### `qim3d gui`
!!! quote "Reference"
The GUIs available in `qim3d` are built using Gradio:
<https://github.com/gradio-app/gradio>
```bibtex
@article{abid2019gradio,
title = {Gradio: Hassle-Free Sharing and Testing of ML Models in the Wild},
author = {Abid, Abubakar and Abdalla, Ali and Abid, Ali and Khan, Dawood and Alfozan, Abdulrahman and Zou, James},
journal = {arXiv preprint arXiv:1906.02569},
year = {2019},
}
```
| Arguments | Description |
| --------- | ----------- |
| `--data-explorer` | Starts the Data Explorer |
| `--iso3d` | Starts the 3D Isosurfaces visualization |
| `--local-thickness` | Starts the Local thickness tool |
| `--host` | Desired host for the server. By default runs on `0.0.0.0` |
| `--platform` | Uses the Qim platform API for a unique path and port depending on the username |
!!! Example
Here's an example of how to open the [Data Explorer](gui.md#data_explorer)
```
qim3d gui --data-explorer
```
``` title="Output"
Running on local URL: http://127.0.0.1:7860
```
In this case, the GUI will be available at `http://127.0.0.1:7860`

!!! Example
Or for the local thickness GUI:
```
qim3d gui --local-thickness --host 127.0.0.1 --platform
```
``` title="Output"
{'username': 'fima', 'jupyter_port': '57326', 'gradio_port': '47326'}
╭────────────────────────╮
│ Starting gradio server │
├────────────────────────╯
├ Gradio
├ Using port 47326
╰ Running at 10.52.0.158
http://127.0.0.1:47326/gui/fima/47326/
INFO: Started server process [1534019]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:47326 (Press CTRL+C to quit)
```
In this case, the GUI will be available at `http://127.0.0.1:47326/gui/fima/47326/`

## Data visualization
The command line interface also allows you to easily visualize data.
### `qim3d viz`
!!! quote "Reference"
Volumetric visualization uses K3D:
[Github page](https://github.com/K3D-tools/K3D-jupyter)
It is possible to launch the k3d visualization directly from the command line.
| Arguments | Description |
| --------- | ----------- |
| `--source` | Path to the volume file (Any image format supported by `qim3d.io.load()`) |
| `--destination` | Path to the `html` file to be saved. By default, `k3d.html` is saved where the command is run. |
| `--no-browser` | Do not open the file when finished. |
!!! Example
```
qim3d viz --source blobs_256x256x256.tif
```
``` title="Output"
Loading data from blobs_256x256x256.tif
Done, volume shape: (256, 256, 256)
Generating k3d plot...
Done, plot available at <k3d.html>
Opening in default browser...
```
And a new tab will be opened in the default browser with the interactive k3d plot:
{ width="512" }
Or an specific path for destination can be used. We can also choose to not open the browser:
!!! Example
```
qim3d viz --source blobs_256x256x256.tif --destination my_plot.html --no-browser
```
``` title="Output"
Loading data from blobs_256x256x256.tif
Done, volume shape: (256, 256, 256)
Generating k3d plot...
Done, plot available at <my_plot.html>
```
This writes to disk the `my_plot.html` file.
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
## File preview
Command line interface, which allows users to preview 3D structers or 2D images directly in command line.
### `qim3d preview <filename>`
| Arguments | Description |
| --------- | ----------- |
| `--axis` | Specifies from which axis the slice will be taken. If the object is 2D image, then this is ignored. Defaults to 0.|
| `--slice` | Specifies which slice will be displayed. If the number exceeds number of slices, the last one is taken. Defaults to the middle slice.|
| `--resolution` | How many characters will be used to display the image in command line. Defaults to 80.|
| `--absolute_values` |If values are low the image might be just black square. By default maximum value is set to 255. This flag turns this behaviour off.|
!!! Example
```
qim3d preview blobs_256x256x256.tif
```
{ width="512" }
!!! Example
```
qim3d preview blobs_256x256x256.tif --resolution 30
```
{ width="512" }
!!! Example
```
qim3d preview blobs_256x256x256.tif --resolution 50 --axis 1
```
{ width="512" }
!!! Example
```
qim3d preview blobs_256x256x256.tif --resolution 50 --axis 2 --slice 0
```
{ width="512" }
!!! Example
```
qim3d preview qim_logo.png --resolution 40
```
{ width="512" }