Skip to content

feat: make RandomRedistributeSegGPU's bump-width floor configurable - #149

Open
Hendrik-code wants to merge 1 commit into
mainfrom
hm/redistribute-std-floor
Open

Hendrik-code wants to merge 1 commit into
mainfrom
hm/redistribute-std-floor

Conversation

@Hendrik-code

Copy link
Copy Markdown
Collaborator

What

RandomRedistributeSegGPU takes min_redist_std (default 0.01, the hardcoded value it replaces): the floor on each label's Gaussian bump width, in the [0, 1] min-max units the remap is built in.

Why

The remap adds a signed Gaussian bump per label at that label's mean intensity, then rescales the sum to a peak-to-peak of 2. A bump of width s, rescaled that way, has a slope of about 1.2 / s. At s = 0.01 a thin band of intensities swings by more than the whole input range, so voxel noise inside that band comes out as salt-and-pepper.

Measured on an intensity ramp with the floor binding (voxel-random labels, std_noise_range=(0, 0)), mean of the maximum slope over 20 seeds:

floor 0.01 0.05 0.1
max slope (mean) 123 26 13
1 + 1.2 / floor 121 25 13

On real SpineGAN MR/CT patches, the high-frequency share of the image (std of what a σ=1 blur removes ÷ std) at least doubled in 24% of Redistribute applications, and in 47% when it ran after SynthSeg. It is the most frequent TA in the paper config (p: 0.4).

Behaviour

Default unchanged (tested: bit-identical with and without the key at 0.01). A non-positive floor is refused. all_augmentations.json regenerated.

Tests

unit_tests/test_redistribute_std_floor.py:

  • the measured slope follows 1 + 1.2 / floor within ×0.5 to ×1.5 at three floors;
  • the default is the historical floor;
  • a non-positive floor is refused;
  • the registry accepts the key.

Full suite: 477 passed, 13 skipped. mypy smauglab/ clean, pre-commit passes.

🤖 Generated with Claude Code

The remap adds a signed Gaussian bump per label at that label's mean
intensity and rescales the sum to a peak-to-peak of 2 in the [0, 1] min-max
units it works in. Each bump's width is floored at a hardcoded 0.01. A bump
of width s rescaled that way has a slope of about 1.2/s, so at the floor a
thin band of intensities swings by more than the whole input range and voxel
noise inside the band comes out as salt-and-pepper. Measured on a ramp with
the floor binding: maximum slope 123 / 26 / 13 at floors 0.01 / 0.05 / 0.1.
On real spine patches the high-frequency share of the image at least
doubled in 24% of applications.

`min_redist_std` exposes the floor. Default 0.01 is the historical value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant