This page is the file specs/modules/mmr.md of the spam-gui repository, shown as HTML.

Multimodal registration: specification

Code: src/spam_gui/modules/mmr.py (planned: src/spam_gui/modules/mmr/) · Tests: tests/gui/workflow.py (planned: tests/gui/modules/mmr.py), tests/test_multimodalSteps.py · Status: done; the reference implementation of SPEC.md

1. Purpose

2. Steps

# Title What the user does there Sub-panes ready() message(s) Results (fingerprint)
1 Load images gives the two images, chooses a binning, loads them, ticks the results of another binning to use 1. Original images (full resolution), 2. Binning to work at « Load the two images first: give their paths, choose the binning, then « Load the images at binning … ». » the images and binning in use
2 Eye registration moves image 1 by hand until it matches image 2 — (transformation grid, then « Pairs of points ») — Φ of the eye registration
3 Crop chooses the region for the joint histogram (and, by default, the registration) — « The crop (for a cylinder, the box around it in the images) must be at least 16 voxels in each direction. » the box (and cylinder)
4 Joint histogram chooses the grey levels and bins, computes the histogram, ticks its peaks 1. Grey level mapping, 2. Bin and peak selection, 3. Joint histogram and peak selection « Compute the joint histogram first (« Compute histogram », in 2). » · « The grey levels (1) or the bins (2) changed since the histogram was computed: press « Compute histogram » (2). » · « Tick at least one peak (a phase of the material), in the table or on the histogram. » · « The fit of peak N has no maximum: change its fit radius or untick it. » grey limits, bins, Gaussians
5 Phase diagram chooses the distance and sigma — « Compute the phase diagram first. » · « No bin is given to a phase: increase sigma. » sigma, distance
6 MMR registration sets the options, runs the registration, applies and saves its result — (options, log, result, « Save ») — —
Summary reads the registrations of the session — (four boxes) — (anytime) —

1. Load images

2. Eye registration

3. Crop

4. Joint histogram

5. Phase diagram

6. MMR registration

« Current Phi (applied to image 1) », shown whatever the step: « Initial » (image 1 as loaded), « Eye » (the eye registration's Φ), « MMR » (the MMR registration's Φ); where it comes from (with the binning it was obtained at); the matrix (Φ = ⎡…⎤); translation, rotation, zoom. Collapsed: only its three buttons. Always the height it has with an MMR Φ.

Summary (anytime)

Four boxes: « Initial images », « Binnings registered », « Transformation, for the original images », « Accuracy gained at finer binnings » (how much each registration moved image 1 from the one before, over the region registered).

3. State

MMRState (the module's makeState):

Fields Set by Read by
im1, im2, names, originalNames, paths, originalDtypes, binning, originalShape, imagesKey, sourceKey 1 all
Phi, PhiSource (initial, eye, registration), PhiApplied 2, 6, footer the windows, 4, 6
PhiEye, PhiEyeBinning 2 4, footer
PhiMMR, PhiMMRBinning, mmrSummary, mmrDetails 6 footer, Summary
cropStart, cropStop, cropCylinder; movedCrop, movedCropKey (image 1 moved, on the crop only) 3; 4 4, 6
greyLimits, greyLimitsDefault, BINS, hist, gaussianParameters, fitRadii, peakSearch, histPhi, histPhiText 4 5, 6
phase, sigma, distanceType, coverage, fullCoverage 5 6
result, PhiFinal 6 6, Summary

The module also keeps the pairs of points, the layers of the two images, image 1 moved by Φ (a MovedVolume), the phase layers, and the results at each binning (results: (names of the images, binning) → results).

Several binnings: the results of each binning are kept for the session and restored when it is loaded again. Carried to another binning (converted), when ticked in step 1: the eye registration's Φ, the crop, the MMR Φ. Made again at each binning: the joint histogram and the phase diagram, because their peaks change with the binning. Resetting step 6 keeps PhiMMR (still a registration of these images) until other images are used.

4. Large images and memory

5. Decisions

6. Tests

7. Open questions