Cannot run CT example!

Dear GGEMS-developers,

I installed the GGEMS on Win10 following the instructions you provided.
I tested the python command (from ggems import *…) and it worked.
But I failed to run the CT_Scanner example, the errors were as follows:

And when I tried on Linux (Ubuntu 18.04), the same error occurred.

GGEMS GGEMSOpenCLManager::DeviceToActivate Activated device: GeForce GTX 1660
GGEMS GGEMSMaterialsDatabaseManager::LoadMaterialsDatabase Loading materials database in GGEMS…
terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1)

Is there any way to figure it out?

Hi,
Could you check your device extension ? You can do that in a python console typing the following commands:
from ggems import *
opencl_manager.print_infos()

In your extensions you should have ‘cl_khr_int64_base_atomics’, but I think you don’t have it on your graphic card.

Recompile GGEMS setting the option DOSIMETRY_DOUBLE_PRECISION to OFF.

Cheers
Didier

Hi,

Thanks a lot! It worked on my win10 system.
But on my Ubuntu18.04 system, I checked my extensions, the’cl_khr_int64_base_atomics’ is already included.
Also, I have recompiled GGEMS with DOSIMETRY_DOUBLE_PRECISION option set to OFF, it does not work, the error remains the same.


ERROR:
GGEMS GGEMSOpenCLManager::DeviceToActivate Activated device: GeForce GTX 1660
GGEMS GGEMSMaterialsDatabaseManager::LoadMaterialsDatabase Loading materials database in GGEMS…
terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1)

Best,
ZQ.W

Hi,

Do you have exactly the same error than previously on your Ubuntu system ? error: must specify '#pragma …". In this case, maybe delete the cmake cache before recompiling.

I don’t understand the exception ‘terminate called after throwing …’. Did you have this output on your Windows system before ?

Best
Didier

Hi Didier,

Thanks for your timely reply!
On my win10, the error “must specify #pragma …” has already been fixed, and GGEMS runs well now.
But on my Ubuntu18.04, the following error occurred when I tried to run the CT example (GGEMS_OpenCL/examples/2_CT_Scanner/ct_scanner.py).

GGEMS GGEMSOpenCLManager::DeviceToActivate Activated device: GeForce GTX 1660
GGEMS GGEMSMaterialsDatabaseManager::LoadMaterialsDatabase Loading materials database in GGEMS…
terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 18446744073709551615) > this->size() (which is 1)

Since the GGEMS on win10 works fine, I’ll stick with it.
Btw, when I run GGEMS using real lung phantom, I found the output was quite different with that of GATE in terms of image quality. Is there any trick to produce realistic projections? Also, I am wondering if the output projection can be saved as .dat file and the phantom can be rotated by a certain angle per second during the projection?

Best,
ZQ.W

What do you mean by quite different ? Do you have an image ?
What do you mean also by realistic projection ? In GGEMS the part not really realistic in the electronic part not simulated, but the physics and navigation in volume is realistic.

The output is only *.mhd but you can use the *.raw file associated with *.mhd header as a *.dat binary file. In GGEMS, you don’t have time parameter, you can only simulate projection by projection and you can rotate your phantom or your detector+source with the command ‘set_rotation’.

Hi Didier,

Here is the output image comparison between GGEMS and gate. I keep the settings of cbct system, source and phantom on both of them as same as possible. Strangely, the projection values generated by GGEMS are very low. Also, I noticed that GGEMS could not recognize the “deformation matrix”, “center rotation”, “anatomical location” in MHD, does this affect the final result?
(from left to right are the result of GGEMS, the spectrum, the result of GATE, the bottom row are the histograms of projections)

Best,
ZQ.W

In MHD header, we don’t use all the tags, this does not affect the result, don’t worry.

For the small values, I’m pretty sure it’s a problem of format. The CT projection in GGEMS is registered in int32, I think your software try to open the file in float32.

Hi Didier,

I have tried to install GGEMS on Linux many times, but the following error always exists. (below is the GPU information)

