refast_vtk_js 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- refast_vtk_js/__init__.py +141 -0
- refast_vtk_js/components.py +1572 -0
- refast_vtk_js/static/refast_vtk_js.js +3424 -0
- refast_vtk_js-0.1.0.dist-info/METADATA +309 -0
- refast_vtk_js-0.1.0.dist-info/RECORD +8 -0
- refast_vtk_js-0.1.0.dist-info/WHEEL +4 -0
- refast_vtk_js-0.1.0.dist-info/entry_points.txt +2 -0
- refast_vtk_js-0.1.0.dist-info/licenses/LICENSE +22 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"""Refast extension for VTK.js
|
|
2
|
+
|
|
3
|
+
Provides React-VTK.js components for 3D visualization in Refast applications.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from refast.extensions import Extension
|
|
9
|
+
|
|
10
|
+
from .components import (
|
|
11
|
+
Algorithm,
|
|
12
|
+
AxesActor,
|
|
13
|
+
CellData,
|
|
14
|
+
DataArray,
|
|
15
|
+
Dataset,
|
|
16
|
+
FieldData,
|
|
17
|
+
Geometry2DRepresentation,
|
|
18
|
+
GeometryRepresentation,
|
|
19
|
+
ImageData,
|
|
20
|
+
MultiViewRoot,
|
|
21
|
+
Picking,
|
|
22
|
+
PointData,
|
|
23
|
+
PolyData,
|
|
24
|
+
Reader,
|
|
25
|
+
RegisterDataSet,
|
|
26
|
+
ShareDataSetRoot,
|
|
27
|
+
SliceRepresentation,
|
|
28
|
+
UseDataSet,
|
|
29
|
+
View,
|
|
30
|
+
VolumeController,
|
|
31
|
+
VolumeRepresentation,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class VtkExtension(Extension):
|
|
36
|
+
"""
|
|
37
|
+
VTK.js extension for Refast.
|
|
38
|
+
|
|
39
|
+
Provides 3D visualization components powered by react-vtk-js.
|
|
40
|
+
|
|
41
|
+
Example:
|
|
42
|
+
```python
|
|
43
|
+
from refast import RefastApp
|
|
44
|
+
from refast_vtk_js import View, GeometryRepresentation, PolyData, VtkExtension
|
|
45
|
+
|
|
46
|
+
ui = RefastApp(extensions=[VtkExtension()])
|
|
47
|
+
|
|
48
|
+
@ui.page("/")
|
|
49
|
+
def home(ctx):
|
|
50
|
+
return View(
|
|
51
|
+
background=[0.2, 0.3, 0.4],
|
|
52
|
+
style={"width": "100%", "height": "400px"},
|
|
53
|
+
children=[
|
|
54
|
+
GeometryRepresentation(
|
|
55
|
+
children=[
|
|
56
|
+
PolyData(
|
|
57
|
+
points=[0, 0, 0, 1, 0, 0, 0.5, 1, 0],
|
|
58
|
+
connectivity="triangles"
|
|
59
|
+
)
|
|
60
|
+
]
|
|
61
|
+
)
|
|
62
|
+
]
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For auto-discovery, install the package and it will be automatically loaded.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
name = "refast_vtk_js"
|
|
70
|
+
version = "0.1.0"
|
|
71
|
+
description = "VTK.js 3D visualization components for Refast"
|
|
72
|
+
|
|
73
|
+
# Static assets to load (relative to static_path)
|
|
74
|
+
scripts = ["refast_vtk_js.js"]
|
|
75
|
+
styles = [] # Add CSS files here if needed: ["refast_vtk_js.css"]
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def static_path(self) -> Path:
|
|
79
|
+
"""Path to the static assets directory."""
|
|
80
|
+
return Path(__file__).parent / "static"
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def components(self) -> list:
|
|
84
|
+
"""List of Python component classes provided by this extension."""
|
|
85
|
+
return [
|
|
86
|
+
View,
|
|
87
|
+
AxesActor,
|
|
88
|
+
MultiViewRoot,
|
|
89
|
+
GeometryRepresentation,
|
|
90
|
+
Geometry2DRepresentation,
|
|
91
|
+
VolumeRepresentation,
|
|
92
|
+
SliceRepresentation,
|
|
93
|
+
PolyData,
|
|
94
|
+
ImageData,
|
|
95
|
+
Dataset,
|
|
96
|
+
DataArray,
|
|
97
|
+
PointData,
|
|
98
|
+
CellData,
|
|
99
|
+
FieldData,
|
|
100
|
+
Algorithm,
|
|
101
|
+
Reader,
|
|
102
|
+
Picking,
|
|
103
|
+
VolumeController,
|
|
104
|
+
ShareDataSetRoot,
|
|
105
|
+
RegisterDataSet,
|
|
106
|
+
UseDataSet,
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
__all__ = [
|
|
111
|
+
# Extension
|
|
112
|
+
"VtkExtension",
|
|
113
|
+
# View components
|
|
114
|
+
"View",
|
|
115
|
+
"AxesActor",
|
|
116
|
+
"MultiViewRoot",
|
|
117
|
+
# Representation components
|
|
118
|
+
"GeometryRepresentation",
|
|
119
|
+
"Geometry2DRepresentation",
|
|
120
|
+
"VolumeRepresentation",
|
|
121
|
+
"SliceRepresentation",
|
|
122
|
+
# Dataset components
|
|
123
|
+
"PolyData",
|
|
124
|
+
"ImageData",
|
|
125
|
+
"Dataset",
|
|
126
|
+
# Data array components
|
|
127
|
+
"DataArray",
|
|
128
|
+
"PointData",
|
|
129
|
+
"CellData",
|
|
130
|
+
"FieldData",
|
|
131
|
+
# Algorithm & Reader
|
|
132
|
+
"Algorithm",
|
|
133
|
+
"Reader",
|
|
134
|
+
# Interaction
|
|
135
|
+
"Picking",
|
|
136
|
+
"VolumeController",
|
|
137
|
+
# Data sharing
|
|
138
|
+
"ShareDataSetRoot",
|
|
139
|
+
"RegisterDataSet",
|
|
140
|
+
"UseDataSet",
|
|
141
|
+
]
|