You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
svZeroDVisualization is a web application designed for visualizing 0D simulation results and the 0D network. It allows users to interactively explore and analyze their simulation data through an intuitive interface.
436
+
This application is available in the `applications` folder.
437
+
438
+
439
+
### Architecture
440
+
svZeroDVisualization is built using a robust architecture that includes:
441
+
- Frontend: Utilizes HTML, CSS, Dash, and Plotly for creating a dynamic and interactive user interface. This setup allows for effective visualization and interaction with the 0D network and simulation results.
442
+
- Backend: Powered by a Flask application that handles the server-side logic. It leverages NetworkX for managing and visualizing the network graph and a Python code to determine network connections.
443
+
444
+
### Installing Dependencies
445
+
446
+
1. We recommend using a virtual environment to help manage project-specific
447
+
dependencies and avoid conflicts with other projects.
448
+
- Using venv:
449
+
```bash
450
+
python -m venv venv
451
+
source venv/bin/activate # On Windows use `venv\Scripts\activate`
452
+
```
453
+
- Using Conda:
454
+
```bash
455
+
conda create --name myenv python=3.12 # Replace with your desired Python version
456
+
conda activate myenv
457
+
```
458
+
459
+
2. Install the necessary packages:
460
+
```bash
461
+
pysvzerod
462
+
pandas
463
+
matplotlib
464
+
networkx
465
+
dash
466
+
plotly
467
+
numpy
468
+
argparse
469
+
```
470
+
471
+
### How to Use
472
+
Note: Files related to this application are in the `applications`folder, within the `dirgraph_visualization` subdirectory.
473
+
474
+
1. Command line execution: Pass the file path to your input JSON file and the output directory where you want the visualization to be saved as command line arguments.
475
+
- Pass a third argument `export_csv` optionally if you want to save svZeroDSolver raw output.
476
+
- The program will execute svZeroDSolver, generate a directed graph visualization of your network, parse simulation results, and display the results along with the corresponding nodes on a local Flask server.
2. Once the server is open, you can click on a node to inspect further.
482
+
- The data for that node will be displayed, including the simulation parameters input for that node, pressure/flow data, and any internal variables if present.
483
+
- Additional features include the ability to download figures and use the trace function
484
+
for more detailed inspection of network elements. The trace feature allows users to filter the
485
+
view by specific element types, such as isolating and examining only the blood vessels or
486
+
identifying the locations of the chambers within the network. This functionality enhances the
487
+
ability to focus on and analyze particular components of the network with precision.
488
+
489
+
## svZeroDGUI
490
+
491
+
### About
492
+
493
+
The svZeroDGUI application is designed to facilitate the creation of 0D model input files
494
+
through an intuitive graphical user interface. Located in the `applications` folder,
495
+
this tool allows users to generate input files for the svZeroDSolver by visually
496
+
drawing and configuring the network.
497
+
498
+
Unlike manual file creation, which can be
499
+
cumbersome and error-prone, svZeroDGUI provides an easy-to-use interface that
500
+
simplifies the process of defining network components such as vessels, junctions, and
501
+
boundary conditions. This application is especially valuable for users who lack access to
502
+
3D models or seek an efficient alternative to manual file generation, making the model creation
503
+
process both faster and more user-friendly.
504
+
505
+
### Architecture
506
+
507
+
svZeroDGUI is built using a robust architecture that includes:
508
+
* Frontend: The frontend is developed with HTML, CSS, and JavaScript to create a
509
+
responsive and user-friendly interface. It utilizes Cytoscape.js, a popular package for creating
510
+
interactive elements and graphical networks.
511
+
512
+
* Backend: Flask app, Node.js for server-side logic, and Cypress for testing.
513
+
This architecture supports an intuitive user experience for
514
+
generating and managing 0D input files through a graphical interface.
515
+
516
+
### How to Use
517
+
1. Create a virtual environment with the required `flask` dependency. If using `conda`, use the below commands:
518
+
```bash
519
+
conda create -n svZeroDGUI python=3.10 flask
520
+
conda activate svZeroDGUI
521
+
```
522
+
2. Navigate to the `applications` folder and then to the `create_0dmodel` subdirectory.
523
+
3. Launch the `app.py` file.
524
+
```bash
525
+
python applications/svZeroDGUI/app.py
526
+
```
527
+
4. Select a node type and name the node.
528
+
- For vessels, after drawing the node, click on it to open a form
529
+
where you can enter details such as vessel length, diameter, and more.
530
+
- For junctions, click the node to specify if it’s a Normal %Junction
531
+
or a Blood Vessel %Junction.
532
+
5. To draw edges between nodes, toggle the `Draw on` button on the right.
533
+
Once active, you can start connecting nodes by drawing edges between them.
534
+
6. When you wish to stop drawing edges and continue adding or moving nodes,
535
+
click the `Draw off` button.
536
+
7. Once you’ve completed the network, click `Export to JSON` on the right.
537
+
If there are any incorrect connections or patterns, an alert will prompt you
538
+
to make necessary changes so the network can be processed by svZeroDSolver.
539
+
8. Open the downloaded JSON file and add any additional information,
540
+
such as boundary condition data, before running it through svZeroDSolver.
431
541
432
542
## 0D Solver Theory
433
543
We highlight here the theory behind the 0D solver. For equations and implementation details, we refer to the [documentation](https://simvascular.github.io/svZeroDSolver/index.html) throught this guide.
0 commit comments