Skip to content

Windows application + phantom previews - #28

Open
SBugby wants to merge 9 commits into
lborophysics:mainfrom
SBugby:main
Open

Windows application + phantom previews#28
SBugby wants to merge 9 commits into
lborophysics:mainfrom
SBugby:main

Conversation

@SBugby

@SBugby SBugby commented Jul 26, 2026

Copy link
Copy Markdown
  1. Add a Windows application build process including the necessary pathing fixes and license updates.
  2. Allow previewing of loaded phantoms on GUI
  3. Misc minor additions

1. Windows application

New functions

  • build_windows.m: Builds DECTSim as a deployable Windows executable for users who do not have a MATLAB licence.
  • APPLICATION_LICENSE.txt: Defines the licence covering the packaged DECTSim application.
  • NOTICE.txt: Explains the distinction between the licence applied to the packaged application and the licence applied to the source code.
  • docs/source/user_guide/first_run.md: Explains how new users can install and run the deployed application, along with running DECTSim from MATLAB Desktop, or use it through MATLAB Online at a more basic level than the previous description.

New tests

No automated test functions. Windows build has been tested but this needs to be repeated on a system that has not previously had MATLAB installed and functionality retested through app.

Changed code

  • gui/gui.m: Changed image-viewing behaviour to avoid using ImageViewer where it is unavailable in deployed applications.
  • gui/gui.m: Added an About menu to satisfy application licensing and attribution requirements.
  • gui/gui.m: Updated file and resource path handling so the GUI can locate required files in both the source repository and the deployed Windows application.
  • gui/ExampleObjects.m: Updated path handling for compatibility

2. Phantom preview

New functions

  • src/voxels/save_phantom_preview.m: Generates a png preview of the central slice of a voxel phantom. These previews allow the GUI to show the selected phantom rather than always displaying the default Shepp–Logan image.
  • docs/source/dev_guide/save_phantom_preview.rst: Documents the purpose and use of save_phantom_preview.m for developers.
  • docs/source/user_guide/first_run.md: Explains how new users can install and run the deployed application, run DECTSim from MATLAB Desktop, or use it through MATLAB Online.

New tests

No numeric tests needed - visual change only and reverts to previous behaviour if no file present.

Changed code

  • gui/gui.m: Added support for displaying generated phantom preview images. The Shepp–Logan SVG remains the default image, but it is replaced when a preview PNG exists for the selected phantom.
  • docs/source/user_guide/gui.md: Added information explaining phantom preview images and their behaviour in the GUI.

3. Other

New functions

  • .github/ISSUE_TEMPLATE/feature_request.md: Adds a dedicated GitHub issue template for feature requests so proposed enhancements can be separated from bug reports.

Changed code

  • src/compute_sinogram.m: Added detection and warning behaviour for sinograms containing NaN values.

New tests

None - no numeric changes.

SBugby added 8 commits July 26, 2026 09:38
- modifications of pathing to enable this
- build_windows.m - creates a Windows exe for unlicensed use

None

Modified pathing in the following files to work with build_windows.m

- gui/ExampleObjects.m
- gui/gui.m
New Functions & Classes:
- APPLICATION_LICENSE.txt: License for the packaged app distribution
- NOTICE.txt: Explains the difference between application and source code licenses

New Tests:
None

Changed code i.e. bug fixes:
- build_windows.m: Added licenses to build_windows
- gui.m: Added About menu as required by license. Fix for ImageViewer unavailable in deployed mode.
Added an extra 'first_run' document for new users

New Functions & Classes:

- docs/source/user_guide/first_run.md: Describes the install process for deployed app and running in desktop or online MatLab

New Tests:

None

Changed code i.e. bug fixes:

- docs/source/index.rst: Added first_run.md
- gui/gui.m: Minor syntax fix

gui.m: Added About menu as required by license. Fix for ImageViewer unavailable in deployed mode.
New Functions & Classes:

- src/voxels/save_phantom_preview.m: This takes a phantom object input, and generates a png of the central slice
- docs/source/dev_guide/save_phantom_preview.rst: Associated documentation

New Tests:

None

Changed code i.e. bug fixes:

