Articles | Volume 10, issue 1
Regular research article
18 Mar 2021
Regular research article |  | 18 Mar 2021

Method for fast determination of the angle of ionizing radiation incidence from data measured by a Timepix3 detector

Felix Lehner, Jürgen Roth, Oliver Hupe, Marc Kassubeck, Benedikt Bergmann, Petr Mánek, and Marcus Magnor

This paper presents a method of how to determine spatial angles of ionizing radiation incidence quickly, using a Timepix3 detector. This work focuses on the dosimetric applications where detectors and measured quantities show significant angle dependencies. A determined angle of incidence can be used to correct for the angle dependence of a planar Timepix3 detector. Up until now, only passive dosemeters have been able to provide a correct dose and preserve the corresponding incidence angle of the radiation. Unfortunately, passive dosemeters cannot provide this information in “real” time. In our special setup we were able to retrieve the spatial angles with a runtime of less than 600 ms. Employing the new Timepix3 detector enables the use of effective data analysis where the direction of incident radiation is computed from a simple photon event map. In order to obtain this angle, we combine the information extracted from the map with known 3D geometry surrounding the detector. Moreover, we analyze the computation time behavior, conditions and optimizations of the developed spatial angle calculation algorithm.

1 Introduction

The national radiation protection regulations are all based on the European directive “council directive 2013/59/EURATOM” (European Parliament2013). This basic safety standard states the required dosimetry and the dose limits. Dosemeters are used to ensure that the prescribed dose limits for occupationally exposed workers are kept and to help reveal radiation protection issues in their environment. Therefore, these dosemeters must be able to measure the radiation dose accurately and provide a warning signal, preferably at the same time, if the radiation dose rate exceeds a predefined limit. A major difficulty for current active dosemeters that are based on semiconductors is that their planar geometry inherently has a non-uniform angular dependence on the photon detection efficiency, which directly affects their response. Knowledge of the true spatial angle of the incident radiation is necessary to allow for corrections of this dependence. Since the desired measurand is a body dose equivalent that relates the measured energy to the energy deposition at a certain depth in human tissue, the incident angle has an additional importance. Today, this information allowing proper transformation into the personal dose equivalent is only achieved using passive dosemeters. Not only can the information be used to optimize the accuracy of the dose rate measurement, it also supports radiation protection itself by indicating the direction of radioactive sources. In this paper we describe how we use a planar photon detector in the form of a silicon semiconductor bound on a hybrid pixel detector called Timepix3 (Poikela et al.2014) to obtain information about the spatial angles of incident radiation. During measurements a thin aluminum foil shielded the photon detector with the aim of reducing interference from the low-energy photons of the ambient light. Our approach allows quick calculation of the direction of incident photons by using the known geometry of the direct surroundings of the detector. In our case, we use pins placed in front of the sensor and analyze the geometry of the pin's shadow as seen in the pixel matrix. Because the runtime of such an algorithm is heavily dependent on the allowed range for the radiation angle, the following evaluation is carried out respecting the German PTB requirements for stationary dosimetry PTB-A 23.3 (Physikalisch Technische Bundesanstalt2013b) regarding spatial angles.

1.1 Related work

There are many tried and tested techniques for obtaining spatial angles of incident radiation and to correct for any angular dependence that have been used for decades. For instance, one method that corrects the angle dependence of planar detectors is the glide-shadow effect (Ambrosi et al.1994). This effect is used by passive dosemeters using an X-ray film as the planar detector. They are used for legal personal dosimetry in Germany and are collected after exposure by the relevant authority. The dominating radiation direction can be, but normally is not, retrieved from the shadows created by additional shielding pins on the film. Another example is the pinhole (Baek et al.2013) and Compton camera (Sakai et al.2019; Kormoll2013; Turecek et al.2020). These, for example, are used during the demolition of nuclear power plants, for nuclear waste monitoring or in medical applications to trace back sources of gamma radiation. Since pinhole cameras require heavy shielding materials and Compton cameras rely on computationally demanding reconstruction algorithms, such approaches are not suitable for personal dosimetry. We use an approach that is based on the conditional density propagation (CONDENSATION) algorithm (Blake and Isard1997). This algorithm has been proven to be fast enough since it has already been used to track the spatial location of complex objects based on images. For instance, the algorithm can be used for the “real”-time application in context with robotics navigation (Roy et al.2017). The algorithm we developed is derived from the CONDENSATION algorithm to calculate angles from the shadows located on the detector plane.

