 So, good morning again. We will continue lectures within this course with the title Treatment Planning Systems. I will not discuss different treatment planning systems, advantages and disadvantages. What I want to do is have to a little bit a look into treatment planning systems, a little bit mathematics. So this is some, I want to give you some background information which I should say is nice to know, but it's not a condition to know. So what I want to, I have to put it on. I want to give an introduction, then I want to deal with the key elements for a three-dimensional dose calculation engine. I want to again speak about the Wachsel model of patient, the B model. I want to say some words on rate tracing algorithms, dose calculation algorithm, optimization strategies. And I want also some, spend some word on tracking of particles which is done in Monte Carlo. This is a, you may see, I'm not interested in such things, but what I want to say is the first principle is so easy to understand and so beautiful in my eyes that you can may get a grasp of what is done in Monte Carlo, and I want to show that. And again I should say if you have a system for doing calculations in Monte Carlo, we have different systems available in the websites if most famous is from the NRC in Canada, it's easy to implement. And I would say it's easy to start and to get some first results, but it's getting more and more difficult to know that what you have calculated and obtained is very correctly done. But I think I told you already, I expect the treatment planning or calculation of those in 10 years will be mostly based on Monte Carlo. It will be faster and faster and it has compared with other dose calculation methods at least the lowest grade of approximation. It's against some approximation, but it's the problem in doing correct calculation in the long region or even for brachytherapy. Who's doing brachytherapy? Yeah, good, yeah. Brachytherapy is always in the level below external therapy, but I believe it's a very good therapy. It's a relatively cheap therapy, can be well done, and it's successful. But treatment planning, as you know, it's done in a model, in a patient model, which is just a water tank, nothing else. And if you implement your radioactive source close to the surface, the treat, those calculations can be wrong by a factor of 5% or even more. So in this case again, I think that Monte Carlo technique or some success will have a larger role. Therefore, I want to spend some work on the very first steps on that. Again, I want to show my nice picture. And a conclusion of this, of course, delivery of high dose radiation requires a thorough planning, and for this we need the treatment planning system. Radiation delivery requires the whole process. You are familiar with that, and we have developed in Heidelberg this picture of the chain of single procedures starting from clinical evaluation, then therapeutic decision to apply a treatment, radiation treatment, imaging, localization of target volume, treatment planning simulation. So a lot of steps, and here's the last one, the follow-up evaluation, which I have already mentioned before. So this is now our topic in this talk. The steps of treatment planning process, the professional involved in each step and the QA activities associated with these steps are shown here. First, this is the process, imaging, contouring, I have discussed this in the last talk, target volume and normal tissue definition, dose calculation, optimization, monitor calculation and first treatment. And these are the people who are involved in this, so this is radiotherapist and that of radio technology technologist, again here radiation oncologist, and here are coming the treatment planner and the physicist, and here again comes the medical physicist, and here this is the radiation therapist again, and this is the QI activity which I involved in this process. So these are the activities who are treatment planning system related. So I only want to deal with a system where computer are involved. So we have heard yesterday and day before some methods how to do it manually, and I still think that must be known. I'm not sure whether the astro formalism is the ideal tool for that, and even the people in the astro now are believing that we have better tools, there's a new document for the APM who are telling and giving a concept how to do manual calculation, and I insist that medical, a medical physicist must know this, and if I'm responsible or if we have introduced such in our group, so we must know that. So such treatment planning systems which are called TBS are now always used in extraordinary radiotherapy and also in brachytherapy more and more. Is someone doing brachytherapy without treatment planning? It's now old fashioned. We have this good system for that. To generate beam shapes and dose distributions with the intent to maximize tumor control and minimize normal tissue complications. By the way, if someone is writing a thesis in medicine, in a master of medicine, one of the first sentences always the aim of radiotherapy is and then came the sentence. No one can avoid the sentence. It's a nice sentence, but it means a lot. What does it mean? How to do it? Okay, main elements of a treatment plan system is the data, the import of patient data now, this is done in a diagram format, establishment of the beam model, which is not so easy. Generation of individual patient model, we have already spoken on that. Definition of target volumes and organs at risk, this is a program of segmentation, this is the imaging part. Definition of irrigation parameters, dose calculation, plan evaluation and optimization, dose prescription and determination of monitor units, export of treatment parameters to the accelerator. This is nowadays done just by the software. In consequence, because the software and the medical doctors do not understand, the medical physics always is responsible for that. So, a modern medical physics must be also good in computer technology and always please do it, if something is wrong. So, it goes directly to medical physics, but it was not his original job to do. Documentation and I want now spent more or less on dose calculations. Though this is a famous picture from the national research council in Canada demonstrating how those calculations can be done with Monte Carlo simulation. I like this picture because it shows that the radiation is done from first principle. We have here the target, which is bombarded by electrons, we have the attenuation filter, we have a first collimator, we have second collimators and all these things are quite nicely simulated in such a way that the photons and even the electrons who are coming out can be well described. So, let's start with a Wachsel model of our patients. This is a CT series and if we look carefully to that, then we have one Wachsel and this is in essence our patient model consisting of such Wachsel's and containing or the value within the Wachsel is the Hounsfield number or the electronic density. So, in order to achieve those calculations in the patient, we need the quantum of the patients, the CTV, atomic structures, and many tissue in the machines. In that's a patient, the relative electron density of each Wachsel can be determined from patient CT data set and this is well-known that it's taken from the ICI-U report and one can use this but care must be taken that these really works in reality. So, one must check the CT and do measurements in order to find out whether CT numbers really translate in the correct electron density. And I should say some words if you do that with plastic material, some of the plastic materials really do have difficulties. Some of them have high set material in to make it more water equivalent but they introduce some problems with these CT numbers and we know this especially that has not been with that but we have developed irradiation device with high, with carbon ions. It was a special treatment facility close to Heidelberg and now in Heidelberg and there the relation between the attenuation of the beam and the CT numbers is very sensitive to such things which are, it's not the same as for photo irradiation. The beam model, modern approaches utilize the natural divider between the radiation source inside the treatment head that is the head, treatment head or the gantry and they will come out as a result of that with a distribution of the fluence or the energy fluence differential energy on a certain plane and after that having this information then we can start with our calculation of the dose within the patient. This is a schematic drawing of an accelerator head which is taken from Anna, from colleague Anders Anderssjö and he was claiming that a complete model of the head requires a finite photon source size here, a model for the source, an open fluence distribution within the fluence modulation within the head and this may be different in step and shoot and for dynamic MRT we have to simulate the wedges and we had also head scatters called sources for this fluence here coming out which are influenced by the flattening filter, by the collimators and again by wedges and we have also the problem of monitor back scatter and we have collimator leakage here in that so all these things has to be taken into account to produce a good beam model so and a treatment planning system is offering you now to put your personal data the data which you have measured in a way that this beam model is as good as possible with also some beam specter or spectral changes, electron contamination and all these things now I came to the problem of dose calculation within the phantom or the patient a rather simple method of dose calculation is that imagine that the dose is known at a certain point at the surface or within the reference point that can be the point where we have to do the beam calibration and we have to know the dose in some distance of that and this can be done in a very easy way the dose here is just the dose at this point multiplied by this attenuation factor please note that this is a radiological path so that has to include the density information between here and here so if you do this applied in a in a voxel structure and you do this process or you calculate this process this is a process which is called ray tracing it has already been mentioned by you for doing projections so if you constructs your drr's you also have to apply this ray tracing method to get your final results so this is a model of the ray tracing so it's it's only two dimensional model and it's user term is a radiological path through a voxel ray representing a patient so each of this may have different densities so and what's going on now though this from here to here this would be our geometrical path from here to here and the radiological path from here to here within from here to here within the patient is always the the segments from here to here multiplied with a density and with a normalized density so this is again showing this problem in a voxel and what is pretty clear that we have to calculate that segments in each of the voxels so if we have so this is general formulation that said the radiological radiological path is a sum over all the segments in the cube with in a general way with different interaction coefficients that can be the attenuation coefficient so this is for photons we had attenuation coefficients normalized to that of water and it's obvious that the evaluation of this equation scales with a number of voxels so if we have 256 256 times 64 voxels which would be a normal distribution of a beam of a patient model we would have four to ten six iterations so it's a huge number of calculations and this was a long time a great problem to which is not easy to overcome however there are algorithms of ray tracing which are much faster and that was the famous work it was already 1984 it was by Robert Sittin was written and we have all the other algorithms which go much more fast and I want to show a little bit on that to understand what what ray tracing is and how this is done nowadays so this shows again our our our grid of of voxels or pixels and here the intersection points here and here and here and here and these are the way or the path in y and in x so and this is a geometrical path through this structure so if we look on these segments here as being intersections of the blue planes and also as interactions of the green lines we can again say these are these different intersection points and the alpha is just the ratio between the ratio in x between two points and the same is true in y this is the ratio of two successive points of successive planes and it has to normalize to the geometrical path links in y and x so if we now we can merge this different x alphas from here and here in a in a series of increasing values and we call this is shown here this is just all the alphas from the intersections in of these planes and in the section of these planes and using now this merged series of alphas the individual distance can now be calculated simply as the difference of the two alphas and b which is now the geometrical path the same way can be done for the indices we skip over then and then finally the charm of this algorithm it does not scale with a number of voxels it does scale with a number of planes and this is a number of planes in three dimensional structure and instead of four million iterations we now we have only almost six iterations so this is an algorithm which is much more faster and this was the key algorithm to be used in any treatment planning system which which uses the rate tracing to go through the patient or through the water phantom nothing is we want to calculate those and again I should refer to my first lecture absorb those is a thing which is not easy to calculate we need some other things and and and a karma is one quantity which can be easily calculated so using this formula so we need the collision camera which is very close to the absorb those so what we need is the fluence and the attenuation coefficient but we need the fluence now in each of these voxels and exactly for this point within the patient now we need the rate tracing algorithm so a fluence machine would provide the required knowledge of kelgöf here at this distance so we start with the fluence and here and then we do simply the rate tracing through the patient again it shows what a beam model has to be has been performed it must include the width the shape and other radiative properties of the source and normally this is a extended source or a multiple source you need a good model for the source and it has been shown that a source consisting of different Gaussian shape can be used there are treatment planning systems where you have really to adjust these different sources to your measurements so it's it's it's not only nice no it's important to know that you need this information to construct your relevant source collimeters can be ray traced and for each element finds a contribution from the relevant source so you can finally construct this the photon fluence in in the plane and use that as a starting information to do ray tracing now in the patient so these are different uh an overview of some those calculation algorithms so those which can be obtained by ray tracing algorithm to calculate the collision camera you need the fluence in the different voxels so you have to determine the fluence differential energy in each of the voxels and there are other techniques which are more advanced so solution of so-called Boltzmann transport equation you can use for that Monte Carlo codes or and superposition algorithm I want to touch this superposition superposition and point kernel approach what is a point kernel I think many of you know what they think it is once you know it's easy to understand but the word kernel is something which is a strange word it doesn't appear in our daily life so kernel what is a kernel it comes from mathematics so but it's easy to explain imagine a water absorber and the point here within the water then imagine that photons are coming here and that only in in this direction and all these photons undergo interaction only in this point nothing else and then this will produce secondary electrons or scattered photons and so on and you can calculate or obtain the distribution of energy about this point which is very easy to understand or to imagine you're on it you cannot measure it but you can understand how this comes together and this distribution is nothing else than what we what we call a point kernel it's a distribution of energy about one point of interaction which can be for one energy it can also be for whole spectrum and yeah it is all physics because what does a photon do it undergoes a photon yeah it is it is a physics so if you look on the distribution of secondary electrons which are produced by Compton effect they will have a certain distribution angle which depends on the energy for very low energies that this one goes inside but for very high energies it's mostly forward directed and this is normal so this is one example for one MEV yeah so it it therefore the distribution of energy goes mostly in the forward direction but you can see it has also some some backward direction because any of this can happen the same for photon interaction for for one MEV we don't have a pair creation but we also have Rayleigh scattering here and a Rayleigh scattering can again so if you look here careful you will this is this may be the range of the secondary electrons but you will also see some energy is spread out here so it has a clue so typically uh if you if you go here you do a profile it it goes down very quickly due to the electrons but then it has a long tail due to the photon because also scattered photons are this two different energy so it's a very nice combination of what happens with the photon interactions and this picture is is now my picture in my brain this is a kernel point kernel yeah and using such point kernels we can find this or we can do the super position principle this is summarized here the dose here at the point where interest is coming from interaction volumes in some neighborhood so in all these elements and here we can we can finally say the element elementary energy ordinance from the energy fluence which is coming from here so we know the fluence here then the fluence is ray traced to the different volumes and then the energy is scattered to all directions and also here so this is a sum of all this scattered energy coming from all over the volumes in the phantom if we denote this scattering factor here in this way though this is x is uh is that here at the point of interest and the x zero is set in the volume then the dose is given by this integral so we have the scattering factors we have the fluence the energy the fluence in the volume and we have to integrate over the volume so such if you are not used to read such equations you may say oh that's mathematics too high but it's not so difficult to to read such equations so this is the fluence term this is our scattering term and when we summarize this by the following statement the dose deposition is viewed as a superposition of a properly weighted response to point irradiations and these responses are referred as point currents so exactly our point currents are now coming in we can use our point kernels now for this scattering factor however we should then because it goes in direction we have to shift to rotate our point kernels the other things are normally calculated for water so this only works for water it doesn't work for very inhomogeneous distributions oh so this is exactly the point and the conditions where the kernels are spatially invariant this is in a homogeneous case and if they are all parallel so if you have a long distance focus and all this parallel the superposition is mathematically equivalent to a convolution I don't wish to go into confusion but the point is there is an algorithm a computer algorithm which can do convolution very very fast that has been invented about 30 years ago the introduction of convolution in the treatment planning or in those calculations and if you have say in the first approximation homogeneous phantom water and you have it almost always come in the same way a parallel beam such techniques such computer techniques using fast convolution it's again a Fourier what is Fourier transformation is used for that you have introduced it very quickly in your talk it's all mathematics but the point is it can be done extremely effectively so this technique of convolution come into treatment planning in those calculation systems you can also introduce other kernels point kernels pencil colors ellipse cone and this is an an overview you cannot only you can summarize different points along one line one center line and then if you put this together that would be a pencil kernel and it's very similar again if you imagine all parallel beams coming as a line and you simply know the energy to be about the lines you simply have to summarize now all the lines and you have the dose there are nice models with that which already explain very nicely the dependence of of output factor as a factor of beam size if you do that you would you would actually find your output factor so with these models you can describe that things some calculation system like there in the head we call the AAA method which is an isotropic analytical algorithm which which are taken to account the density all the in this direction because I totally told the the point kernel is done in water and if this is a long it does not work so if if it's a different density is taking the count in this direction it would be an approximation of course but it would be all the work for for inhomogeneity structures and this is called the collapse cone where it does this in different direction which are well separated and along this cone the attenuation is taking the count due to different densities so I think it's quite nice to understand once you understand what the point kernel is you have this picture in your mind and the distribution of energy and you apply this with taking the count the different density of the material along this different distributions then you came up with this modern calculation techniques which are now the essence of modern treatment planning systems so collapse cone is well known and these are and then you can find distributions or comparisons of how well they work in different circumstances which you will find in the literature but you can do nothing you have to buy it and you have to use it but you should know about these approximations and how well that approximations may work especially for lung tumors where you have over the problem with this density difference it's not water so we have a different distribution of the energy along different directions so now I come to another point it's optimization I think what is said here in this slides it shows that a lot of things have to be optimized this is quite natural and you can play with that I should say that there are also some mathematics now available who can do this job for you especially in imrt this is done for you and I want just to come to a few things here with imrt but I think this is already now so well known that I can go through this very quickly it's for you you need all these different segments and you have to do an optimization to find that you know that I can skip this this is a mathematics to find out the the weights of the different segments which take into account the dose at organ and risk and also tolerance dose so I wanted to go into it just to say that behind such a treatment plan system there is some algorithms which do the optimization for you and I think it's not necessary to know the details but one should know that there's an optimization algorithm behind that the last thing I want to do is again coming to the fluence I told already that we can consider the head as our fluence engine at our b model and then in the plane below that we have the fluid distribution this is a definition of fluence please note that it refers to a sphere with a diameter of d a and the definition of the fluence is a number of n a number of fluence entering the fluid entering the sphere not going through the plane who knows an alternative definition of fluence yeah it's a unit area but there is another another very nice definition which is not so well familiar and it's shown here if you take any structure it can in this case it's a cube and you take the length of the tracks through that and you simply and then you take the distribution of the length and you divide this by the volume you can clearly see it has the same dimension and this is an alternative definition of fluence which is not so well known maybe I want to I take the time now what is the time here it is yeah no I want to show a picture which for me it's it's so nice to understand it so the question is if you consider depth those curves of electrons especially if you have say smaller energy say something like six m e v or nine m e v you know the structure you know the depth to a curve of electrons and how the how the depth those curve will see it has typically such an increase then it goes down and then for small energy this part is very small though what is that the dose build up yes you know it from the photons but it isn't the dose build up what is it so I can I can tell you how you can understand this very very easily imagine I will make a drawing here very thin slits slab of material or let's see only from science or this is our our entrance material in water and it's and the electrons are coming here so what happens with the electrons here though it's it's a very thin one it will and they will lose some energy is not very much let's let's look to the other next slide here or again very thin and what happens else a scattering yes so the electron will come through here but some of them may have a little bit a little bit banding here not not directly so they will go here so now the next one you go to the next one this one will go like that and this will be here so can you see immediately that the tracks here are in average the sum of all are larger than here it's obvious this is a definition what does it say it says the fluid here is larger the electron fluence here is larger than here so if you look on the simple equation the dose is say is fluence times stopping power mass stopping power the mass stopping power depends on energy so in this case the energy is is changing very small and the stopping power is changing only very little with energy here and here this may be quite similar but the fluence here is larger and therefore the dose is larger so very simple the dose in increases due to the scattering of electrons and because we have this relation between fluence and the track length I think that's a very nice example to explain the situation and it's also a nice thing to remember this this this definition yeah yeah so in photon interaction you have not reached the the complete scattering process because you create secondary electrons and just before you enter the the water there are no secondary electrons though the build up of secondary electrons is typically the reason for the build up of dose here it is not the build up of electrons it is the increase of fluence due to scattering yeah so it's physically it's quite different process responsible for this what what you can say dose build up so it is a dose build up but it has different physical reasons and then and this is once you know that it gives you some insight again on what's happening physically with the photons and electrons therefore I like this definition and the other reason is Monte Carlo it's in a Monte Carlo you typically have structures like that you have volumes and what you are doing is you calculate the track length as a first you calculate the track length through the different structures so what you get directly with that is the fluence by this so this is I think maybe the essence of of of those calculations Monte Carlo to calculate the track length once you have the track lengths of electrons you simply can multiply this topping power then you have the dose this is the way how it's done so now I want to show you a little bit because I think I like this and just to show you this is this is not so important one of the calculations of particle transfer processes are a faithful simulation of physical reality because particles are born within or they can be created according to the distribution of the source they travel certain distances to the next point of interaction or they're going through the entire vocal without interaction or they can scatter to another energy let look to this in detail this is again our our voxel used for instance in Monte Carlo calculations and here a photon is coming in it has a direction and the direction is characterized by u v and w and this is simply the directional cosine so if you add up these three numbers they in the quadratic way they must be one so this is one way to characterize individual particle and individual particle so now this individual particle goes through the voxels now what's happening how long will this photon travel again this is simple physics how long it will travel it's dependent for energy of course yeah but but how long will it travel one centimeter or two or how long yeah let's let's assume it's water the water we don't know how long it will travel because it's a stochastic process an individual one we don't know on average we don't know in on average it will travel the mean free path length this is a number which has defined that on average a photon will travel a mean free path length but the individual one we don't know it's random right so now now our random process is coming we have to calculate how long this individual will go and there's a I think extremely beautiful and simply method to calculate this so I call this these samples or it is a sample for one individual it's simply the negatives of the mean free path lengths multiplied by the logarithm of r and r is nothing else then go on here it's a random number between zero and one so with this very simple mathematical procedure you can calculate the individual distance to the next interaction okay now if we know that it's only one line in our in our computer code we know the how long it will go now we compared it we compared with the geometrical way so it this is geometrical path things from here going out so no way can differentiate between two cases that's a d sample that is a distance to the first in actions is smaller than that and what does it mean it means that there is an interaction here yeah so the interaction occurred within the voxel then then we then we take this distance as a track length of this individual photon if not then we take a track the the geometrical way this is now our track length okay so we have to make a case distribution but we can calculate very easily the track length for this individual photon then we go to the next interaction to the next voxel the next neighboring voxels so we in case that no interaction occurred we go to the adjacent voxel and we do the same but now nothing has changed we have the next distance to the next interaction is now so original one and and that what has already done because nothing has changed physically so this is our d sample for the next voxels and we repeat this for any voxels and for any for any new photon by the way you can you can implement such a calculation in excel very easily so you can do Monte Carlo in a few steps with photons in principle yeah of course you must know the mean free path length and this depend of energy and I think but if you have the information the calculation of Monte Carlo is is very simple so and this is this is a tracking which is used and and if you do this with all that you and you you collect the data of the track length you immediately get then the fluence of the of the photons multiplying by the energy absorption coefficient will get the collision camera that's it very easy so what I want to say the first the first steps into Monte Carlo to understand how this done is very easy and in my view very beautiful and fantastic simple to this is a point because this individual track length as this is d sample is related to the mean free path length just by the logarithm of the of the of the random number okay this is some things which are saying which is more informative that we call this six dimension which is the point where a particle is and the direction for this we only need two parameters and energy that is called the space phase of a particle which sometimes is used to characterize an individual particle so this is now I'm done with my talk I want to summary computerized treatment planning is a part however an important part within clinical treatment planning which consists of an entire chain of many steps those calculation is a part only within the treatment planning system so if you are able to calculate those it's you have to do so many things or to include the imaging through the calculation of of monitor units to to to do the optimization and so on and and many things have to be done then then to to to more your accelerator so those calculation is only one part main methods of calculation are ray tracing through voxel geometry superposition using different kernel types and trapping an energy scoring using Monte Carlo one should at least know the characteristics of certain those calculation methods with respect to the quiet of individual patient so that's done now so I have spent more on on on inner parts on the calculation part and again I would say it's nice to know it's not a condition to know but but if you commission your treatment planning system you put really a little more familiar with the details and the user manual are offering such details but not always so it would be good to ask colleagues it is not an easy job to to commission a treatment planning system that fits to the new units and it has to do especially also for the models which are used for the calculation so thank you for attention