Toolkit to load SAR maps from CSV, register a measured map to a reference one, and evaluate 2D gamma for SAR pattern validation on a fixed grid.
This project is licensed under the MIT license terms specified in the LICENSE file.
Notebook assets live under notebooks/:
notebooks/tutorial_gamma_pattern_validation_notebook.ipynb— tutorial walkthrough of the full validation pipeline, from CSV loading through registration and gamma evaluation.notebooks/voila.ipynb— Voila-integrated notebook UI for interactive use of the workflow.
Features:
- Load & preprocess:
image_loader.py(CSV → dense grids → SimpleITK images; absolute masking, peak normalization, dB conversion, plotting). - 2D registration:
registration2d.py(translate/rigid, exhaustive search, multi-resolution pyramid). - Gamma evaluation:
gamma_eval.py(resample measured → reference, compute in linear peak-normalized space, optional ROI masks, plots).
uv venv .venv
source .venv/bin/activate # Windows PowerShell: .venv\Scripts\Activate.ps1
uv pip install -e ".[dev]"
uv pip install ipykernel
python -m ipykernel install --user --name sar-pattern-validation --display-name "Python (sar-pattern-validation)"If you need the repository data files under data/database/ or data/measurements/, install Git LFS and pull the large CSV assets:
git lfs install
git lfs pullFolder structure
data/example/- Small example CSVs for quick local runs.
data/database/- Reference SAR CSVs stored with Git LFS.
data/measurements/- Measurement CSVs stored with Git LFS - used for validation & regression testing.
File Structure Examples of accepted headers:
x, y, SAR(defaults to meters)x [m], y [m], sSAR1gx_mm, y_mm, sSAR1gx [mm], y [mm], pssar10g
The loader auto-detects:
- coordinate columns that explicitly match forms like
x,y,x [m],y_mm - SAR column containing
"sar"
Coordinates must use consistent physical units between files.
Policy note:
- Bare / unspecified coordinate headers default to meters.
- Explicit unit-bearing headers are still preferred, especially when preparing new datasets.
-
Load measured & reference CSVs with
SARImageLoader- Builds grids (native or resampled)
- Applies absolute cutoff mask $$ \text{cutoff} = \min(0.1,; 2 \times \text{noise_floor_wkg}) $$
- Peak-normalizes linear SAR
- Produces linear and dB images
-
Register
- Fixed = reference
- Moving = measured
- Returns measured resampled onto the reference grid
-
Gamma
- Inputs are linear peak-normalized SAR
- Measured is resampled onto the reference grid
- Gamma is evaluated on the reference grid over the default overlap ROI: reference mask ∩ transformed measured mask
Broad test runs skip slow tests by default. Run them explicitly when needed:
make tests-fast
make tests-slowRun the measurement validation suite in parallel:
make measurement-validationThe slow integration and validation tests that read data/database/ or data/measurements/ also require git lfs pull.
After the validation suite has run, generate an interactive HTML dashboard from the per-frequency JSON reports:
python scripts/measurement_validation/generate_and_open_measurement_validation_dashboard.pySee scripts/measurement_validation/MEASUREMENT_VALIDATION_TESTING.md for the full guide: smart rerun, artifact regeneration, plot saving, and direct HTML generation.
SARImageLoader
measured_path,reference_pathnoise_floor_wkgresample_resolution(meters orNone)show_plotwarn
Rigid2DRegistration
transform_type:TRANSLATE | RIGID- Stage parameters:
translation_steptx_steps,ty_stepsrot_step_degrot_span_deg
- Uses Mattes Mutual Information
- Multi-resolution pyramid:
[4, 2, 1]
GammaMapEvaluator
reference_sar_linearmeasured_sar_linearmeasured_to_reference_transformdose_to_agreement_percentdistance_to_agreement_mmgamma_cap- Optional:
reference_mask_u8,measured_mask_u8
Gamma tolerance:
Distance-to-agreement (mm) is internally converted to pixel radius using reference spacing.
This section documents how to set up and maintain the SAR Pattern Validation tool as an oSPARC dynamic service.
-
Add the service to your oSPARC project Add a
simcore/services/dynamic/jupyter-mathservice of version 3.0.5 to your project and open it. -
Clone the repository In the service terminal, navigate to the workspace directory and clone the repository:
cd /home/jovyan/work/workspace git clone https://github.com/ITISFoundation/SAR-Pattern-Validation.git -
Copy the Makefile to the workspace
cp SAR-Pattern-Validation/osparc_makefile/Makefile . -
Continue with the maintenance steps below.
From the workspace directory in the terminal, run:
make setupThis single command will:
- Pull the latest code from the repository (
git pull) - Install
git-lfsif it is not already available (viawget, no root required) - Run
git lfs pullto download all large data files - Copy
voila.ipynbfrom the repository into the workspace root, where Voila requires it to be
To test the tool, open voila.ipynb in the workspace, run all cells and go through the workflow.
Important: The tool creates folders (
images/,system_state/,uploaded_data/) in the workspace during a run. These must be deleted before saving the template — otherwise they will be visible to every user who instantiates a new instance from it.
After testing, clean up with:
make cleanThis removes images/, system_state/, and uploaded_data/ from the workspace.
- Matthew Morvan
- Javier Ordonez -- Maintainer
- Melanie Steiner
- Mark Douglas -- Project Owner
Contact: (last-name)@itis.swiss