[Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?

David Leibold D.Leibold at tudelft.nl
Tue Sep 6 10:59:44 CEST 2022


Dear mas,

Yes, I agree with your statements. I’m glad it helped!

Best regards,
David


PS: I think it is possible to define bins of arbitrary size for the np.histogram2d function as follows:
xbins=[-250, -0.001, 0.001, 250]
ybins=[-250, -0.001, 0.001, 250]

That would give you a small bin around the center and a few larger ones around it. Of course, it depends on what you want to do.



From: mas <fight1_fight2 at yahoo.co.jp>
Sent: Tuesday, 6 September 2022 9:58 AM
To: David Leibold <D.Leibold at tudelft.nl>
Cc: gate-users at lists.opengatecollaboration.org
Subject: Re: RE: RE: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear David,



Thank you for your very detailed explanation.

I followed your instructions and was able to get the results I wanted.

By defining the bin width very small, you mean that there is only a primary x-ray there, right?

And when the bin width is quite coarse , the coordinates of (0,0) include primary and some scatter rays (Compton scattering).

Then, by subtracting the direct ray count obtained from the (0, 0) coordinates, it is possible to calculate the scattered ray count at (0, 0) when the bin width is coarse.



Thank you very much!

mas


----- Original Message -----

From: "David Leibold" <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
To: "mas" <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Cc: "gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>" <gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>>
Date: 2022/09/05 月 18:00
Subject: RE: RE: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear mas,

If we talk about discretized pixels/bins, then I agree: the bin size of the histogram that I chose in the example is quite coarse (depending, of course, on the source-detector-distance), so I agree that it might happen that scattered rays still end up in the centre bin.

Now let’s consider the actual intersection point of an X-ray with the detector plane, so before binning:
-         In case of Compton scattering, the conservation of impulse dictates that the scattered photon ends up outside (0,0).
-         In case of Rayleigh scattering, it is (I think) possible that the scattered photon ends up in (0,0) as well, but since Rayleigh scattering conserves the energy of the photon, a “Rayleigh scattered photon without change in direction” is indistinguishable from a “primary photon”. (By the way, Rayleigh scatter can usually be neglected in the energy range of diagnostic X-ray energies.)

Coming back to the problem that a coarse pixel grid might include scatter in the centre pixel: You can then either choose a very fine pixel grid, or define your bins such that there is one very small bin around the centre (0,0) and then a large bin for the rest.

To get a feeling for what is a good pixel/bin size, you can for example plot a histogram of the distance between the intersection point of a photon with the detector and the origin. Choose a very fine grid for the histogram. If you histogram bin size is small enough, you will then see that there is a small area around the origin without any counts in your histogram.

I hope this answers your questions, if not, let me know!

Best regards,
David



From: mas <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Sent: Monday, 5 September 2022 9:45 AM
To: David Leibold <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
Cc: gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>
Subject: Re: RE: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?

Dear David,

Thank you for your very detailed explanation. And thank you for teaching me how to open root in python.
This was very helpful!

I tried as you told me. Then I extracted the primary and scatter x-ray data from ”phaseSpace.root".
However, one question remained.

It was assumed that the point hit by the pencil beam (eg P(0,0)) is only primary x-ray.
However, in actually, I think that scattered rays with small scattering angles also enter (0,0).
As a result, the point in (x,y)=(0,0) will sum of the primary and scatter. (eg P(0,0)+S(0,0))
In such a case, does it mean that primary and scatter cannot be separated in the phase space actor?
I also want to get the scatter component at coordinates (0,0).
I'm sorry if my thinking is wrong.

Thank you
mas

----- Original Message -----

From: "David Leibold" <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
To: "mas" <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Cc: "gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>" <gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>>
Date: 2022/09/02 金 16:07
Subject: RE: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear Mas,

You mention that you got a one-dimensional profile, and you show a screenshot of the root output. However, please note that you select only the x-coordinates of the root output, that means, you select the x-coordinate of all particles intersecting your detector plane. Since you select only one variable, you will obtain a one-dimensional output.

The phase space actor does not have a built-in function that separates scatter and primaries; you have to do this yourself.

What you have to do is the following (and I hope that also answers your questions 2-3 as well): You have to extract the (x,y) coordinates for all events, and then filter the events based on their distance to the centre of the detector. (I assume that the centre of the detector is the point at which the pencil beam is directed.) To be honest, I have never really used the root object browser, so others might share more light on this. For my data analysis I use Python. There is a Python library called “uproot<https://urldefense.com/v3/__https:/uproot.readthedocs.io/en/latest/__;!!PAKc-5URQlI!4TACOtbbEWaSmINTkHUyQlT5ut0PBTLOoLSOiu362wQGtm8P0OPqzNqcB5JU8UtZY2ovvrMSeogoJOQDJq8PAEzFh4tM0w$>”, which enables you to read the root files.

Here's some example code to read the root file that is output by the phase space actor; in this example the file is called “phaseSpace.root”.

import numpy as np
import uproot
import matplotlib.pyplot as plt

# Load the root file:
with uproot.open("phaseSpace.root") as rootfile:
  data = rootfile['PhaseSpace'].arrays(filter_name="*", library='np’)

   # root files have a tree structure, like a trunk with many branches.
   # The “trunk” of a root file that is output by a phase space actor
    # is called ‘PhaseSpace’. With the function ‘arrays’ we can
    # access all the branches that we want. You can specify the
    # desired branches with the argument ‘filter_name’. If you use the
    # wildcard ‘*’, then all branches are loaded. If you just want the
    # x and y coordinate, you can do
    #    filter_name = [‘X’, ‘Y’]
   # . The argument ‘library’ specifies whether you want to use numpy
    # or pandas. The former is better in terms of performance, the
    # latter is nicer for visualisation.

# Create a 2D histogram:
xbins = np.arange(-240, 241, 1)
ybins = np.arange(-240, 241, 1)

histData, histXbins, histYbins = np.histogram2d(data['X'], data['Y'], bins=[xbins, ybins])

# Plot the result:
fig, ax = plt.subplots()

ax.imshow(histData, vmin=0, vmax=2)
   # Please note that the origin of the plot does not coincide with the
    # data origin, you would have to shift that manually


[cid:image001.png at 01D8C1DF.C4BC6B60]
(That little dot in the centre of the figure is not dust on your screen, it’s actually a very faint signal…)

Based the 2D histogram, you can now say that all events that are outside, for example, a 0.1 mm region around the origin, are scatter.

I hope that helps! If you need more help, let me know.


Best regards,
David


PS: Sorry for writing your name incorrectly in my last mail!





From: mas <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Sent: Friday, 2 September 2022 8:27 AM
To: David Leibold <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
Cc: gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>
Subject: Re: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?

Dear David,

Thanks to your reply, I understood that I should use the phase space actor.
After reading the documentation, I tried using phase space actor.

I got a one-dimensional profile.
It was certainly like a point spread function.
However, some questions remained.

1)The output is a one-dimensional profile, but how do I know which location on the detector is profiled?

2)Which function of the phase space actor is used to separate scattered and direct lines?
[/gate/actor/MyActor/storeOutgoingParticles true] is used?

