Skip to content

Commit cfbb776

Browse files
committed
update README
Signed-off-by: B Hashemian <[email protected]>
1 parent 702f8f5 commit cfbb776

File tree

3 files changed

+124
-113
lines changed

3 files changed

+124
-113
lines changed

applications/pipeline_visualization/README.md

Lines changed: 110 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,101 @@ The example consists of three main components:
1212
2. **NATS Server**: A message broker that handles real-time data streaming
1313
3. **Python Web Visualizers**: Dash-based web applications that subscribe to NATS streams and display live plots
1414

15+
## Quick Start
16+
17+
### Step 1: Start the NATS Server
18+
19+
In a terminal, start the NATS server using Docker:
20+
21+
```bash
22+
cd applications/pipeline_visualization
23+
./start_nats_server.sh
24+
```
25+
26+
This will start a NATS server listening on `0.0.0.0:4222`.
27+
28+
### Step 2: Build Visualizer Dependencies
29+
30+
```bash
31+
./holohub build pipeline_visualization
32+
```
33+
34+
### Step 3: Start the Visualizer
35+
36+
In a second terminal, start one of the Python visualizers:
37+
38+
```bash
39+
cd applications/pipeline_visualization/visualizer
40+
./start_visualizer.sh static # or 'dynamic'
41+
```
42+
43+
The web interface will be available at: **[http://localhost:8050](http://localhost:8050)**
44+
45+
### Step 4: Run the Holoscan Application
46+
47+
In a third terminal, run the C++ application:
48+
49+
```bash
50+
# Run the Python version (default when --language is not specified)
51+
./holohub run pipeline_visualization
52+
53+
# Or explicitly specify the language:
54+
./holohub run pipeline_visualization --language python
55+
./holohub run pipeline_visualization --language cpp
56+
```
57+
58+
**Command-line Options:**
59+
60+
```text
61+
Usage: ./pipeline_visualization [options]
62+
Options:
63+
-h, --help Display help information
64+
-d, --disable_logger Disable NATS logger
65+
-c, --config Config file path
66+
-u, --nats_url NATS URL (default: nats://0.0.0.0:4222)
67+
-p, --subject_prefix NATS subject prefix (default: nats_demo)
68+
-r, --publish_rate Publish rate in Hz (default: 2.0)
69+
```
70+
71+
**Example with custom settings:**
72+
73+
```bash
74+
./holohub run pipeline_visualization --nats_url nats://0.0.0.0:4222 --subject_prefix my_demo --publish_rate 5.0
75+
```
76+
77+
### Step 5: Visualize the Data
78+
79+
1. Open your web browser to [http://localhost:8050](http://localhost:8050)
80+
2. Enter the subject name (default: `nats_demo`)
81+
3. Click **Connect**
82+
4. Watch the real-time data plots update!
83+
84+
The visualizer will display:
85+
86+
- **source.out**: Original sine wave from the source operator
87+
- **modulate.in**: Input to the modulate operator (same as source.out)
88+
- **modulate.out**: Modulated signal with high-frequency component
89+
- **sink.in**: Final processed signal (same as modulate.out)
90+
91+
## Configuration
92+
93+
### NATS Logger Configuration (`pipeline_visualization.yaml`)
94+
95+
The NATS logger behavior can be configured via YAML:
96+
97+
```yaml
98+
nats_logger:
99+
# Filter which operators to log (regex patterns)
100+
allowlist_patterns:
101+
- "*"
102+
denylist_patterns:
103+
- "*"
104+
log_inputs: true # Log operator inputs
105+
log_outputs: true # Log operator outputs
106+
log_metadata: true # Include metadata in messages
107+
log_tensor_data_content: true # Include actual tensor data
108+
```
109+
15110
### Architecture
16111
17112
```mermaid
@@ -74,6 +169,7 @@ The static visualizer can be used when the output data and format of the Holosca
74169
There is a script `start_visualizer.sh` which sets the required Python path to the flatbuffers definitions and starts the visualizer. The script takes a parameter, `dynamic` starts the dynamic visualizer and `static` starts the static visualizer.
75170

76171
Both visualizers display:
172+
77173
- Real-time line plots of tensor data
78174
- Stream name (operator.port format)
79175
- IO type (Input/Output)
@@ -89,6 +185,8 @@ The data format is defined using FlatBuffers for efficient serialization:
89185

90186
## Prerequisites
91187

188+
All dependencies are installed automatically when using the `holohub run` command inside the Holohub container.
189+
92190
### Python Dependencies
93191

94192
Install the required Python packages:
@@ -98,98 +196,14 @@ pip install -r requirements.txt
98196
```
99197

100198
Required packages:
199+
101200
- `numpy>=1.24.0,<3.0` - Numerical computing
102201
- `dash>=3.0.0,<4.0` - Web application framework
103202
- `plotly>=6.0.0,<7.0` - Interactive plotting
104203
- `nats-py>=2.0.0,<3.0` - NATS messaging client
105204
- `flatbuffers>=25.9.23,<26.0.0` - FlatBuffers
106205
- `pandas>=2.3.3,<3.0` - Data manipulation
107206

108-
## Usage
109-
110-
### Step 1: Start the NATS Server
111-
112-
In a terminal, start the NATS server using Docker:
113-
114-
```bash
115-
cd applications/pipeline_visualization
116-
./start_nats_server.sh
117-
```
118-
119-
This will start a NATS server listening on `0.0.0.0:4222`.
120-
121-
### Step 2: Start the Visualizer
122-
123-
In a second terminal, start one of the Python visualizers:
124-
125-
```bash
126-
cd applications/pipeline_visualization/visualizer
127-
./start_visualizer.sh static # or 'dynamic'
128-
```
129-
130-
The web interface will be available at: **[http://localhost:8050](http://localhost:8050)**
131-
132-
### Step 3: Run the Holoscan Application
133-
134-
In a third terminal, run the C++ application:
135-
136-
```bash
137-
# Run the Python version (default when --language is not specified)
138-
./holohub run pipeline_visualization
139-
140-
# Or explicitly specify the language:
141-
./holohub run pipeline_visualization --language python
142-
./holohub run pipeline_visualization --language cpp
143-
```
144-
145-
**Command-line Options:**
146-
```text
147-
Usage: ./pipeline_visualization [options]
148-
Options:
149-
-h, --help Display help information
150-
-d, --disable_logger Disable NATS logger
151-
-c, --config Config file path
152-
-u, --nats_url NATS URL (default: nats://0.0.0.0:4222)
153-
-p, --subject_prefix NATS subject prefix (default: nats_demo)
154-
-r, --publish_rate Publish rate in Hz (default: 2.0)
155-
```
156-
157-
**Example with custom settings:**
158-
```bash
159-
./holohub run pipeline_visualization --nats_url nats://0.0.0.0:4222 --subject_prefix my_demo --publish_rate 5.0
160-
```
161-
162-
### Step 4: Visualize the Data
163-
164-
1. Open your web browser to [http://localhost:8050](http://localhost:8050)
165-
2. Enter the subject name (default: `nats_demo`)
166-
3. Click **Connect**
167-
4. Watch the real-time data plots update!
168-
169-
The visualizer will display:
170-
- **source.out**: Original sine wave from the source operator
171-
- **modulate.in**: Input to the modulate operator (same as source.out)
172-
- **modulate.out**: Modulated signal with high-frequency component
173-
- **sink.in**: Final processed signal (same as modulate.out)
174-
175-
## Configuration
176-
177-
### NATS Logger Configuration (`pipeline_visualization.yaml`)
178-
179-
The NATS logger behavior can be configured via YAML:
180-
181-
```yaml
182-
nats_logger:
183-
# Filter which operators to log (regex patterns)
184-
allowlist_patterns:
185-
- "*"
186-
denylist_patterns:
187-
- "*"
188-
log_inputs: true # Log operator inputs
189-
log_outputs: true # Log operator outputs
190-
log_metadata: true # Include metadata in messages
191-
log_tensor_data_content: true # Include actual tensor data
192-
```
193207
## Data Format
194208

195209
### NATS Message Structure
@@ -213,6 +227,7 @@ Message {
213227
The `unique_id` field follows the format: `<operator_name>.<port_name>`
214228

215229
Examples:
230+
216231
- `source.out` - Output port of the source operator
217232
- `modulate.in` - Input port of the modulate operator
218233
- `modulate.out` - Output port of the modulate operator
@@ -225,6 +240,7 @@ Examples:
225240
**Problem**: `Cannot connect to NATS` error
226241

227242
**Solution**:
243+
228244
- Ensure the NATS server is running: `docker ps | grep nats`
229245
- Check if port 4222 is available: `netstat -an | grep 4222`
230246
- Verify the NATS URL matches in both the C++ app and visualizer
@@ -234,6 +250,7 @@ Examples:
234250
**Problem**: Web page loads but graphs don't update
235251

236252
**Solution**:
253+
237254
1. Check that the C++ application is running
238255
2. Verify the subject name matches (default: `nats_demo`)
239256
3. Click the "Connect" button in the web interface
@@ -244,18 +261,22 @@ Examples:
244261
**Problem**: `ModuleNotFoundError: No module named 'pipeline_visualization.flatbuffers'`
245262

246263
**Solution**:
264+
247265
- Ensure the FlatBuffers files were generated during build
248266
- Set PYTHONPATH correctly:
267+
249268
```bash
250269
export PYTHONPATH=$PYTHONPATH:/path/to/build/applications/pipeline_visualization/flatbuffers/
251270
```
271+
252272
- Verify the files exist in the build directory
253273

254274
### No Data Displayed
255275

256276
**Problem**: Graphs are empty or show no data
257277

258278
**Solution**:
279+
259280
- Check that `log_tensor_data_content: true` in the YAML config
260281
- Verify the operator names match between the app and visualizer
261282
- For static visualizer, ensure the unique IDs in the code match your operators
@@ -268,6 +289,7 @@ Examples:
268289
To visualize data from your own Holoscan operators:
269290

270291
1. Add the NATS logger to your application:
292+
271293
```cpp
272294
auto nats_logger = make_resource<NatsLogger>(
273295
"nats_logger",
@@ -277,6 +299,7 @@ To visualize data from your own Holoscan operators:
277299
```
278300
279301
2. For static visualizer, update the `_unique_ids` list:
302+
280303
```python
281304
self._unique_ids = ["my_op.out", "my_other_op.in"]
282305
```
@@ -303,6 +326,7 @@ dcc.Graph(
303326

304327
- **C++ side**: Use `--publish_rate` flag (default: 2 Hz)
305328
- **Visualizer side**: Modify the `interval` parameter in milliseconds:
329+
306330
```python
307331
dcc.Interval(
308332
id="interval-component",
@@ -333,6 +357,7 @@ To run multiple Holoscan apps simultaneously:
333357

334358
1. Use different subject prefixes for each app
335359
2. Start multiple visualizer instances on different ports:
360+
336361
```python
337362
self._app.run(debug=True, host="0.0.0.0", port=8051)
338363
```

applications/pipeline_visualization/cpp/metadata.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@
2828
"NATS",
2929
"Remote"
3030
],
31-
"ranking": 1,
31+
"ranking": 2,
3232
"requirements": {},
33-
"run": {
34-
"command": "<holohub_app_bin>/pipeline_visualization",
35-
"workdir": "holohub_app_bin"
33+
"default_mode": "app",
34+
"modes": {
35+
"app": {
36+
"description": "Run mode for pipeline visualization application",
37+
"run": {
38+
"command": "<holohub_app_bin>/pipeline_visualization",
39+
"workdir": "holohub_app_bin"
40+
}
41+
}
3642
}
3743
}
3844
}

applications/pipeline_visualization/python/metadata.json

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,12 @@
2828
"NATS",
2929
"Remote"
3030
],
31-
"ranking": 1,
31+
"ranking": 2,
3232
"requirements": {},
33-
"default_mode": "standard",
33+
"default_mode": "app",
3434
"modes": {
35-
"static_web": {
36-
"description": "Static visualization of pipeline data",
37-
"run": {
38-
"command": "python3 <holohub_app_source>/../visualizer/visualizer_static.py",
39-
"workdir": "holohub_bin"
40-
},
41-
"env": {
42-
"PYTHONPATH": "<holohub_app_bin>/../flatbuffers:<PYTHONPATH>"
43-
}
44-
},
45-
"dynamic_web": {
46-
"description": "Dynamic visualization of pipeline data",
47-
"run": {
48-
"command": "python3 <holohub_app_source>/../visualizer/visualizer_dynamic.py",
49-
"workdir": "holohub_bin"
50-
},
51-
"env": {
52-
"PYTHONPATH": "<holohub_app_bin>/../flatbuffers:<PYTHONPATH>"
53-
}
54-
},
55-
"standard": {
56-
"description": "Standard mode for pipeline visualization",
35+
"app": {
36+
"description": "Run mode for pipeline visualization application",
5737
"run": {
5838
"command": "python3 <holohub_app_source>/pipeline_visualization.py",
5939
"workdir": "holohub_bin"

0 commit comments

Comments
 (0)