1.2 Timepix3

The Timepix3 chip was developed by the international Medipix3 collaboration of CERN (Medipix3 Collaboration2018). This chip has a 256×256 px array distributed over an area of 14 mm2 with a pitch of ∼55µm, which allows for pixel-wise time-resolved particle detection. It comes with a time resolution of 1.56 ns while offering a pixel rate of up to 40 MHits s−1 cm−2. In this instance the Timepix3 chip was used in conjunction with a 300 µm thick silicon semiconductor detector in order to catch high energetic photons. The data acquisition was done in data-driven mode, which returns a stream of pixels as they were hit (Poikela et al.2014; Frojdh et al.2015).

2 Methods

2.1 The Timepix3 measurement setup

The measurement setup, constructed in PTB, maintains the fixed pin positions even when used with different Timepix3 detectors. It consists of pins glued into a thin PMMA plate glued to an aluminum window which is in turn glued to an aluminum carrier plate located 2 mm above the sensor area of the Timepix3 chip. The carrier plate is exchangeable, allowing different pin materials, different window thicknesses and different pin configurations to be tested. In this case we used nine identical pins made of steel placed in a circular array. This configuration was chosen to obtain the best shadow-to-detector overlap while, at the same time, staying mostly independent of the rotation angle β. The angle β is defined as the rotation around the normal vector which stands perpendicular on the aluminum window and by that defines the z axis. In order to decrease the instability of the shadow detection, this pin configuration minimizes the relative shadow area that is not overlapping the detector. As only the gradient angle on the detector plane is important, our symmetrical setup does not obscure any relevant information. Moreover, the overall stability is improved by the 30 µm thick aluminum window whose purpose is to absorb low-energy photons from the ambient light and thereby reduce the background noise.

2.2 Input data

For the data acquisition, we used the data-driven mode of Timepix3, where all pixel information is transmitted once it has been hit. All pixel information consists of its coordinates, time of arrival and time over threshold. That gives us a maximum data rate of 440 MB s−1 that is transformed into a series of frames as described in the following. The data fetched by a Timepix3 detector, using the previously described measuring setup, are integrated over a certain time depending on the actual count rate measured by the detector. In this case each ionizing event is observed regarding its location only. Neither the number of events per pixel nor the total duration that a pixel was active during the integration interval was taken into account. The resulting image only contains the information about which pixels were active. This procedure was chosen to keep the pre-processing to a minimum. Integrating these data over a certain time led to the following image in Fig. 2.

Figure 13D explosion drawing of the constructed dedicated Timepix3 measurement setup. It contains the configuration of the pins (highlighted in orange) as used. Shown in the lower right part of the diagram is a schematic shadow projection of one pin. This depiction shows the projection from the simplification of the geometry to the actual ellipse of the shadow particle.


Figure 2Integrated Timepix3 data over a time of 10 ms using a radiation quality of H-60 (ISO2019) and under a gradient angle of 15. A typical frame like this consists of roughly 12 000 photon events.


Figure 3Snippet of the relevant parts of the schematic processing pipeline overview used to test the radiation angle detection algorithm.


2.3 Shadow and radiation angle detection algorithm

