Skip to content
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

Update egs_view layout #427

Merged
merged 14 commits into from
Aug 23, 2018
Merged

Update egs_view layout #427

merged 14 commits into from
Aug 23, 2018

Conversation

rtownson
Copy link
Collaborator

@rtownson rtownson commented Apr 17, 2018

New egs_view layout, settings file, dose viewing and more..

  • Added the ability to save & load a configuration file for egs_view. This includes saving the current look orientation, window size, track options, clipping planes, etc. You can load the config file from the GUI, or pass it as an argument (with or without ptracks file argument). E.g.

egs_view myInput.egsinp myInput.egsview

  • Fixed various segmentation faults that occurred when reloading files. This includes a fix to clearGeometries() in egs_base_geometry so that composite geometries actually get cleaned up. Added an option to load a new input file.

  • Changed the layout - now there are tabs to divide sections, and the more commonly used options are together. Also, clipping planes are more intuitive! The key-bindings can be found in the Camera tab, and there might be some there you didn't know about (plus a new double click functionality).

  • Zooming has been modified - at higher zoom levels it switches to scaling with a power-law to slow it down (let me know if you don't like it and I could make it optional).

  • Added region-by-region visibility, but only for geometries with <=1000 regions (for performance). Added color controls in the Color tab of backgrounds, tracks, etc. Also, you can now control the display of vacuum regions.

  • The coordinate on the first surface hit by your mouse is now displayed in the viewer when region display is turned on.

  • Fixed a number of display bugs, like the axis flipping direction when the geometry was not near the origin. Added more hunting for an initial point inside the geometry so that it's less likely to crash when not near the origin or windowed properly.

  • Added dose viewing (3ddose files). Replace dosxyz_show by loading the egsphant in an XYZ geometry and including an ausgab object for dose scoring that points to your 3ddose file. You can use any XYZ geometry. For speed, the dose is stored in an unordered_map, which requires c++11, so this was added as a compile flag since qt4 doesn't enable that compatibility by default. 3ddose example for egsphant files:

  :start geometry:
        name = my_phant
        library  = egs_ndgeometry
        type = EGS_XYZGeometry
        egsphant file = slice_files.egsphant
        ct ramp = 5MeV.ramp # this requirement will be removed in future PR
  :stop geometry:
  simulation geometry = my_phant
:stop geometry definition:
:start ausgab object definition:
  :start ausgab object:
        library = egs_dose_scoring
        name = example
        medium dose = no
        region dose = no
        :start output dose file:
            geometry name = my_phant
            file type = 3ddose
        :stop output dose file:
  :stop ausgab object:
  • Added the ability to select the geometry that is being viewed. This includes geometries that are automatically generated, likes planes for an ND geometry, which may have no visual representation but allow for region analysis.

  • Added track range selection.
    egs_view1
    egs_view2
    egs_view3
    egs_view4
    egs_view5

@mchamberland
Copy link
Contributor

No comments other than thank you and please hurry completing this PR! The load/reload fixes and save/load configurations will be great.

@rtownson
Copy link
Collaborator Author

It's functional if you want to start using it (and you have Qt) - I'm just thinking about adding more features :)

@victorMalkov
Copy link
Contributor

Looks great, the saving feature will be really good! I guess the options to align with either the x,y, or z axes is still there (probably hidden in the camera tab)? One thought, and I am not sure how many people would find it useful, but maybe it would be possible to have a scale along the axes or else where as an option?

@rtownson
Copy link
Collaborator Author

Thanks Victor! Yes I'm thinking about ways to add a grid or measurement tools.

@mainegra
Copy link
Contributor

Amazing job Reid! It was badly needed!

@mchamberland
Copy link
Contributor

mchamberland commented Apr 20, 2018

The clipping plane checkbox column doesn't quite fit in the window on macOS and requires the user to scroll horizontally in the clipping plane box. Any way to increase the size of the window? Also, how about making the entire egs_view control window re-sizable? Too tricky?

egs_view_mac

@rtownson
Copy link
Collaborator Author

Commit 1598570 fixed the OS X layout, some other issues and added region visibility. I tried to get window resizing to work but it is tricky - no luck yet.

@victorMalkov
Copy link
Contributor

Hey Reid, the changes look awesome. Would it be possible to put in an option to select the number of particle tracks that you want to be displayed. I know that sometimes I may be viewing tracks and there could just be an overwhelming amount of photons (I still want to be able to see some) and very few electrons. Just a thought.

Also, I guess it won't be an issue if there are thousand of regions for the regions tab?

@mchamberland
Copy link
Contributor

Things are looking really good, @rtownson !

@victorMalkov The regions tab gets greyed out when there are too many regions. I don't know how many is too many, though!