3)How do I output the actual values from the root file, e.g. a txt file? I am sorry that this is not the original question.

Thank you.
mas



----- Original Message -----

From: "David Leibold" <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
To: "mas" <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Cc: "gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>" <gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>>
Date: 2022/09/02 金 00:35
Subject: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear Masa,

May I summarise your requirements:

1) You mention that you want to simulate a CsI detector, but with 100 % detection efficiency and no interaction within the detector.

2) You would like to distinguish between scattered and primary rays.

3) A monochromatic pencil beam enters a phantom.


My suggestion:

I would suggest using a phase space actor (see the documentation here<https://urldefense.com/v3/__https:/opengate.readthedocs.io/en/latest/tools_to_interact_with_the_simulation_actors.html*phase-space-actor__;Iw!!PAKc-5URQlI!_P9nlwtwj9dIeV2hHQtSbBZiOOlf2u0klOOSbhmmNrMhNxMxAJN4SgVVz_zaiEj0SQYvfHgXq2pNEPKPSyXWmZGQZIKttg$>), which registers each particle's energy, position, velocity etc. crossing its surface. Since you do not want to simulate interaction in your CsI detector material, there is no need to use it in the first place.

Since you are using a pencil beam, all primary photons will go straight through your phantom, intersecting your detector at, for example, point (0,0). All scattered radiation will intersect your detector away from point (0,0). Hence, you can filter out the scatter and primary rays purely based on where they end up on your detector.

To set up your detector, use e.g. a box volume with the desired size, fill it with vacuum, and attach a phase space actor to it.

If you need more help, please let us know.

Best regards,
David



On 30 Aug2022, at 00:46, mas <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>> wrote:


Hi GATE users.

I am masa at japan and new to Gate.



I am currently working on a simple simulation.

I am trying to find the point spread function of the scattered rays detected by a CsI detector by injecting a pencil beam of monochromatic X-rays into an acrylic phantom.



Assuming a detector detection efficiency of 100%, I want to output the spread of scattered radiation when it enters the detector.

No interaction occurs with the detector. I also want to output scattered rays and primary rays separately.

How should I set up the detector in such a case?



Should I use Fluence Actor for detection?

Or should I use a sensitive detector?



I would appreciate it if you could help me.



Thank you.

_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org<mailto:Gate-users at lists.opengatecollaboration.org>
https://urldefense.com/v3/__http://lists.opengatecollaboration.org/mailman/listinfo/gate-users__;!!PAKc-5URQlI!5R6DdcwuD-nXX0bmvN3RckxZ2HEAgen9ExhbGuDcz_52hS9V1Rohx8vBP7HBR0msh9Bx0lNmj5dJ866ftlukHHjC8jk0_A$<https://urldefense.com/v3/__http:/lists.opengatecollaboration.org/mailman/listinfo/gate-users__;!!PAKc-5URQlI!5R6DdcwuD-nXX0bmvN3RckxZ2HEAgen9ExhbGuDcz_52hS9V1Rohx8vBP7HBR0msh9Bx0lNmj5dJ866ftlukHHjC8jk0_A$>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220906/cb74f00a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 165620 bytes
Desc: image001.png
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220906/cb74f00a/attachment-0001.png>


More information about the Gate-users mailing list