The flow diagram from Fig. 3 shows the different processing steps of the algorithm ending with the actual shadows and the resulting spatial angles. For testing purposes instead of a real device, previously recorded data from a file can also be used. The visual processing of the shadows is implemented using OpenCL (Munshi2012) and should be processed on a GPU for the best performance (datascience.com2018). The full source code is available under the MIT license (Lehner2019). The detection of shadows and their positions is done by processing the Timepix data collected over a fixed time interval or photon event count. We used 12 000 events to create one integrated frame. The schema of the data flow beginning at the integration up to the resulting radiation angle is shown in Fig. 3. The algorithm used is derived from the family of the “particle filters”, which itself is a subset of the Monte Carlo simulations. Our angle detection algorithm is adapted from the CONDENSATION algorithm (Blake and Isard1997). However, in contrast to that algorithm, our algorithm does not try to estimate the 2D positions of the individual shadows but estimates the 3D spatial angles of the radiation that created the shadows on the detector. This is achieved by using the known 3D geometry of the pin filters attached to the aluminium carrier plate above the detector and calculating the single particles based on that information. For reasons of efficiency complex pin geometries are simplified by a boundary box. The rectangular projected shadow will then be transformed into a fitting ellipse to leave out the noisy corners of a shadow. Note that particles in this context refer to instances of possible radiation directions whose probabilities can be computed from the given data at a time. As a consequence, the single particles st(n) are defined by the tuple (αβ), where α describes the gradient angle, while β defines the rotation around the z axis. In the following a subscripted t will stand for a certain time, and a superscripted n indicates different instances of a particle given a time. Subsequently, a particle results in a complete possible shadow cast by all pins in the setup. Such a particle can then be validated against a measured frame. The algorithm uses that validation to iteratively maximize the probability of the hidden state represented by a particle. Since a particle represents the spatial direction relative to our detector, that maximization finds the best estimate for the real spatial direction. In order to smoothen the result, the weighted sum of all sufficiently possible particles is calculated to decrease the noise of the output:



  • ξ[St,γ] is a tuple (αβ) that represents the final result of the shadow detection algorithm at time t.

  • πw(n) is the weights of all items in St,γ. The condition n=1Mπw(n)=1 must be fulfilled by all πw(n) in order to weight all values correctly.

  • γ is a specific threshold depending on the mean noise. Possible values for it will be discussed alongside the results in Sect. 3.

  • Rst(n) is interpreted as the probability of a particle and is calculated by computing the quotient of shadowed pixels to existing pixels inside of the area defined by a particle st(n).

  • St,γ. The set St,γ contains all the particles whose probability or hit-to-unhit pixel ratio is above the γ threshold that needs to be determined beforehand. The content of this set will be optimized during each iteration of the algorithm.

  • f(St,γn) is a mapping of a particle St,γn into the set of possible angles of incidence 2.

  • |St,γ provides the count of items in the set St,γ.