@mchamberland
Copy link
Contributor

mchamberland commented Jun 18, 2018

@rtownson On Linux with gcc 4.4.7, the following header is required in viewcontrol.cpp:

#include <algorithm>

Also, older versions of Qt4 (< 4.7 or so) throw the following during compilation:

main.cpp:128: error: ‘Monospace’ is not a member of ‘QFont’

I think the best solution is for the user to upgrade their version of Qt... which I'm trying right now. I'll report back if I get more errors after upgrading.

@mchamberland
Copy link
Contributor

Disregard the 'Monospace' error. I was mis-matching Qt versions by mistake.

@mchamberland
Copy link
Contributor

Actually.... it turns out I was correct the first time: the 'Monospace' StyleHint is not available from QFont in Qt 4.6. But it's there in 4.7 and 4.8. At least, it is now documented here!

@mchamberland
Copy link
Contributor

Have you tested on Qt4? The buttons (load, save, etc.) don't show up for me, but I'm on Qt4.6 (RedHat Enterprise Linux 6.4, so all the dev tools are a little dated...).

@rtownson
Copy link
Collaborator Author

@mchamberland I haven't updated the screenshots but now those buttons are in the new File menu. Does that work for you? Thanks for reporting the font error I can add a version check.

@mchamberland
Copy link
Contributor

@rtownson I totally missed the File menu. Yep, that works. Thanks!

Copy link
Contributor

@mainegra mainegra left a comment

Choose a reason for hiding this comment

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

Awesome!

@blakewalters
Copy link
Contributor

Very very nice, @rtownson! Love being able to see the dose results. I know it wouldn't add anything quantitative, but might a future version have an option to display isodose lines as well?

@rtownson
Copy link
Collaborator Author

@blakewalters I hope to add isodose lines in the future, just haven't put the time into it yet.

Add the ability to save and load egs_view configurations, including
material colors, clipping planes, view orientation, etc. The
configuration file can be passed as an argument or loaded in the gui.

Change the layout of the viewer to hide away options that are not used
as often. Tabs have been added to support further development.
Add a new tab to egs_view to show or hide specific regions in the
viewer. The tab is disabled for geometries with >1000 regions for
performance reasons.

Fix the gui display settings to look the same on macOS and Windows.
Add a new tab in egs_view to control various display colors. Also remove
the 'other' particle type controls since it does nothing.

Change the file opening dialogs to default to the same directory as the
input file.
Add control of the vacuum color and transparency in egs_view. Previously
the vacuum regions were always transparent, but now they can be shown.
Add hit coordinate display when the user left clicks on a surface. Add a
double click function to set the rotation point to the first hit on the
surface. Add zoom scaling to follow a power function at small distances.

Also fix a couple minor compiler warnings.
Add camera position controls, and enforce the rotation point to be
inside the geometry. Add additional hunting for an initial point inside
the geometry so that geometries far from the origin still have a chance
of being found.

Fix a bug where the axis flipped direction when the geometry was not
near the origin.

Improve the region list display and the scaling that occurs with window
resizing.

Fix the clearGeometries() function in egs_base_geometry so that it
removes composite geometries properly. This fixes a crash that occurred
when reloading inputs.

Add a QT version check before requesting a monospace font style hint.
Add the feature to load dose distributions in egs_view. Currently only
3ddose files are supported. In the input file, use an egs_dose_scoring
ausgab object to output the dose file. Then egs_view reads in any dose
files referred to in the ausgab objects. This required adding a new
function to egs_dose_scoring to get the dose filename.

For speed, dose distributions are loaded as unordered_maps. This
requires c++11, so that has been added as a compile flag in view.pro.

Fix the geometry memory cleanup routines in egs_base_geometry.cpp. The
reloading functionality in egs_view is now more robust.

Add font size, window positions and window sizes to the settings file.
Add the ability to change the simulation geometry being viewed within
egs_view. Also add track range selection. To do this it was necessary to
add two new functions in egs_base_geometry to get the geometry list and
the number of geometries in it.

Fix some memory leaks.
@ftessier ftessier merged commit 459d38f into develop Aug 23, 2018
@ftessier ftessier deleted the feature-egs-view-updates branch August 23, 2018 21:31
rtownson added a commit that referenced this pull request Jan 10, 2020
Fix memory leaks that lead to crashes in Windows when loading tracks in
egs_view. These bugs were added in PR #427.
ftessier pushed a commit that referenced this pull request Jan 13, 2020
Fix memory leaks that lead to crashes in Windows when loading tracks in
egs_view. These bugs were added in #427.
ftessier pushed a commit that referenced this pull request Jan 13, 2020
Fix memory leaks that lead to crashes in Windows when loading tracks in
egs_view. These bugs were added in #427.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants