fixing .gitignore

This commit is contained in:
2024-05-28 15:38:40 +02:00
parent e914004cc2
commit 9a3149d19f
7 changed files with 139 additions and 41 deletions

4
.gitignore vendored
View File

@ -2,6 +2,4 @@
/electron-3d-app/
/express-app/
/react-app/
/.vscode/
/3D_app/__pycache__/
/3D_app/pages/__pycache__/
/.vscode/

2
3D_app/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
__pycache__/
*.py[cod]

View File

@ -54,6 +54,7 @@ layout = html.Div(
{"label": "Option 2", "value": "2"},
],
style={"margin-bottom": "15px"},
value=1,
),
]
),

View File

@ -10,31 +10,25 @@ from util import *
dash.register_page(__name__, path="/")
# on définit le dossier et les fichiers à lire
# dossier = "Dataset/Shear_transform"
# fichiers_selectionnes = [
# "Shear_x001-x101_y{:03d}_Rot00_transform.csv".format(i) for i in range(10, 14)
# ]
dossier = "Dataset/Shear_transform"
fichiers_selectionnes = [
"Shear_x001-x101_y{:03d}_Rot00_transform.csv".format(i) for i in range(10, 14)
]
# on charge le fichier numpy
fichiers = np.load("Dataset/npy/3D_Dataset_Shear_Wave_Rot00.npy")
fichiers = np.load("Dataset/npy/export.npy")
# valeurs d'échantillonage
echantillonage_x = 4
echantillonage_y = 1
echantillonage_z = 32
echantillonage_x = 1
echantillonage_y = 32
echantillonage_z = 1
# on lit les fichiers et on les met dans un tableau
pre_volume = np.array(fichiers)
pre_volume = np.array(lire_fichier_csv(dossier, fichiers_selectionnes))
volume = pre_volume[::echantillonage_x, ::echantillonage_y, ::echantillonage_z]
dim_x, dim_y, dim_z = volume.shape
print(volume.shape)
X, Y, Z = np.mgrid[0:dim_x, 0:dim_y, 0:dim_z]
X = np.array(np.load("Dataset/npy/x-values.npy"))[::echantillonage_x]
Y = np.array(np.load("Dataset/npy/y-values.npy"))[::echantillonage_y]
Z = np.array(np.load("Dataset/npy/z-values.npy"))[::echantillonage_z]
print(len(X), len(Y), len(Z))
# on défini le thème de l'application
pio.templates.default = "plotly_dark"
@ -131,7 +125,7 @@ mesh_card = dbc.Card(
id="3dplot",
figure=fig,
config=config3DPlot,
style={"height": "411px", "marginBottom": "15px"},
style={"marginBottom": "15px"},
), # 'fig' is your 3D plotly figure
dcc.Slider(
id="iso-slider",
@ -242,13 +236,22 @@ Ascan_card = dbc.Card(
), # 'fig' is your 2D plotly figure
dcc.Slider(
id="layer-slider-ascan",
min=1,
max=dim_x,
value=1,
min=0,
max=dim_x - 1,
value=0,
step=1,
marks={
str(i): str(i)
for i in range(1, dim_x + 1, max(1, int(dim_x / 20)))
str(i): str(i) for i in range(0, dim_x, max(1, int(dim_x / 20)))
},
),
dcc.Slider(
id="ascan-slider",
min=1,
max=dim_z - 1,
value=0,
step=1,
marks={
str(i): str(i) for i in range(1, dim_z, max(1, int(dim_z / 20)))
},
),
dbc.Modal(
@ -263,14 +266,14 @@ Ascan_card = dbc.Card(
), # 'fig' is your 2D plotly figure
dcc.Slider(
id="layer-slider-ascan-fullscreen",
min=1,
min=0,
max=dim_x,
value=1,
value=0,
step=1,
marks={
str(i): str(i)
for i in range(
1, dim_x + 1, max(1, int(dim_x / 50))
0, dim_x, max(1, int(dim_x / 50))
)
},
),
@ -318,13 +321,12 @@ Bscan_card_xy = dbc.Card(
), # 'fig' is your 2D plotly figure
dcc.Slider(
id="layer-slider-bscan-zx",
min=1,
max=dim_x,
value=1,
min=0,
max=dim_x - 1,
value=0,
step=1,
marks={
str(i): str(i)
for i in range(1, dim_x + 1, max(1, int(dim_x / 20)))
str(i): str(i) for i in range(0, dim_x, max(1, int(dim_x / 20)))
},
),
dbc.Modal(
@ -339,14 +341,14 @@ Bscan_card_xy = dbc.Card(
), # 'fig' is your 2D plotly figure
dcc.Slider(
id="layer-slider-bscan-zx-fullscreen",
min=1,
min=0,
max=dim_x,
value=1,
value=0,
step=1,
marks={
str(i): str(i)
for i in range(
1, dim_x + 1, max(1, int(dim_x / 50))
0, dim_x + 1, max(1, int(dim_x / 50))
)
},
),
@ -447,6 +449,8 @@ layout = html.Div(
[dbc.Col(Bscan_card_xy, width=6), dbc.Col(Bscan_card_zx, width=6)],
style={"margin": "8px"},
),
dcc.Store(id="store-bscan-xy-layer", data=1),
dcc.Store(id="store-bscan-zx-layer", data=0),
]
)
@ -535,16 +539,23 @@ def update_heatmap_ascan_fullscreen(layer):
# callback pour les B-scan XY
@callback(Output("heatmap-bscan-zx", "figure"), Input("layer-slider-bscan-zx", "value"))
@callback(
[
Output("heatmap-bscan-zx", "figure"),
Output("store-bscan-zx-layer", "data"),
],
[Input("layer-slider-bscan-zx", "value")],
prevent_initial_call=True,
)
def update_heatmap_bscan_zx(layer):
fig = px.imshow(
volume[layer - 1, :, :],
color_continuous_scale="Jet",
aspect="auto",
title="B-scan XY",
title="B-scan ZX",
)
return fig
return [fig, layer]
# callback pour les B-scan ZX en plein écran
@ -564,11 +575,15 @@ def update_heatmap_bscan_zx_fullscreen(layer):
# callback pour les B-scan ZX
@callback(Output("heatmap-bscan-xy", "figure"), Input("layer-slider-bscan-xy", "value"))
@callback(
[Output("heatmap-bscan-xy", "figure"), Output("store-bscan-xy-layer", "data")],
[Input("layer-slider-bscan-xy", "value")],
prevent_initial_call=True,
)
def update_heatmap_bscan_xy(layer):
fig = go.Figure(data=go.Heatmap(z=volume[:, :, layer], colorscale="Jet"))
return fig
return [fig, layer]
# callback pour les B-scan ZX en plein écran
@ -629,3 +644,85 @@ def toggle_fullscreen_bscan_zx(n1, is_open):
return not is_open
return is_open
@callback(
[
Output("3dplot", "clickData"),
Output("layer-slider-bscan-xy", "value"),
Output("layer-slider-bscan-zx", "value"),
],
Input("3dplot", "clickData"),
)
def display_3dplot_click_data(clickData):
if clickData is None:
return [None, 1, 1]
bscan_xy = clickData["points"][0]["z"]
bscan_zx = clickData["points"][0]["x"]
return [clickData, bscan_xy, bscan_zx]
@callback(
[
Output("heatmap-bscan-xy", "clickData"),
Output("layer-slider-bscan-zx", "value", allow_duplicate=True),
],
[Input("heatmap-bscan-xy", "clickData")],
prevent_initial_call=True,
)
def display_bscan_xy_click_data(clickData):
if clickData is None:
return [None, 1]
bscan_zx = clickData["points"][0]["y"]
return [clickData, bscan_zx]
@callback(
[
Output("heatmap-bscan-zx", "clickData"),
Output("layer-slider-bscan-xy", "value", allow_duplicate=True),
],
[Input("heatmap-bscan-zx", "clickData")],
prevent_initial_call=True,
)
def display_bscan_zx_click_data(clickData):
if clickData is None:
return [None, 1]
bscan_xy = clickData["points"][0]["x"]
return [clickData, bscan_xy]
@callback(
[Output("heatmap-bscan-xy", "figure", allow_duplicate=True), Output("heatmap-bscan-zx", "figure", allow_duplicate=True)],
[Input("store-bscan-xy-layer", "data"), Input("store-bscan-zx-layer", "data")],
prevent_initial_call=True,
)
def update_bscan_layers(bscan_xy, bscan_zx):
fig = go.Figure(data=go.Heatmap(z=volume[:, :, bscan_xy], colorscale="Jet"))
fig.add_shape(
type="line",
x0=0-1,
y0=bscan_zx,
x1=dim_y,
y1=bscan_zx,
line=dict(color="white", width=1),
)
fig2 = px.imshow(
volume[bscan_zx - 1, :, :],
color_continuous_scale="Jet",
aspect="auto",
title="B-scan ZX",
)
fig2.add_shape(
type="line",
x0=bscan_xy,
y0=0,
x1=bscan_xy,
y1=dim_y,
line=dict(color="white", width=1),
)
return [fig, fig2]