Skip to content
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
383 changes: 290 additions & 93 deletions app/streamlit_app.py

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions docs/gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,64 @@ In the manuscript, refer to the interface as a *local graphical user interface*
The compound latent-space tab is intentionally inference-only. The latent dimension is fixed at the trained 2-D embedding and the batch size is fixed internally; the GUI does not expose training-from-zero controls.

The compound workflow tab now shows a compact legacy-style reach diagnostic inspired by the research scripts: reach-scale CWT energy, the integrated corridor-energy signal, curvature, and the centreline with unit boundaries. The separate model CWT image remains the 64 x 64 grayscale image used as autoencoder input.
## GUI polish notes for paper/Zenodo release

The GUI separates display diagnostics from model inputs:

- The reach-scale CWT diagnostic is a legacy-style visual check for compound-unit segmentation. The frequency display range can be widened from the GUI without changing the segmentation calculation.
- The selected-unit model CWT image is the exact 64 x 64 array passed to the trained compound autoencoder. An enhanced preview is shown beside it only for human visibility.
- The compound latent-space plot uses a simple legend: reference meander cloud, detected meander units, and selected unit. It does not use `n_lobes` as the colour scale by default.
- The single-bend classifier shows a visible latent-space cluster plot and cluster-size table when the optional single-bend autoencoder is available locally.



## GUI display notes

The compound latent-space panel can optionally annotate detected units with their unit numbers. The reference cloud is shown only as context, while the selected detected unit is highlighted separately.

The compound CWT image shown in the workflow tab has two display modes. The enhanced preview is intended for visual inspection. The exact 64 x 64 image is the reproducible model input passed to the compound autoencoder; it uses pixel axes because it is a resized array rather than a physical CWT diagnostic figure.

The reach-scale CWT diagnostic is a display-only diagnostic. The maximum displayed frequency can be adjusted in the GUI without changing the underlying compound segmentation.


## Compound model CWT image convention

The compound-bend model-input image is different from the reach-scale CWT diagnostic. The reach-scale CWT is a physical/diagnostic plot used to inspect segmentation. The compound model image is a resized 64 x 64 training-style array generated from one extracted unit's curvature signal. It follows the legacy training-image polarity: white background with dark high-energy CWT structures. The GUI enhanced preview is for visual inspection only; the exact 64 x 64 array is the image passed to the compound autoencoder.

## Single-bend Zenodo model download

The single-bend classifier tab can download the public Zenodo autoencoder directly into `models/Autoencoder_Meander_Bend.h5`. This file remains ignored by Git and should not be committed. The GUI verifies the downloaded file with the MD5 checksum stored in `meander_morphology.model`.


## Compound model-image axes

The compound model-image preview uses the same 64 x 64 array passed to the autoencoder. The horizontal axis is displayed as `S_bend/S_bend,max` to match the training plots. The vertical axis is a CWT scale index because the resized model input does not preserve the original physical frequency or period coordinate.


## Compound CWT preview

The compound workflow displays a training-style CWT preview by default. This preview uses the same convention as the research scripts:

- x-axis: `S_bend / S_bend,max`
- y-axis: `l = 1 / frequency`
- plotting style: `contourf(..., cmap="binary", vmin=mean + std)`

The exact 64 x 64 model input is not displayed in the GUI; export `compound_spectra.npy` for reproducibility checks.

## Exact compound autoencoder input

The compound autoencoder input is generated by rasterising the same axis-free
Matplotlib `contourf(..., cmap="binary", vmin=mean+std)` image used in the
training scripts and resizing that raster to 64 x 64. The physical/legacy axes
are shown only in the training-style preview. The hidden exact model-input view
is axis-free because the autoencoder was trained on images, not on axes.


## Compound model-input display policy

The GUI does not display the exact 64 x 64 compound autoencoder input by default.
That array is a resized/rasterised model artifact and is easy to misinterpret as a
scientific CWT figure. The GUI instead displays the training-style CWT preview
with labelled axes (`S_bend / S_bend,max` and `l = 1 / frequency`). The internal
model arrays can still be exported through `compound_spectra.npy` for
reproducibility.
9 changes: 2 additions & 7 deletions src/meander_morphology/compound_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd

from .compound import compound_bends_to_metadata_rows, extract_compound_bends
from .cwt import save_spectrum_image, spectrum_image_from_geometry
from .cwt import legacy_compound_training_image_from_curvature, save_spectrum_image
from .io import read_centerline_table, write_bend_summary


Expand Down Expand Up @@ -50,12 +50,7 @@ def extract_compound_bends_and_spectra(

spectra = []
for unit in units:
image = spectrum_image_from_geometry(
unit.x,
unit.y,
image_size=image_size,
target_points=unit_points,
)
image = legacy_compound_training_image_from_curvature(unit.curvature, image_size=image_size)
spectra.append(image)
save_spectrum_image(str(spectra_dir / f"compound_unit_{unit.unit_id:04d}.png"), image)

Expand Down
Loading
Loading