Spaces:
Running
Running
siddhant-rajhans commited on
Commit ·
4f96c68
1
Parent(s): 8643122
Fix Cognitive Load fillcolor crash, pre-select Visual ROIs in Brain Viewer
Browse files- Fix hex-to-rgba conversion for confidence band fill colors (was producing
invalid color strings like 'rgba(00D2FF' instead of 'rgba(0,210,255,0.15)')
- Pre-select Visual region group in Brain Viewer so ROI highlighting is
visible on first load
- pages/2_Cognitive_Load.py +8 -1
- pages/5_Brain_Viewer.py +2 -2
pages/2_Cognitive_Load.py
CHANGED
|
@@ -92,9 +92,16 @@ for dim, color in dim_colors.items():
|
|
| 92 |
ci_hi = np.percentile(boot_arr, 97.5, axis=0)
|
| 93 |
t_axis = timeline_df["time"].values
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
fig.add_trace(go.Scatter(x=t_axis, y=ci_hi, mode="lines", line=dict(width=0), showlegend=False))
|
| 96 |
fig.add_trace(go.Scatter(x=t_axis, y=ci_lo, mode="lines", line=dict(width=0),
|
| 97 |
-
fill="tonexty", fillcolor=
|
| 98 |
showlegend=False))
|
| 99 |
|
| 100 |
fig.add_trace(go.Scatter(x=timeline_df["time"], y=y, name=dim, line=dict(color=color, width=2)))
|
|
|
|
| 92 |
ci_hi = np.percentile(boot_arr, 97.5, axis=0)
|
| 93 |
t_axis = timeline_df["time"].values
|
| 94 |
|
| 95 |
+
# Convert hex color to rgba for fill
|
| 96 |
+
if color.startswith("#"):
|
| 97 |
+
r, g, b = int(color[1:3], 16), int(color[3:5], 16), int(color[5:7], 16)
|
| 98 |
+
fill_color = f"rgba({r},{g},{b},0.15)"
|
| 99 |
+
else:
|
| 100 |
+
fill_color = color
|
| 101 |
+
|
| 102 |
fig.add_trace(go.Scatter(x=t_axis, y=ci_hi, mode="lines", line=dict(width=0), showlegend=False))
|
| 103 |
fig.add_trace(go.Scatter(x=t_axis, y=ci_lo, mode="lines", line=dict(width=0),
|
| 104 |
+
fill="tonexty", fillcolor=fill_color,
|
| 105 |
showlegend=False))
|
| 106 |
|
| 107 |
fig.add_trace(go.Scatter(x=timeline_df["time"], y=y, name=dim, line=dict(color=color, width=2)))
|
pages/5_Brain_Viewer.py
CHANGED
|
@@ -51,11 +51,11 @@ with st.sidebar:
|
|
| 51 |
format_func=lambda x: {"#0E1117": "Dark", "#000000": "Black", "#1A1A2E": "Navy"}[x])
|
| 52 |
|
| 53 |
st.subheader("ROI Highlighting")
|
| 54 |
-
roi_groups_selected = st.multiselect("Region groups", list(ROI_GROUPS.keys()))
|
| 55 |
available_rois = []
|
| 56 |
for g in roi_groups_selected:
|
| 57 |
available_rois.extend(ROI_GROUPS[g])
|
| 58 |
-
selected_rois = st.multiselect("Specific ROIs", available_rois, default=available_rois[:
|
| 59 |
show_labels = st.checkbox("Show ROI labels", value=True)
|
| 60 |
|
| 61 |
# --- Load Mesh ---
|
|
|
|
| 51 |
format_func=lambda x: {"#0E1117": "Dark", "#000000": "Black", "#1A1A2E": "Navy"}[x])
|
| 52 |
|
| 53 |
st.subheader("ROI Highlighting")
|
| 54 |
+
roi_groups_selected = st.multiselect("Region groups", list(ROI_GROUPS.keys()), default=["Visual"])
|
| 55 |
available_rois = []
|
| 56 |
for g in roi_groups_selected:
|
| 57 |
available_rois.extend(ROI_GROUPS[g])
|
| 58 |
+
selected_rois = st.multiselect("Specific ROIs", available_rois, default=available_rois[:4] if available_rois else [])
|
| 59 |
show_labels = st.checkbox("Show ROI labels", value=True)
|
| 60 |
|
| 61 |
# --- Load Mesh ---
|