Repository navigation
2026.1 Drifting offset correction
StitchIt release notes: 28/09/2026
Changes since the previous master release (07/09/2026).
Section-specific offset subtraction (new, off by default)
StitchIt subtracts the offset (baseline) from each tile as it is loaded.
Until now a single offset was used for the whole acquisition.
We have found that most ThorLabs SiPMs exhibit pronounced baseline drift over the course of a BrainSaw run, so a single offset leaves the background (non-brain) area brighter or darker in some sections than others.
You can now subtract a per-section offset instead.
Two new settings are available under [tile] in your INI file:
sectionSpecificOffset=0
sectionSpecificSmoothing=5
sectionSpecificOffset: set to 1 to enable. Leave at 0 unless you know your detector drifts. For stable detectors it only adds noise.sectionSpecificSmoothing: width, in sections, of the running mean applied to the per-section offsets.
This only works with offsetType=offsetDimmestGMM (the default).
With other offset types the setting is ignored and the single pooled offset is used.
Existing INI files do not need editing: missing fields are added with default values the next time the INI file is read.
How it works
- The offset file (
rawData/stitchitPreProcessingFiles/offset_chN.mat) now also containsoffset.offsetDimmestGMM_allSections. This has fieldssections(section numbers) andvalues(raw, unsmoothed offset per section). Plotvaluesto see whether your detector drifts. - Sections with a missing
tileStats.matare filled by linear interpolation. - Illumination correction always uses the single pooled offset, even with
sectionSpecificOffset=1. The average images are pooled across all sections, so a section-specific offset there would produce bright tile edges.
Trying it on existing data
- Set
sectionSpecificOffset=1in the INI file in the sample directory. - Re-stitch with
stitchAllChannels. Cached offset files are deleted automatically (see below).
Cached offsets are deleted before stitching
stitchAllChannels now always deletes offset_ch*.mat before stitching, so offsets are recalculated from every section on disk.
Previously this only happened when the average images were rebuilt.
This matters for section-specific offsets, as a cache made during acquisition will lack the final sections.
There is no action needed.