Skip to content

Backport S-Rep support updates #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

jcfr
Copy link
Contributor

@jcfr jcfr commented Apr 23, 2025

This PR back-ports a suite of patches from the SlicerSALT fork to ShapePopulationViewer:

  • Full S-Rep support (XML and JSON)
  • Robust spoke and fiducial rendering
  • A custom colormap loader and CLI flags
  • Interactive time-series playback with slider & VCR controls
  • Numerous UI/UX refinements
  • Critical bug fixes (filename display, camera reset, series validation)

Pending

Highlights

1. S-Rep Import & Parsing

  • XML: Parse <upSpoke>, <downSpoke>, <crestSpoke> elements, append into a single vtkPolyData.
  • JSON: Load .srep.json via MRML’s vtkMRMLSRepStorageNode and export using vtkSRepExportPolyDataProperties.
  • CLI: Introduce --srepfiles (-s) flag in the standalone viewer; validate extensions before loading.
  • CSV Loader: Recognize .xml & .srep.json alongside .vtk/.vtp.

2. Spokes & Fiducials Visualization

  • Spoke Geometry: ExtractSpokes() and AttachCellType() produce line meshes with per-point cell-type arrays; automatically compute magnitude scalars for 3-component attributes.
  • Fiducials: Read .fcsv markups, compute point spacing to size spheres, tag each with a “Fiducial Index” scalar for coloring.
  • Filename Fix: Correct m_FileDir/m_FileName assignment so the Qt UI shows the right fiducial filename.

3. Custom Colormap & CLI Enhancements

  • Color Map: Bundle sRepColorMap.spvcm resource; auto-load into the gradient widget on S-Rep import.
  • CLI Flags: Wire up --srepfiles and --fiducialfiles options in ShapePopulationViewer.cxx; enforce file-type checks.

4. UI & Layout Refinements

  • Import Panel: Switch from QHBoxLayout to QVBoxLayout, then to a grid, reorganizing “Add Directory”, “Add VTK/VTP”, “Add S-Rep”, “Add Fiducial” and CSV buttons for clearer grouping.
  • Module Widget: Replace ad-hoc tool-button insertion with named QToolButton widgets (toolButton_Open_*, toolButton_Delete_*), simplifying layout and theming.

5. Time-Series Loading & Playback

  • Dialog: timeSeriesLoaderQT displays CSV tables via vtkDelimitedTextReadervtkQtTableView, emits selected file sequences.
  • Initial Frame: Show only the first mesh; slider / spin-box disabled until load completes.
  • Slider / Spin-Box: Step through frames, enforcing identical sequence lengths; retain attribute & colormap settings on change.
  • VCR Controls: “First”, “Back”, “Play”, “Forward”, “Last” buttons (with embedded SVG icons) and a QTimer for ~200 ms autoplay loops.
  • Camera & Alignment: Automatically reset view each step, preserve user-chosen alignment; re-apply camera on every frame.

6. Bug Fixes

  • Fiducial filename now displays correctly in UI.
  • Slider is disabled/enabled appropriately, resets to zero on new loads.
  • Camera is reset on each time-step change (pushButton_VIEW_reset).
  • CSV loader messages updated to include all supported extensions.

This consolidation brings ShapePopulationViewer on par with the SlicerSALT fork’s advanced S-Rep and time-series capabilities—ready for integration into our mainline.

@jcfr jcfr marked this pull request as draft April 23, 2025 21:05
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