Skip to content

Feat: Added Export Particles Button - #577

Merged
twagner9 merged 2 commits into
masterfrom
ParticlePickingExport
Jun 16, 2026
Merged

Feat: Added Export Particles Button#577
twagner9 merged 2 commits into
masterfrom
ParticlePickingExport

Conversation

@rdsza

@rdsza rdsza commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

Description

Added Dialog box for Exporting Particle Picking Results by Job ID and if user created any custom groups. The filename to be saved gets auto poopulated to the Job ID or New Group name. Button is placed in Particle Picking Assets Panel. fixed Import Particles to create a new group by default once Particles are successfully imported.

Summary

  1. Added an Export button to the Particle Position Asset Panel that opens a job-scoped export dialog
  2. Added MyPickingJobExportDialog — a new dialog for selecting which picking job or user group to export, with auto-populated default filenames
  3. Fixed Import to create a new named group (derived from the filename) rather than adding all imported particles only to the "All Positions" group
  4. Removed a stale debug print (wxPrintf) from the import path
  5. Updated wxFormBuilder .fbp files to keep them in sync with all hand-edited generated code

Details

  1. Export button moved to Asset Panel — The Export button was originally prototyped on the per-image PickingResultsDisplayPanel, which meant a separate button appeared for every image in every job. This was the wrong level of granularity. The button is now on AssetPanelParent (hidden by default) and revealed only by MyParticlePositionAssetPanel, matching the scope at which particle positions are managed. The .fbp file (ProjectX_assets.fbp) was updated so future wxFormBuilder regeneration preserves the button.

  2. MyPickingJobExportDialog — A hand-coded wxDialog (no fbp) that populates a wxComboBox with two visually separated sections:

    • Above the dotted line: unique pick_job_id values found in the assets table ("All Jobs", "Job #N", "Manually picked"), each showing particle count
    • Below the dotted line (only shown if user groups exist): named groups created by the user via Import or "New from image group"
    • The separator item is non-selectable; clicking it snaps back to the previous valid selection
    • The wxFileDialog is pre-populated with a sanitized default filename derived from the selection (e.g. particles_job_3.txt, particles_My_Group.txt)
    • Exported coordinates are converted from angstroms to 1-indexed pixel coordinates using the parent image's pixel size and Y dimension, matching the convention used by the existing MyParticlePositionExportDialog
    • Output format: space-separated Image# X Y with a #-prefixed header line so the Import parser skips it cleanly
  3. Import group creation fix — Previously ImportAssetClick called AddAsset() for each parsed line, which only adds particles to group 0 ("All Positions"). After import there was no UI refresh, so the panel did not update until project reload. The fix:

    • Creates a new named group (name taken from the imported filename, without extension) before the parse loop, registering it in both all_groups_list and the database via AddGroupToDatabase
    • Accumulates newly added asset indices during the loop
    • After EndParticlePositionAssetInsert, batch-inserts group membership via InsertArrayofGroupMembersToDatabase
    • If no lines parsed successfully (all errors), cleans up the empty group
    • Calls FillGroupList(), FillContentsList(), DirtyGroups(), and RecalculateAssetBrowser() so the panel updates immediately without a project reload
  4. Debug print removedwxPrintf("Current Line = %s, number_tokens = %li\n", ...) was being called on every non-empty, non-comment line during import, producing verbose stdout output in production builds.

  5. Build systemMyPickingJobExportDialog.h and .cpp added to src/Makefile.am alongside the other export dialog files.

Related Issues/PRs

  • Related to Manual Exporting of particles as explained in the Frequently Asked Questions. (Now automated).#(issue number)

I have rebased my feature branch to be current with the master branch using to minimize conflicts and headaches

  • yes
  • no

Which compilers were tested

  • g++
  • icpc
  • clang
  • other (please specify)

These changes are isolated to the

  • gui
  • core library
  • gpu core library
  • program it modifies

How has the functionality been tested?

Please describe the tests that you ran to verify your changes. Please also note any relevant details for your test configuration.

  • Tested manually from GUI
  • Tested manually from CLI
  • Passed console tests
  • Passed samples functional testing
  • other (please specify)

Checklist:

  • I have not changed anything that did not need to be changed
  • I have performed a self-review of my own code
  • I have commented my code, (w.r.t. why), particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation {Ok to pass for now}
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@rdsza
rdsza requested a review from bHimes April 10, 2026 19:31
@rdsza
rdsza removed the request for review from bHimes June 10, 2026 15:48
rdsza and others added 2 commits June 10, 2026 11:54
- Added Dialog boxex for Exporting Particle Picking Results by Job ID and if user created any custom groups. The filename to be saved gets auto poopulated to the Job ID or New Group name.
Button is placed in Particle Picking Assets Panel.
Tooltip existing in the wxformbuilder did not make it into the auto-generated ProjectX_gui_assets.cpp. Just ran Generate in the formbuilder project to produce this.
@twagner9
twagner9 force-pushed the ParticlePickingExport branch from 72451fa to 47b6b72 Compare June 10, 2026 15:54

@twagner9 twagner9 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the functionality and it looks good.

@twagner9
twagner9 merged commit 455de9a into master Jun 16, 2026
15 of 16 checks passed
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.

2 participants