diff --git a/demos/pyvista-point-cloud/Procfile b/demos/pyvista-point-cloud/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/pyvista-point-cloud/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/pyvista-point-cloud/app.py b/demos/pyvista-point-cloud/app.py index 0d9c8db..efc0df2 100644 --- a/demos/pyvista-point-cloud/app.py +++ b/demos/pyvista-point-cloud/app.py @@ -1,6 +1,5 @@ import dash import dash_vtk -import dash_bootstrap_components as dbc import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output, State @@ -11,7 +10,7 @@ # Get point cloud data from PyVista dataset = examples.download_lidar() -subset = 0.5 +subset = 0.2 selection = np.random.randint( low=0, high=dataset.n_points - 1, size=int(dataset.n_points * subset) ) @@ -24,7 +23,7 @@ print(f"Elevation range: [{min_elevation}, {max_elevation}]") # Setup VTK rendering of PointCloud -app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) +app = dash.Dash(__name__) server = app.server vtk_view = dash_vtk.View( @@ -38,25 +37,9 @@ ] ) -app.layout = dbc.Container( - fluid=True, - children=[ - html.H1("Demo of dash_vtk.PointCloudRepresentation"), - html.Hr(), - dbc.Row( - [ - dbc.Col( - width=12, - children=[ - html.Div( - vtk_view, - style={"height": "calc(80vh - 20px)", "width": "100%"}, - ) - ], - ), - ] - ), - ], +app.layout = html.Div( + style={"height": "calc(100vh - 16px)"}, + children=[html.Div(vtk_view, style={"height": "100%", "width": "100%"})], ) if __name__ == "__main__": diff --git a/demos/pyvista-point-cloud/requirements.txt b/demos/pyvista-point-cloud/requirements.txt index 3ac27e0..a88a332 100644 --- a/demos/pyvista-point-cloud/requirements.txt +++ b/demos/pyvista-point-cloud/requirements.txt @@ -1,5 +1,4 @@ # If you skipped `pip install -e ../../`, the package below will be retrieved from pypi: dash-vtk -dash-bootstrap-components pyvista numpy diff --git a/demos/pyvista-point-cloud/runtime.txt b/demos/pyvista-point-cloud/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/pyvista-point-cloud/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/demos/pyvista-terrain-following-mesh/Procfile b/demos/pyvista-terrain-following-mesh/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/pyvista-terrain-following-mesh/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/pyvista-terrain-following-mesh/app.py b/demos/pyvista-terrain-following-mesh/app.py index f55e804..b6dc359 100644 --- a/demos/pyvista-terrain-following-mesh/app.py +++ b/demos/pyvista-terrain-following-mesh/app.py @@ -75,48 +75,33 @@ def updateWarp(factor=1): app.layout = dbc.Container( fluid=True, + style={"height": "100vh"}, children=[ dbc.Row( [ - dbc.Col(width=6, children=[html.H1("Terrain deformation"),]), dbc.Col( - width=3, - children=[ - dcc.Slider( - id="scale-factor", - min=0.1, - max=5, - step=0.1, - value=1, - marks={0.1: "0.1", 5: "5"}, - ), - ], + children=dcc.Slider( + id="scale-factor", + min=0.1, + max=5, + step=0.1, + value=1, + marks={0.1: "0.1", 5: "5"}, + ) ), dbc.Col( - width=3, - children=[ - dcc.Dropdown( - id="dropdown-preset", - options=list(map(toDropOption, presets)), - value="erdc_rainbow_bright", - ), - ], + children=dcc.Dropdown( + id="dropdown-preset", + options=list(map(toDropOption, presets)), + value="erdc_rainbow_bright", + ), ), - ] + ], + style={"height": "12%", "align-items": "center"}, ), - html.Hr(), - dbc.Row( - [ - dbc.Col( - width=12, - children=[ - html.Div( - vtk_view, - style={"height": "calc(80vh - 20px)", "width": "100%"}, - ) - ], - ), - ] + html.Div( + html.Div(vtk_view, style={"height": "100%", "width": "100%"}), + style={"height": "88%"}, ), ], ) diff --git a/demos/pyvista-terrain-following-mesh/requirements.txt b/demos/pyvista-terrain-following-mesh/requirements.txt index 3ac27e0..b3a3722 100644 --- a/demos/pyvista-terrain-following-mesh/requirements.txt +++ b/demos/pyvista-terrain-following-mesh/requirements.txt @@ -3,3 +3,4 @@ dash-vtk dash-bootstrap-components pyvista numpy +vtk \ No newline at end of file diff --git a/demos/pyvista-terrain-following-mesh/runtime.txt b/demos/pyvista-terrain-following-mesh/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/pyvista-terrain-following-mesh/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/demos/requirements.txt b/demos/requirements.txt new file mode 100644 index 0000000..d9537cc --- /dev/null +++ b/demos/requirements.txt @@ -0,0 +1,8 @@ +-r ./usage-algorithm/requirements.txt +-r ./pyvista-terrain-following-mesh/requirements.txt +-r ./slice-rendering/requirements.txt +-r ./pyvista-point-cloud/requirements.txt +-r ./volume-rendering/requirements.txt +-r ./usage-vtk-cfd/requirements.txt +-r ./usage-algorithm/requirements.txt +-r ./synthetic-volume-rendering/requirements.txt \ No newline at end of file diff --git a/demos/slice-rendering/Procfile b/demos/slice-rendering/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/slice-rendering/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/slice-rendering/app.py b/demos/slice-rendering/app.py index d1c8bf3..3afebd6 100644 --- a/demos/slice-rendering/app.py +++ b/demos/slice-rendering/app.py @@ -30,7 +30,7 @@ def custom_card(children): return dbc.Card( html.Div(children, style={"height": "100%"}), body=True, - style={"height": "70vh"}, + style={"height": "100%"}, ) @@ -106,16 +106,18 @@ def custom_card(children): app.layout = dbc.Container( fluid=True, + style={"height": "calc(100vh - 30px)"}, children=[ - html.H2("Demo of Slice Rendering"), - html.Br(), - controls, - html.Br(), + html.Div( + style={"height": "20%", "display": "flex", "align-items": "center"}, + children=[html.Br(), controls, html.Br(),], + ), dbc.Row( - [ + style={"height": "80%"}, + children=[ dbc.Col(width=6, children=custom_card(slice_view)), dbc.Col(width=6, children=custom_card(volume_view)), - ] + ], ), ], ) diff --git a/demos/slice-rendering/runtime.txt b/demos/slice-rendering/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/slice-rendering/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/demos/synthetic-volume-rendering/Procfile b/demos/synthetic-volume-rendering/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/synthetic-volume-rendering/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/synthetic-volume-rendering/app.py b/demos/synthetic-volume-rendering/app.py index ae398a2..ad3905e 100644 --- a/demos/synthetic-volume-rendering/app.py +++ b/demos/synthetic-volume-rendering/app.py @@ -9,18 +9,20 @@ app = dash.Dash(__name__) server = app.server +volume_view = dash_vtk.View( + children=dash_vtk.VolumeDataRepresentation( + spacing=[1, 1, 1], + dimensions=[10, 10, 10], + origin=[0, 0, 0], + scalars=[random.random() for _ in range(1000)], + rescaleColorMap=False, + ) +) + app.layout = html.Div( - style={"height": "calc(100vh - 30px)", "width": "100%",}, + style={"height": "calc(100vh - 16px)"}, children=[ - dash_vtk.View( - children=dash_vtk.VolumeDataRepresentation( - spacing=[1, 1, 1], - dimensions=[10, 10, 10], - origin=[0, 0, 0], - scalars=[random.random() for _ in range(1000)], - rescaleColorMap=False, - ) - ) + html.Div(children=volume_view, style={"height": "100%", "width": "100%"}) ], ) diff --git a/demos/synthetic-volume-rendering/runtime.txt b/demos/synthetic-volume-rendering/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/synthetic-volume-rendering/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/demos/usage-algorithm/app.py b/demos/usage-algorithm/app.py index 2b08179..04176f3 100644 --- a/demos/usage-algorithm/app.py +++ b/demos/usage-algorithm/app.py @@ -13,7 +13,7 @@ server = app.server vtk_view = dash_vtk.View( - id="vtk-view", + id="geometry-view", children=[ dash_vtk.GeometryRepresentation( [ @@ -55,29 +55,26 @@ app.layout = dbc.Container( fluid=True, + style={"margin-top": "15px", "height": "calc(100vh - 30px)"}, children=[ - html.H1("Demo of dash_vtk.Algorithm"), - html.Hr(), dbc.Row( [ dbc.Col(width=4, children=controls), dbc.Col( width=8, children=[ - html.Div( - vtk_view, - style={"height": "calc(80vh - 20px)", "width": "100%"}, - ) + html.Div(vtk_view, style={"height": "100%", "width": "100%"},) ], ), - ] + ], + style={"height": "100%"}, ), ], ) @app.callback( - [Output("vtk-algorithm", "state"), Output("vtk-view", "triggerResetCamera")], + [Output("vtk-algorithm", "state"), Output("geometry-view", "triggerResetCamera")], [Input("slider-resolution", "value"), Input("capping-checklist", "value")], ) def update_cone(slider_val, checked_values): diff --git a/demos/usage-vtk-cfd/Procfile b/demos/usage-vtk-cfd/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/usage-vtk-cfd/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/usage-vtk-cfd/app.py b/demos/usage-vtk-cfd/app.py index 4299396..573f8ea 100644 --- a/demos/usage-vtk-cfd/app.py +++ b/demos/usage-vtk-cfd/app.py @@ -139,74 +139,73 @@ def getSeedState(self): # Control UI # ----------------------------------------------------------------------------- -controls = dbc.Col( - children=[ - dbc.Card( - [ - dbc.CardHeader("Seeds"), - dbc.CardBody( - [ - html.P("Seed line:"), - dcc.Slider( - id="point-1", - min=-1, - max=1, - step=0.01, - value=0, - marks={-1: "-1", 1: "+1"}, - ), - dcc.Slider( - id="point-2", - min=-1, - max=1, - step=0.01, - value=0, - marks={-1: "-1", 1: "+1"}, - ), - html.Br(), - html.P("Line resolution:"), - dcc.Slider( - id="seed-resolution", - min=5, - max=50, - step=1, - value=10, - marks={5: "5", 50: "50"}, - ), - ] - ), - ] - ), - dbc.Card( - [ - dbc.CardHeader("Color By"), - dbc.CardBody( - [ - html.P("Field name"), - dcc.Dropdown( - id="color-by", - options=[ - {"label": "p", "value": "p"}, - {"label": "Rotation", "value": "Rotation"}, - {"label": "U", "value": "U"}, - {"label": "Vorticity", "value": "Vorticity"}, - {"label": "k", "value": "k"}, - ], - value="p", - ), - html.Br(), - html.P("Color Preset"), - dcc.Dropdown( - id="preset", - options=preset_as_options, - value="erdc_rainbow_bright", - ), - ] - ), - ] - ), - ] -) +controls = [ + dbc.Card( + [ + dbc.CardHeader("Seeds"), + dbc.CardBody( + [ + html.P("Seed line:"), + dcc.Slider( + id="point-1", + min=-1, + max=1, + step=0.01, + value=0, + marks={-1: "-1", 1: "+1"}, + ), + dcc.Slider( + id="point-2", + min=-1, + max=1, + step=0.01, + value=0, + marks={-1: "-1", 1: "+1"}, + ), + html.Br(), + html.P("Line resolution:"), + dcc.Slider( + id="seed-resolution", + min=5, + max=50, + step=1, + value=10, + marks={5: "5", 50: "50"}, + ), + ] + ), + ] + ), + html.Br(), + dbc.Card( + [ + dbc.CardHeader("Color By"), + dbc.CardBody( + [ + html.P("Field name"), + dcc.Dropdown( + id="color-by", + options=[ + {"label": "p", "value": "p"}, + {"label": "Rotation", "value": "Rotation"}, + {"label": "U", "value": "U"}, + {"label": "Vorticity", "value": "Vorticity"}, + {"label": "k", "value": "k"}, + ], + value="p", + ), + html.Br(), + html.P("Color Preset"), + dcc.Dropdown( + id="preset", + options=preset_as_options, + value="erdc_rainbow_bright", + ), + ] + ), + ] + ), +] # ----------------------------------------------------------------------------- # App UI @@ -214,22 +213,19 @@ def getSeedState(self): app.layout = dbc.Container( fluid=True, + style={"margin-top": "15px", "height": "calc(100vh - 30px)"}, children=[ - html.H1("dash_vtk rendering with VTK processing"), - html.Hr(), dbc.Row( [ - dbc.Col(width=4, children=[controls],), + dbc.Col(width=4, children=controls), dbc.Col( width=8, children=[ - html.Div( - vtk_view, - style={"height": "calc(80vh - 20px)", "width": "100%"}, - ) + html.Div(vtk_view, style={"height": "100%", "width": "100%"}) ], ), - ] + ], + style={"height": "100%"}, ), ], ) diff --git a/demos/usage-vtk-cfd/requirements.txt b/demos/usage-vtk-cfd/requirements.txt index 3ac27e0..b3a3722 100644 --- a/demos/usage-vtk-cfd/requirements.txt +++ b/demos/usage-vtk-cfd/requirements.txt @@ -3,3 +3,4 @@ dash-vtk dash-bootstrap-components pyvista numpy +vtk \ No newline at end of file diff --git a/demos/usage-vtk-cfd/runtime.txt b/demos/usage-vtk-cfd/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/usage-vtk-cfd/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/demos/volume-rendering/Procfile b/demos/volume-rendering/Procfile deleted file mode 100644 index b308fd8..0000000 --- a/demos/volume-rendering/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: gunicorn app:server \ No newline at end of file diff --git a/demos/volume-rendering/app.py b/demos/volume-rendering/app.py index 7699e48..ed7502b 100644 --- a/demos/volume-rendering/app.py +++ b/demos/volume-rendering/app.py @@ -18,21 +18,18 @@ volume_state = to_volume_state(reader.GetOutput()) +vtk_view = dash_vtk.View( + dash_vtk.VolumeRepresentation( + children=[dash_vtk.VolumeController(), dash_vtk.Volume(state=volume_state),] + ) +) + app = dash.Dash(__name__) server = app.server app.layout = html.Div( - style={"height": "calc(100vh - 30px)", "width": "100%",}, - children=[ - dash_vtk.View( - dash_vtk.VolumeRepresentation( - children=[ - dash_vtk.VolumeController(), - dash_vtk.Volume(state=volume_state), - ] - ) - ) - ], + style={"height": "calc(100vh - 16px)", "width": "100%"}, + children=[html.Div(vtk_view, style={"height": "100%", "width": "100%"})], ) if __name__ == "__main__": diff --git a/demos/volume-rendering/requirements.txt b/demos/volume-rendering/requirements.txt index 120f262..dc00966 100644 --- a/demos/volume-rendering/requirements.txt +++ b/demos/volume-rendering/requirements.txt @@ -2,3 +2,4 @@ dash-vtk dash vtk +numpy \ No newline at end of file diff --git a/demos/volume-rendering/runtime.txt b/demos/volume-rendering/runtime.txt deleted file mode 100644 index 257b314..0000000 --- a/demos/volume-rendering/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -python-3.7.6 \ No newline at end of file diff --git a/tests/requirements.txt b/tests/requirements.txt index 089ff40..267fb1e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,11 +4,4 @@ dash[dev,testing]>=1.15.0 Pillow --r ../demos/usage-algorithm/requirements.txt --r ../demos/pyvista-terrain-following-mesh/requirements.txt --r ../demos/slice-rendering/requirements.txt --r ../demos/pyvista-point-cloud/requirements.txt --r ../demos/volume-rendering/requirements.txt --r ../demos/usage-vtk-cfd/requirements.txt --r ../demos/usage-algorithm/requirements.txt --r ../demos/synthetic-volume-rendering/requirements.txt \ No newline at end of file +-r ../demos/requirements.txt \ No newline at end of file