Skip to content

Add draw-to-create shapes + freehand paint to the Inverse FFT tab#11

Merged
jacobson30-bot merged 1 commit into
mainfrom
fft-inverse-draw-paint
Jun 5, 2026
Merged

Add draw-to-create shapes + freehand paint to the Inverse FFT tab#11
jacobson30-bot merged 1 commit into
mainfrom
fft-inverse-draw-paint

Conversation

@jacobson30-bot
Copy link
Copy Markdown
Contributor

Summary

Replaces the Inverse FFT tab's "Add circle / Add ellipse" buttons with three draw-on-canvas tools:

  • Ellipse and Rectangle — drag on the FFT to draw; hold Shift for a circle/square (matching normal ROI behaviour). Drawn shapes keep move/resize handles for fine-tuning.
  • Paint — freehand brush (brush-size spinbox + color picker) that highlights an irregular Fourier region as a colored transparent overlay.

All three grab their conjugate partner (point reflection through DC) so the reconstruction stays real, and honour the existing Mask controls (Remove/Keep, Conjugate symmetry, Soft edge).

Changes

  • inverse_fft.pyFourierRect/FourierStrokes dataclasses, generalized fourier_region_mask (signed-distance rect, disc-union strokes, soft edges), fourier_region_from_dict; fourier_ellipse_mask kept as a back-compat wrapper.
  • fft_selection.py — draw-to-create flow with Shift constraint, rectangle patches, q-space-aligned AxesImage paint overlay, handle editing, to_regions().
  • fft_viewer_reconstruct_mixin.py — checkable tool buttons (reusing ellipse.png/rectangle.png/freehand.png), brush size + color controls, region-based mask wiring, JSON-safe op params.
  • state.py — replay of all region kinds; paint persists as a compact q-space stroke list. Back-compatible with legacy ellipse-only saved states.

Testing

  • Full suite: 2089 passed, 3 skipped.
  • Extended test_inverse_fft.py (rect/strokes/soft-edge/conjugate/region_from_dict/mixed) and rewrote test_fft_selection_gui.py for the draw/paint interaction.
  • Physics review confirmed mask(-q)=mask(q) holds for all region kinds; state replay matches the in-viewer preview exactly.

🤖 Generated with Claude Code

Replace the Inverse FFT tab's "Add circle/ellipse" buttons with three
draw-on-canvas tools: Ellipse and Rectangle (drag to draw, Shift = circle/
square, with editable move/resize handles) and a freehand Paint brush that
highlights an irregular Fourier region as a colored transparent overlay.

All kinds grab their conjugate partner (point reflection through DC) so the
reconstruction stays real, and honour the existing Mask controls (Remove/Keep,
Conjugate symmetry, Soft edge).

- inverse_fft.py: FourierRect/FourierStrokes + generalized fourier_region_mask
  (signed-distance rect, disc-union strokes, soft edges) + fourier_region_from_dict;
  fourier_ellipse_mask kept as a back-compat wrapper.
- fft_selection.py: draw-to-create flow with Shift constraint, rectangle patches,
  q-space-aligned AxesImage paint overlay, handle editing, to_regions().
- fft_viewer_reconstruct_mixin.py: checkable tool buttons (ellipse/rectangle/
  freehand icons), brush size + color controls, region-based mask wiring,
  JSON-safe op params.
- state.py: replay all region kinds; paint persists as a compact q-space stroke
  list. Back-compatible with legacy ellipse-only saved states.

Tests: extend test_inverse_fft (rect/strokes/soft-edge/conjugate/region_from_dict/
mixed), rewrite test_fft_selection_gui for the draw/paint interaction. Full
suite: 2089 passed, 3 skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jacobson30-bot jacobson30-bot merged commit ed99fd3 into main Jun 5, 2026
2 of 3 checks passed
@jacobson30-bot jacobson30-bot deleted the fft-inverse-draw-paint branch June 5, 2026 07:11
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