Skip to content

Refactor demos - Remove unused files, change requirements linking, remove headers #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion demos/pyvista-point-cloud/Procfile

This file was deleted.

27 changes: 5 additions & 22 deletions demos/pyvista-point-cloud/app.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
)
Expand All @@ -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(
Expand All @@ -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__":
Expand Down
1 change: 0 additions & 1 deletion demos/pyvista-point-cloud/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion demos/pyvista-point-cloud/runtime.txt

This file was deleted.

1 change: 0 additions & 1 deletion demos/pyvista-terrain-following-mesh/Procfile

This file was deleted.

53 changes: 19 additions & 34 deletions demos/pyvista-terrain-following-mesh/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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%"},
),
],
)
Expand Down
1 change: 1 addition & 0 deletions demos/pyvista-terrain-following-mesh/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dash-vtk
dash-bootstrap-components
pyvista
numpy
vtk
1 change: 0 additions & 1 deletion demos/pyvista-terrain-following-mesh/runtime.txt

This file was deleted.

8 changes: 8 additions & 0 deletions demos/requirements.txt
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion demos/slice-rendering/Procfile

This file was deleted.

16 changes: 9 additions & 7 deletions demos/slice-rendering/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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%"},
)


Expand Down Expand Up @@ -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)),
]
],
),
],
)
Expand Down
1 change: 0 additions & 1 deletion demos/slice-rendering/runtime.txt

This file was deleted.

1 change: 0 additions & 1 deletion demos/synthetic-volume-rendering/Procfile

This file was deleted.

22 changes: 12 additions & 10 deletions demos/synthetic-volume-rendering/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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%"})
],
)

Expand Down
1 change: 0 additions & 1 deletion demos/synthetic-volume-rendering/runtime.txt

This file was deleted.

15 changes: 6 additions & 9 deletions demos/usage-algorithm/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
server = app.server

vtk_view = dash_vtk.View(
id="vtk-view",
id="geometry-view",
children=[
dash_vtk.GeometryRepresentation(
[
Expand Down Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion demos/usage-vtk-cfd/Procfile

This file was deleted.

Loading