What can I do to solve this problem?

Hi,
In your python macro, could you set GGEMSVerbosity to 3? Maybe we will have more infos about the problem. It’s the first time I see this error unfortunately.
On your 2080 Ti you don’t have the extension ‘cl_khr_int64_base_atomics’, check you compiled GGEMS in single float precision only. New extensions could come with recent nvidia driver.

Did you add a new material in the material database ? Or maybe check your material file, maybe something is wrong (I don’t think so, it’s working on Windows), or a windows invisible character.

Best
Didier

Hi Didier,

I set GGEMSVERBosity to 3 and the output error has not changed at all. I also recompiled the GGM with DOSIMETRY_DOUBLE_PRECISION set to OFF, but this still doesn’t work. And I did not modify the material database. Any other solutions? (I really need to run GGEMS on Linux).

Btw, I found that when rotating a phantom, the center of rotation is not in the center of the phantom, could you tell me how to align the center of the world coordinate system with the center of the phantom?

Best,
ZQ.W

Ok for GGEMSVerbosity to 3, but I want to figure out the last function GGEMS crashed, is it still LoadMaterialDatabase ? I can’t reproduce your error on my computer. Which version of GCC do you use ?

The rotation is the center of the world (0, 0, 0). And the rotation of phantom is performed before the position (translation). In GGEMS you have to rotate along Z axis in the majority of cases.
phantom.set_rotation(0.0, 0.0, 90.0, ‘deg’)
phantom.set_position(0.0, 0.0, 0.0, ‘mm’)
We considered bed is along Z.

Or you can rotate source + detection, what is more realistic (along Z too)

Best
Didier

Hi Didier,

Yes, the function crashed is LoadMaterialsDatabase. My gcc and g++ version is (Ubuntu 7.5.0-3ubuntu1~16.04) 7.5.0. And cmake version is 3.19.1.

For phantom rotation, you mean that the center of the phantom is aligned with the world (0,0,0) at the beginning? What I want to make sure is that when rotating the phantom along the Z axis, its center will not move along the X or Y axis.

Best
ZQ.W

Hi Didier,

I figured out this crash problem by removing all blank lines in the materials.txt.

Best,
Ziqiao

Hi,

Yes at the beginning the center of phantom is at (0,0,0) in the world, and rotation is (0,0,0) by default. The Z axis is along the bed axis. So when you open your phantom in a viewer, the transverse plane corresponds to X-Y in GGEMS. And when you rotate your phantom in GGEMS, the center of rotation is always the center of the world at (0,0,0). And yes, if you rotate along Z, you don’t rotate along X, and Y. In the next version of GGEMS, I will integrate the visualization as OpenGL/Qt in Geant4 or GATE, it will be easier to check the positions and rotations.

Best
Didier

Hi, Benoit! I am using the GGEMS to simulating the situation of security inspection machine recently.
For higher efficiency of debugging, all the projection is applied on win10 and vs 2019.
According to the requirement of installation from github,

  1. the version of clang should be from v9 to v11, so does the higher version such as v12 work ? For now, I directly use the default version (clang v12) of vs 2019.

  2. no matter using “clang -cl” or msvc of vs 2019, the code always crashed when faced with “material_manager.SetMaterialDatabase”. The error informations are both “string subscript out of range”.

In all, I am not sure why it doesn’t work now. And I believe that you can help me to cope with this problem

the error information is as follows:

Hi,
I validated GGEMS only on clang from LLVM website (https://clang.llvm.org/). I had some problems too using clang from msvc, and I did not investigate more why it did not compile. You can use vs 2019, you will have lot of debug infos too.

I tried (this morning) clang v12 and it seemed to compile and run as well. I will validate better this version for the next GGEMS release.

Kind regards
Didier

Thank you very much !
And do you need the corresponding matlab version of ggems? I recently translate the c++ version into matlab version to undersstand it better. So if you want, maybe I can devote it later after comparing the results between two version.

Hi,

It is nice but we don’t need a matlab version for GGEMS.

Kind regards,
Didier