Skip to content

feat(eventviewer): add EventViewer.exportImage() PNG/JPEG export (#321)#333

Merged
HanSur94 merged 5 commits into
mainfrom
claude/feature-321-eventviewer-exportimage
Jul 8, 2026
Merged

feat(eventviewer): add EventViewer.exportImage() PNG/JPEG export (#321)#333
HanSur94 merged 5 commits into
mainfrom
claude/feature-321-eventviewer-exportimage

Conversation

@HanSur94

Copy link
Copy Markdown
Owner

What was built

Adds a new additive public method exportImage(obj, filepath, format) to EventViewer (libs/EventDetection/EventViewer.m), so the interactive event-analysis figure can be saved straight to a report image — closing the last figure-producing surface in FastSense without a save path.

v = EventViewer(events);
v.exportImage('events.png');          % format inferred from extension
v.exportImage('events.png', 'png');
v.exportImage('events.jpg', 'jpeg');  % 'jpg' alias accepted

Captures obj.hFigure at 150 DPI; PNG default, JPEG by extension/argument.

Design — port, don't reinvent: the method ports DashboardEngine.exportImage's hardened cross-platform branch verbatim (exportapp on MATLAB R2024a+ / exportgraphics / getframe+imwrite fallback; print()+hidden-stub-axes on Octave), retargeting obj.hFigure and swapping the three error IDs to the EventViewer: namespace. No DashboardEngine: IDs remain in the file.

Scope kept minimal: the method is the deliverable; the optional toolbar "Export Image" button is explicitly a follow-on in the issue and is not included — so the change touches one method plus its tests, with no toolbar-layout edits.

Backward-compatible & additive only: one new public method; no signature, Event/EventStore/DashboardWidget/Tag contract, or serialization change (EventViewer is not serialized). Toolbox-free, pure MATLAB/Octave, no MEX.

Error IDs: EventViewer:notRendered (figure empty/closed), EventViewer:unknownImageFormat, EventViewer:imageWriteFailed.

How it was verified

  • TestEventViewerExtras: 16/16 pass in the live MATLAB session (4 new cases: PNG round-trip exists+non-empty, JPEG via explicit format + extension inference, unknownImageFormat error, notRendered-after-close error — all reusing the existing makeFixtureEvents/safeClose/safeDelete fixtures with tempname+addTeardown).
  • TestEventViewer: 7/7 pass — no regression in the base suite.
  • Real export round-trip (live): valid 1200×700 PNG (27.5 KB, confirmed via imfinfo) + JPEG via extension inference; both error IDs fire correctly.
  • MISS_HIT mh_style + mh_lint: everything seems fine on both changed files.

Closes #321


AI-built via /feature-build — needs human review before merge.

HanSur94 added 3 commits June 29, 2026 21:33
…dEngine

- Public exportImage(obj, filepath, format) method on EventViewer
- Format inference: .jpg/.jpeg extension -> jpeg, else png
- not-rendered guard: EventViewer:notRendered when hFigure invalid
- Format switch: EventViewer:unknownImageFormat for unsupported formats
- 3-tier MATLAB path: exportapp (R2024a+) / exportgraphics / getframe+imwrite
- Octave print() path with stub-axes insertion when no top-level axes
- Visible toggle for headless R2020b compatibility
- Cleanup of stub axes + visibility state in both success and catch paths
- Updated class-header method list with viewer.exportImage usage line
- testExportImagePngRoundtrip: writes non-empty PNG via exportImage
- testExportImageJpegRoundtrip: explicit 'jpeg' format + .jpeg extension inference
- testExportImageUnknownFormatErrors: verifies EventViewer:unknownImageFormat for gif
- testExportImageNotRenderedAfterClose: verifies EventViewer:notRendered after close(fig)
- Reuses existing makeFixtureEvents/safeClose/safeDelete helpers + tempname + addTeardown
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.31148% with 48 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
libs/EventDetection/EventViewer.m 21.31% 48 Missing ⚠️

📢 Thoughts on this report? Let us know!

HanSur94 added 2 commits July 8, 2026 21:55
…rtWorks guard)

Headless CI MATLAB raises 'Specified handle is not valid for export' on
uicontrol figures — same environment guard as
TestDashboardToolbarImageExport.assumeExportWorks. Error-path tests stay
active headless.
…entviewer-exportimage

# Conflicts:
#	.planning/STATE.md
@HanSur94
HanSur94 marked this pull request as ready for review July 8, 2026 20:25
@HanSur94
HanSur94 merged commit 799b1e6 into main Jul 8, 2026
19 of 22 checks passed
@HanSur94
HanSur94 deleted the claude/feature-321-eventviewer-exportimage branch July 8, 2026 20:28

HanSur94 commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

Wiki documentation updated for EventViewer.exportImage():


Generated by Claude Code

HanSur94 added a commit that referenced this pull request Jul 9, 2026
#308 #326 #312 #316 #328)

Adds getStats (keystone), resampleUniform, derivative, movingStat, exceedance, and crossings to the Tag base class — toolbox-free, Octave-safe, additive. Verified: 84 headless assertions + full MATLAB/Octave CI green (codecov/patch advisory only; repo unprotected). #327 and #321 shipped separately on main (PRs #331/#333).
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.

EventViewer: add exportImage(path) to save the timeline figure as PNG/JPEG (parity with DashboardEngine/DetachedMirror)

1 participant