Interactive segmentation and analysis of laryngoscopic high-speed video: the glottal opening is segmented frame-by-frame and both the Glottal Area Waveform (GAW) and the Phonovibrogram (PVG) are computed from the masks.
This repository contains the released standalone application (aviSegment.exe)
plus the full source code in forCompiling/, including the C segmentation and
PVG kernels.
The app loads an AVI video of the larynx and segments the glottal opening in every frame:
- Load video - all frames are read into memory.
- Thresholding - four horizontal bands divide the image; each band has a
pixel-value threshold. A pixel is foreground ("open glottis") iff
pixel < threshold(row) * smoothing(col). - Smoothing fade - a pchip curve (factor 0..1) across the image width scales the threshold to fade out artefacts near the left/right image edges.
- Keyframes - thresholds can be set per frame and are interpolated across all other frames; keyframes are managed via the frame listbox.
- Segmentation - user-placed seed crosses restrict the region. A Line-of-Sight (LOS) alpha C kernel fills holes, concavities and gaps between blobs; a pure-MATLAB alpha-shape fallback is used if the MEX is absent.
- GAW / PVG - the Glottal Area Waveform and the Phonovibrogram are computed from the segmented masks.
- Install the MATLAB Runtime 2022a (Windows x64) once on the target machine.
- Download
aviSegment.exeand run it. - A MATLAB licence is not required.
-
You need a recent MATLAB release (Windows x64) with the Image Processing Toolbox.
-
Open the
forCompiling/folder in MATLAB and run:cd forCompiling aviSegment
-
About the prebuilt MEX kernels (
los_extract_batch.mexw64,pvgextract_batch.mexw64): MEX files are tied to the MATLAB release they were compiled against (the files shipped here match the release build). If a MEX is missing or incompatible, the app automatically falls back to the slower pure-MATLAB pipeline. To rebuild the kernels for a different MATLAB release, use the build scripts documented inseg_extraction/README.mdandpvg_extraction/README.md.
- Load an AVI (
Load file). - Place the four threshold lines on the image and set the seed crosses that mark the region to segment.
- Scroll through the video and adjust thresholds; set threshold keyframes in frames where the illumination changes.
- Optionally refine the edge fade with smoothing points.
- Tune the alpha radii and, if desired, switch the LOS distance metric to Euclidean (instead of the default Chebyshev).
- Use the frame range slider or the start/end frame fields to restrict analysis to a subset of the recording.
- Compute GAW / PVG and export the results.
- Frame slider - step through the video; the app re-segments the current frame live.
- Range slider + start/end fields - restrict segmentation and GAW/PVG computation to a frame subset.
- Threshold lines / threshold plot / smoothing fade - set the four band thresholds and the edge-fading curve.
- Threshold keyframe listbox (+/-) - add/remove per-frame threshold keyframes; the app interpolates between them.
- Seed crosses (+/-) - place/remove the segmentation seed grid.
- Alpha radii - per-blob and after-blob alpha radius for gap filling.
- "Use Euclidean" checkbox - distance metric for the LOS alpha radius (default off = Chebyshev/block distance).
- Mask overlay transparency + color - visualize the segmentation overlay.
- GAW/PVG window (reached via
Preview GAW) - calculate GAW and PVG, set the PVG excerpt, and save results as image or video.
- Mouse wheel - one frame forward/backward.
- Arrow keys - right/left = ±1 frame, down/up = ±10 frames.
- GAW: semicolon-delimited text with columns
Sample, Time, GAW, Interior GAW. - Mask videos: AVI from the segmented masks - black/white, inside black / outside original, or outside white / inside original.
- PVG: PNG image (before saving, the PVG is already visible in the GAW/PVG window).
githubRepo/
├── aviSegment.exe released standalone application (requires
│ MATLAB Runtime 2022a)
├── ReleaseNotes.txt version history (newest first)
├── LICENSE MIT license
├── CITATION.cff citation metadata (cite this repository)
└── forCompiling/ everything needed to build & run from source
├── aviSegment.m main interactive application
├── compileAviSegment.m build script: assembles the standalone app
│ and the forCompiling folder (MATLAB Compiler)
├── drawMajorAxis.m pure-MATLAB PVG reference (fallback)
├── distinguishable_colors.m colour helper for the overlay
├── los_extract_batch.mexw64 LOS segmentation kernel (fast path)
├── pvgextract_batch.mexw64 PVG extraction kernel (fast path)
├── seg_extraction/ segmentation kernels (approach + benchmarks +
│ build scripts + own README)
└── pvg_extraction/ PVG kernels (approach + benchmarks +
build scripts + own README)
If you want to rebuild the .exe yourself:
- Install MATLAB R2022a with the MATLAB Compiler and the Image Processing Toolbox.
- Rebuild the MEX kernels against R2022a (see the two sub-READMEs, the MEX ABI must match the runtime).
- Run
compileAviSegment; it builds the standalone application, copies the.exetogithubRepo/, and refreshes theforCompiling/folder with all required files.
Released under the MIT License - see LICENSE.
If you use this software in your research, please cite it; see
CITATION.cff for the citation metadata.