The final result ξ[St,γ] will be computed from Shadowst,γ containing the best result for the spatial radiation direction. Inside of ξ the mapping f(st(n) will map each particle st(n) onto its generation tuple (αβ).

In order to transform a spatial angle tuple (αβ) of a particle st to a “shadow ratio”. Ratiost, a simple parallel projection matrix P is used on every vertex v of the 3D geometry of the pins.

(3) P v = cos ( β ) - sin ( β ) - sin ( β ) tan ( α ) sin ( β ) cos ( β ) cos ( β ) tan ( α ) 0 0 0 x y z = x cos ( β ) - ( y + z tan ( α ) ) sin ( β ) x sin ( β ) + ( y + z tan ( α ) ) cos ( β )

This results in a mapping of the pin geometry in the xy plane which will be interpreted as the detector area. The mapping is then used to compute the value of Ratiost(n) for any particle st(n) guessed by the algorithm. A scheme of this mapping for one single pin is portrayed in Fig. 1.

Hence the used particle filter algorithm works as shown in the following algorithm pseudo code (Algorithms 1 and 2).
3 Results

The algorithm for the incident radiation angle determination used here was tested by using the H-60 radiation quality (ISO2019) under gradient angles α[-45+45] and 5 steps. This is the angle range demanded by the PTB-Requirements for area dosemeters PTB-A 23.3 (Physikalisch Technische Bundesanstalt2013b).

Figure 4Radiation incident angles using data measured by the Timepix3 detector with the algorithm plotted over the true angles α. Each data point here was generated by calculating the mean value over five successive frames with the same true incident angle α and five evaluations of the same frame. The measurement was done using an H-60 radiation quality (ISO2019). The different lines correspond to one γ that was used as the shadow threshold in the shadow detection algorithm. The standard deviation is indicated by the grey backdrop area.


In this case, the measurement with a H-60 radiation quality corresponds to a dose rate of 173.2 mGy h−1. Each test was repeated using a different γ∈[0.971.07]. The value of γ was used as the shadow threshold in the shadow detection algorithm as described in Sect. 2.3. All following results from the algorithm were generated using a Windows 10 machine that was run with an Intel Xeon E5-1650 V3 CPU combined with a dedicated NVIDIA GTX 980 Ti GPU. Using this setup the runtimes of the algorithm with γ∈[0.971.07] do not differ by more than 10 % from each other, so we used this interval to test the incident angle calculation. For all γ values used, the runtime for calculating the angles can be considered to be below 600 ms.

As can be seen in Fig. 4, most of the values used for γ result in values very close to the true angles. This figure was generated from test measurements using an H-60 radiation quality (ISO2019) with each data point being generated by calculating the mean value over five successive frames with the same true incident radiation angle α and five evaluations of the same frame. That means that we have tested the algorithm over a total time of 180 ms per γ value. Each measured angle in Fig. 4 corresponds to the mean value of 25 values per true angle. In addition, the gray underlay visualizes the standard deviation uniformly in the ±y direction. Interestingly the standard deviation is higher for negative α values. This is caused by an asymmetric pin configuration as a result of it being hand crafted. For all tested values of γ a good linear regression coefficient R2 can be retrieved. Therefore, the results for some values of γ that are slightly rotated around the origin can be corrected depending on γ. This can be seen in Fig. 5. Furthermore, this figure shows the effect of γ reasonably well since higher values of γ result in a higher linear dependency, while lower values achieve a lower linear dependency.

Figure 5The linear regression coefficients R2 for each γ used and the data points from Fig. 4.


It can be seen from Figs. 4 and 6 that all values for γ∈[0.971.07] show a reasonable accuracy for α[-35+35]. Furthermore, Fig. 6 shows that there is a huge discrepancy between the single values of γ. That simply reflects the lower relative part of the pin configuration shadow that overlaps with the detector when the incident radiation angle increases. Hence the threshold γ needs to be higher in order to increase the probability of finding the shadow in the Timepix3 data since the algorithm's solution space is restricted by it. As can be seen using γ∈[1.031.07], it still provides a reasonable accuracy for incident angles |α|(+35+45].

Figure 6The root mean square error (RMSE) over all gradient angles [−45, +45] plotted over different values for γ. Each point corresponds to the measurements of five frames evaluated five times each.


The above observation validates the decision to consider γ as a variable in the algorithm, since an optimization of γ for the individual situation optimizes the algorithms' runtime too. The influence of γ gets stronger with the absolute angle of incidence. This is because higher values of γ not only increase the probability of a good result, but also could end with no result at all as well. That is represented in Fig. 7. There it can be seen that above an absolute incident radiation angle of 30 the probability of no result with a γ after one complete evaluation rises quickly with the size of γ itself. However, it can be seen that a γ of 1.05 would after all still be a good choice in this case regarding the computation time and the accuracy.

Figure 7Probability of the algorithm producing no result after one complete execution for each value of γ.


The effectiveness of this approach is limited by the energy of the individual photons and the shielding capability of the pins, since a measurable contrast between light and shadow must exist. As soon as the pins shield too few photons, the angle detection becomes unstable or not feasible. In this case the algorithm does not return a result.

4 Conclusion

In this paper we presented a novel approach to the construction of solid-state dosemeters using an angle detection algorithm which converts the shadows on the detector into spatial angles and the pin construction above the detector surface, which serves as input for the algorithm.

As has been pointed out, the algorithm can approximate the spatial angle of incident radiation quite well if the algorithm is properly configured and used with incident radiation angles α[-45+45] as required by PTB-A 23.3 (Physikalisch Technische Bundesanstalt2013b). While this is fully acceptable for use in area dosimetry in Germany (Physikalisch Technische Bundesanstalt2013b), it is not in personal dosimetry as it does not fulfill the requirements up to ±60 (Physikalisch Technische Bundesanstalt2013a). In order to use this algorithm in dosimetry efficiently, a module needs to be implemented that automatically adjusts the value for γ depending on the noisiness of the retrieved data and the incident radiation angle. By taking previously calculated angles into account, a certainty for each resulting angle can be calculated additionally. Further, the measurement setup with Timepix3 could be optimized so that the relative shadow-detector overlap is sufficient up to ±60, possibly allowing us in future to push the algorithm measuring range from [−45+45] to [−60+60], which would then allow for use in personal dosimetry (Physikalisch Technische Bundesanstalt2013a).

Code availability

The C++ code is available from (Lehner2021).

Author contributions

The methodology and concepts used for developing and validating the algorithm were developed by MM, OH, MK and FL. The project was supervised by MM, OH and JR. The results were validated by OH, MK and BB. The resources used during this project were procured by BB, PM and OH. The writing of the original draft was done by FL. The original draft was reviewed and edited by BB, MM, MK, JR and OH. The software development and visualization of its results was accomplished by FL.

Competing interests

The authors declare that they have no conflict of interest.

Financial support

This open-access publication was funded
by the Physikalisch-Technische Bundesanstalt.

Review statement

This paper was edited by Ulrich Schmid and reviewed by two anonymous referees.


Ambrosi, P., Boehm, J., Hilgers, G., Jordan, M., and Ritzenhoff, K. H.: The gliding-shadow method and its application in the design of a new film badge for the measurement of the personal dose equivalent Hp(10), PTB-Mitteilungen, 104, 334–338, 1994. a

Baek, C.-H., An, S. J., Kim, H.-I., Kwak, S.-W., and Chung, Y. H.: Development of a pinhole gamma camera for environmental monitoring, Radiat. Meas., 59, 114–118,, 2013. a

Blake, A. and Isard, M.: The CONDENSATION algorithm – conditional density propagation and applications to visual tracking, in: Neural Information Processing System, Vol. 9, MIT Press, Cambridge, 1997. a, b CPU vs GPU in Machine Learning, available at: (last access: 16 March 2021), 2018. a

European Parliament: Council directive 2013/59/EURATOM, available at: (last access: 16 March 2021), 2013. a

Frojdh, E., Campbell, M., De Gaspari, M., Kulis, S., Llopart, X., Poikela, T., and Tlustos, L.: Timepix3: first measurements and characterization of a hybrid-pixel detector working in event driven mode, J. Instrum., 10, C01039,, 2015. a

ISO: Radiological protection – X and gamma reference radiation for calibrating dosemeters and doserate meters and for determining their response as a function of photon energy – Part 1: Radiation characteristics and production methods, iSO 4037-1:2019(E), 2019. a, b, c, d

Kormoll, T.: A Compton Camera for In-vivo Dosimetry in Ion-beam Radiotherapy, dissertation, Technical University of Dresden, Dresden, Germany, available at: (last access: 3 August 2020), 2013. a

Lehner, F.: Timepix3 dosimetric base library, available at: (last access: 1 March 2019), 2019. a

Lehner, F.: ftl999/TimePix3DosimetricLibrary: JSSS publication, Zenodo,, 2021. a

Medipix3 Collaboration: Medipix3 Collaboration, available at: (last access: 2 October 2019), 2018. a

Munshi, A.: The OpenCL Specification, 1.2, available at: (last access: 2 October 2019), 2012. a

Physikalisch Technische Bundesanstalt: PTB-Anforderungen: Strahlenschutzmessgeraete (Personendosimeter zur Messung der Tiefen- und Oberflaechen-Personendosis), 23.2, available at: (last access: 2 October 2019), 2013a.  a, b

Physikalisch Technische Bundesanstalt: PTB-Anforderungen: Strahlenschutzmessgeraete (Ortsdosimeter zur Messung der Umgebungs- und Richtungs-Aequivalentdosis und der Umgebungs- und Richtungs-Aequivalentdosisleistung), 23.3, available at: (last access: 2 October 2019), 2013b. a, b, c, d

Poikela, T., Plosila, J., Westerlund, T., Campbell, M., De Gaspari, M., Llopart, X., Gromov, V., Kluit, R., van Beuzekom, M., Zappon, F., Zivkovic, V., Brezina, C., Desch, K., Fu, Y., and Kruth, A.: Timepix3: a 65 K channel hybrid pixel readout chip with simultaneous ToA/ToT and sparse readout, J. Instrum., 9, 5,, 2014. a, b

Roy, N., Chatterjee, R., Sanyal, S., and Misra, C.: Position Determination and Tracking of Mobile Robots in Indoor Environment with Condensation Algorithm and Image Processing for Autonomous Path Generation, Int. J. Comput. Math. Sci., 6, 304–308, 2017. a

Sakai, M., Kubota, Y., Parajuli, R. K., Kikuchi, M., Arakawa, K., and Nakano, T.: Compton imaging with 99mTc for human imaging, Scient. Rep., 9, 12906,, 2019. a

Turecek, D., Jakubek, J., Trojanova, E., and Sefc, L.: Single layer Compton camera based on Timepix3 technology, J. Instrum., 15, C01014,, 2020. a