- gui/gui.m: Updated so the Shepp-Logan svhg remains default visualisation, but if a png of the selected phantom exists this is replaced

- docs/source/index.rst: Added save_phantom_preview.rst
- docs/source/user_guide/gui.md: Added info about preview images
- gui/ExampleObjects.m: Now generates preview images for each example
Added template for feature requests to separate these from bugs.

New functions and classes:

.github/ISSUE_TEMPLATE/feature_request.md: Issue template added to request features
New Functions & Classes:

None

New Tests:

None

Changed code i.e. bug fixes:

src/compute_sinogram.m: Produces warning when sinogram contains NaN
build_windows.m: syntax fix

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for packaging DECTSim as a standalone Windows application (including licensing/notice files and pathing changes), and enhances the GUI to display per-phantom preview images (with documentation updates).

Changes:

  • Adds a Windows build/packaging script plus application-specific license/notice content.
  • Adds phantom preview generation (save_phantom_preview) and updates the GUI to display preview PNGs when available.
  • Improves GUI load/save workflows and updates user/developer documentation accordingly.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/voxels/save_phantom_preview.m New helper to generate a central-slice phantom preview PNG (with alpha).
src/compute_sinogram.m Adds NaN detection after sinogram creation.
gui/gui.m Adds phantom preview support, deployed-app image viewing fallback, and an About menu; improves load/save UI flows.
gui/ExampleObjects.m Updates path handling and generates preview PNGs alongside example phantoms.
build_windows.m New script to build/package a Windows standalone application and installer.
APPLICATION_LICENSE.txt Adds application license terms for the deployed build (distinct from source license).
NOTICE.txt Adds notices covering DECTSim + MATLAB Runtime attribution/context.
docs/source/user_guide/first_run.md New first-run guide (Windows app + MATLAB Desktop/Online workflows).
docs/source/user_guide/gui.md Documents phantom preview behavior for custom phantoms.
docs/source/dev_guide/save_phantom_preview.rst Developer documentation for generating phantom preview images.
docs/source/index.rst Adds new user/dev guide pages to the Sphinx toctrees.
.github/ISSUE_TEMPLATE/feature_request.md Adds a feature request issue template.
.gitignore Ignores generated example binaries and MATLAB Compiler build output.
resources/project/...yJ5HhId127bnvMTz_nJJ2d9M4dop.xml Removes a project metadata entry.
resources/project/...yJ5HhId127bnvMTz_nJJ2d9M4dod.xml Removes a project metadata entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gui/gui.m
% Menu selected function: ReconstructionMenu_3, SinogramMenu_3
function OpeninImageViewerMenuSelected(app, event)
show_sinogram = strcmp(event.Source.Text, 'Sinogram');
function OpeninImageViewerMenuSelected(~, ~)
Comment thread build_windows.m
Comment on lines +46 to +57
requiredDataNames = [
"PhantomExample1.mat"
"PhantomExample1.png"
"PhantomExample2.mat"
"PhantomExample1.png"
"PhantomExample3.mat"
"PhantomExample1.png"
"PhantomExample4.mat"
"PhantomExample1.png"
"SourceExample40kvp.mat"
"SourceExample80kvp.mat"
];
Comment thread src/compute_sinogram.m
Comment on lines +171 to +177
%Adding some checks

if any(isnan(sinogram), "all")
error( ...
"DECTSim:InvalidSinogram", ...
"The calculated sinogram contains NaN values.");
end
Comment on lines +1 to +7
Save Phantom Preview
=============

This allows a preview image to be generated when you create a custom phantom. The preview image can then be displayed on the GUI when your phantom is selected.

save_phantom_preview
------------
Comment on lines +27 to +28
Returns

What is DECTSim missing, and why would it be useful.

**Area**
Provided a short indication of where this feature would sit e.g. GUI-image display, simutlation-scatter_correction
Comment on lines +66 to +82
if maximum_value > minimum_value
preview(foreground) = ...
minimum_grey + ...
(maximum_grey - minimum_grey) .* ...
(attenuation_slice(foreground) - minimum_value) ./ ...
(maximum_value - minimum_value);
else
preview(foreground) = (minimum_grey + maximum_grey) / 2;
end
end







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.

3 participants