Recent posts

#31
Getting Started / Re: Building with OpenGL on Wi...
Last post by didier.benoit - Nov 12, 2025, 11:12 AM
Hi,

To use GLEW and GLM with GGEMS, please follow these steps:

- GLEW:
You simply need to install the official Windows binary from the GLEW website:
https://glew.sourceforge.net/
Direct download link: https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0-win32.zip/download
Once extracted and installed (typically under "C:/Program Files (x86)"), GLEW will be automatically detected by GGEMS during configuration, thanks to the FIND_PACKAGE(GLEW REQUIRED) command in CMake.
No manual CMake build of GLEW is needed on Windows.

- GLM:
You can install GLM by visiting the official repository:
https://github.com/g-truc/glm
Simply follow the installation recommendations provided there. GLM is a header-only library, so you usually just need to extract it and make sure its include path is visible to CMake.

Hope this helps and makes the setup smoother!
#32
Output Data / Re: CBCT simulation output (en...
Last post by mwj12 - Nov 06, 2025, 11:02 PM
ChatGPT suggests that one could spoof energy-integrated output by expressing the x-ray source as a weighted superposition of N separate mono-energetic x-ray sources, as below. I wonder if anyone can confirm this would work.
system = GGEMSCTSystem()
for E, w in zip(E_list, w_list):
    s = GGEMSPrimarySource()
    s.SetMonoEnergy(E)
    s.SetFluenceWeight(w)
    system.AddSource(s)
system.Run()
#33
Getting Started / Re: Building with OpenGL on Wi...
Last post by mwj12 - Nov 06, 2025, 12:32 PM
Thanks, GLFW seems to have installed successfully.

I would indeed be grateful for similar instructions for GLEW and GLM. In particular, the GLEW repo referenced in the documentation
https://github.com/nigels-com/glew
does not appear to be CMake-friendly:

C:\Users\MWJ12\Downloads\glew-master\glew-master>cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:/Program Files (x86)/GLEW"
CMake Error: The source directory "C:/Users/MWJ12/Downloads/glew-master/glew-master" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
#34
Output Data / Re: CBCT simulation output (en...
Last post by mwj12 - Nov 05, 2025, 08:45 PM
I see. Well, I really do need energy-integrating output. If I wished to create a new CT system class  GGEMSCTSystem_Integrating(), would you be able to point me to the files I need to modify? I would be willing to take on the coding myself, and to donate it to the repo, if there were any interest in including it. 
#35
Output Data / Re: Multiple detectors
Last post by mwj12 - Nov 05, 2025, 08:36 PM
Quote from: didier.benoit on Nov 05, 2025, 04:15 PMHi, if you want to build a multi-layer setup, then yes — you need to create 4 navigators (GGEMSCTSystem) and place them next to each other. You will then get 4 projection output files. Just be careful with navigator overlaps, but it should work.

OK, thanks. But I find it interesting that you seem to say above that GGEMSCTSystem objects can be considered navigators. The documentation section on navigators only mentions GGEMSVoxelizedPhantom and GGEMSMeshedPhantom. You are saying that GGEMSCTSystem produces a 3rd navigator type?

If so, I wonder if one can make an "output-less" GGEMSCTSystem as a simple way of implementing a navigator for arbitrary rectangular objects (not necessarily detectors) ? For example, if I wanted to put a copper filtering sheet in front of my detector, to block  high energy photons, could I spoof an appropriate navigator for the sheet as below, where I have deliberately set nothing for sheet.save()?
sheet = GGEMSCTSystem('Copper Sheet')
sheet.set_ct_type('flat')
sheet.set_number_of_modules(1, 1)
sheet.set_number_of_detection_elements(1, 1)
sheet.set_size_of_detection_elements(300, 400, 0.7, 'mm')
sheet.set_material('Cu')
sheet.set_source_isocenter_distance(1000.0, 'mm')
sheet.set_source_detector_distance(1500.0, 'mm')
#sheet.set_threshold(20.0, 'keV')
sheet.set_rotation(0.0, 0.0, -90.0, 'deg')
#sheet.save('data/truebeam_projection')
#sheet.store_scatter(False)
#36
Getting Started / Re: Building with OpenGL on Wi...
Last post by didier.benoit - Nov 05, 2025, 04:55 PM
At the moment CMake cannot find GLFW because it is probably missing the CMake configuration files that GLFW normally installs.
Even if you already have include/ and lib/, CMake requires the following files to be present:

C:\Program Files (x86)\GLFW\lib\cmake\glfw3\
    ├─ glfw3Config.cmake
    ├─ glfw3ConfigVersion.cmake
    └─ glfw3Targets.cmake

If this folder or these files are missing, then find_package(GLFW3) will always fail. GGEMS expects the CMake version of GLFW — not just the binaries.

Install GLFW from source using admin privilege

git clone https://github.com/glfw/glfw.git
cd glfw
cmake -B build -DCMAKE_BUILD_TYPE=Release  -DCMAKE_INSTALL_PREFIX="C:/Program Files (x86)/GLFW"
cmake --build build --config Release
cmake --install build --config Release

Optional: If you want to automatically add GLFW/GLEW to your environment in PowerShell:

function OpenGL-cmd {
    $env:Path    += ";C:\Program Files (x86)\GLFW\bin;C:\Program Files (x86)\GLEW\bin\Release\x64;"
    $env:Include += ";C:\Program Files (x86)\GLFW\include;C:\Program Files (x86)\GLEW\include;"
    $env:Lib     += ";C:\Program Files (x86)\GLFW\lib;C:\Program Files (x86)\GLEW\lib\Release\x64;"
}
Set-Alias -Name opengl -Value OpenGL-cmd

Then just type "opengl" in the terminal before building GGEMS. Let me know if you want the same instructions for GLEW or GLM.
#37
No, these are not navigators. I created this tool to automatically generate test volumes, which are then used as voxelised navigators. It's mainly to create phantoms quickly. In the examples, you'll see how I use them.
#38
Output Data / Re: CBCT simulation output (en...
Last post by didier.benoit - Nov 05, 2025, 04:21 PM
There is no energy integration for CT in GGEMS. We only implemented the CT detector as a photon-counting detector, so the output is always just the number of hits (for both the final image and the scatter). It's not really a realistic CT model.
I'm not a CT specialist, but yes, I believe real CT scanners do use energy integration. So in GGEMS you're already working in photon-counting mode.
#39
Output Data / Re: Multiple detectors
Last post by didier.benoit - Nov 05, 2025, 04:15 PM
Hi, if you want to build a multi-layer setup, then yes — you need to create 4 navigators (GGEMSCTSystem) and place them next to each other. You will then get 4 projection output files. Just be careful with navigator overlaps, but it should work.
#40
Getting Started / Building with OpenGL on Window...
Last post by mwj12 - Nov 05, 2025, 01:20 AM
I am trying to build with opengl=ON in Windows 11, but am getting the errors below. I have no problems with opengl=OFF.

C:\GGEMS\ggems>python setup.py build_ext --opengl=ON install --user
running build_ext
cmake C:\GGEMS\ggems -DCMAKE_BUILD_TYPE=Release -DOPENGL_VISUALIZATION=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=C:\GGEMS\ggems\build\lib.win-amd64-cpython-311
-- CUDA Toolkit: TRUE
-- CUDA Toolkit VERSION: 12.8.61
-- CUDA Toolkit INCLUDE DIRS: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8/include
-- CUDA Toolkit LIBRARY DIR: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.8/lib/x64
CMake Error at C:/Program Files/CMake/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake:290 (message):
  Could NOT find GLFW3 (missing: GLFW3_LIBRARY)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake:654 (_FPHSA_FAILURE_MESSAGE)
  cmake-config/FindGLFW3.cmake:49 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:101 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
error: command 'C:\\Program Files\\CMake\\bin\\cmake.EXE' failed with exit code 1


The GGEMS v1.3 documentation instructs that GLFW should be installed in C:/Program Files (x86). I interpret this to mean there should be a folder C:\Program Files (x86)\GLFW that looks like below. Does it look right?

C:\GGEMS\ggems>dir "C:\Program Files (x86)\GLFW"
 Volume in drive C is OS
 Volume Serial Number is CC8D-AE76

 Directory of C:\Program Files (x86)\GLFW

11/04/2025  07:07 PM    <DIR>          .
11/04/2025  07:05 PM    <DIR>          ..
11/04/2025  05:36 PM    <DIR>          docs
11/04/2025  05:36 PM    <DIR>          include
11/04/2025  05:36 PM    <DIR>          lib-mingw-w64
11/04/2025  05:36 PM    <DIR>          lib-static-ucrt
11/04/2025  05:36 PM    <DIR>          lib-vc2013
11/04/2025  05:36 PM    <DIR>          lib-vc2015
11/04/2025  05:36 PM    <DIR>          lib-vc2017
11/04/2025  05:36 PM    <DIR>          lib-vc2019
11/04/2025  05:36 PM    <DIR>          lib-vc2022
11/04/2025  05:25 PM               904 LICENSE.md
11/04/2025  05:25 PM             2,557 README.md
               2 File(s)          3,461 bytes
              11 Dir(s)  367,315,611,648 bytes free