ir-blob C++ → Python parity checklist
Audit of legacy ir-blob (/legacycode/code/ir-tools/ir-blob.cxx)
mapped to Python in nornir_imageregistration/nornir_imageregistration/blob_filter.py.
1. CLI and pipeline defaults
# |
C++ ( |
Python / buildmanager |
Parity |
|---|---|---|---|
1.1 |
|
Input already at target downsample in pipeline |
OK |
1.2 |
|
|
OK |
1.3 |
|
|
Port (nearest boundary) |
1.4 |
|
|
OK |
1.5 |
|
|
OK |
2. Median prefilter (median(), common.hxx L6127)
# |
C++ |
Python target |
Parity |
|---|---|---|---|
2.1 |
ITK |
|
Port |
2.2 |
Skip when |
Same |
OK |
3. Local variance (calc_variance, ir-blob.cxx L63–149)
# |
C++ |
Python target |
Parity |
|---|---|---|---|
3.1 |
Window width/height |
|
Port |
3.2 |
Mean/variance over mask-true samples only |
Same |
Port |
3.3 |
|
|
Port |
3.4 |
Population variance |
Same |
Port |
4. Blob enhancement (enhance_blobs, L251–420)
# |
C++ |
Python target |
Parity |
|---|---|---|---|
4.1 |
Collect valid variance samples ( |
|
Port |
4.2 |
|
|
Port |
4.3 |
Invalid pixels → mean metric over valid pixels |
Not zero |
Port |
4.4 |
Do not divide by threshold before normalize |
Removed early |
Port |
5. Output normalization (normalize(image,1,1,0,255,mask), common.hxx L6198–6321)
# |
C++ |
Python target |
Parity |
|---|---|---|---|
5.1 |
Masked mean/sigma ( |
|
Port |
5.2 |
|
Same |
Port |
5.3 |
Clip to |
|
Port |
5.4 |
Linear remap global min/max → |
|
Port |
5.5 |
Save 8-bit PNG ( |
|
OK |
6. Golden fixtures
Legacy PNG testdata: /legacycode/code/BuildScript/Test/Data/PlatformRaw/PNG/6872/
Input:
0001_LeveledShadingCorrectedgfp_mosaic_1.pngMask:
0001_LeveledShadingCorrectedgfp_mask_1.pngGolden:
0001_LeveledShadingCorrectedgfp_blob_1.pngParams:
r=3, median=5, max=3(legacy 6872 fixture; BuildScriptChannel.pydefault median is 3)
Tests crop a central 512×512 region for CI speed; full-image optional via env.
7. Cache invalidation (operators)
After parity fix, delete existing Blob filter images or invalidate input checksums before re-running CreateBlobFilter so STOS brute uses new blob PNGs.
Re-run TestIDocBuild from RunCreateBlobFilter onward (or use IDocBuildTestBootstrapDebugging with earlier steps commented out), then compare StosBrute16 overlays before/after.
IDoc pipeline params (from Pipelines.xml): r=9, median=7, max=3.
8. Validation status
Golden regression: legacy 6872 fixture passes at
r=3,median=5,max=3(≤1 DN vs precomputed PNG).IDoc repro snapshot under
TESTOUTPUTPATH/Repros/IDocBuildTestpredates blob generation; full slice-to-slice validation requires re-running bootstrap fromRunCreateBlobFilter.Optional exe parity: configure
NORNIR_LEGACY_IR_BLOB+ fixture paths; thresholds default to MAE ≤ 0.01 and P99 ≤ 1 DN.