e0404 / matRad

An open source multi-modality radiation treatment planning sytem developed by e0404 @ DKFZ
http://www.matRad.org
Other
220 stars 174 forks source link

How to get Sigma Data #540

Open LGDi opened 2 years ago

LGDi commented 2 years ago

Hello, teachers I ' m a new user of matrad .I want to change protons _ Generic. mat to my data. Now I have got the "range”,“energy”,“depths”,“Z”,“peakPos” and “LET”,but I haven ' t got "sigma" data and "initFocus" yet. By reading the information in the wiki.I know that "sigma" is the beam broadening of the particle. The InitFocus includes “dist”,"sigma" and "SisFWHMAtIso".I know "SisFWHMAtIso" is full width at half maximum.I still don 't know how to find sigma. I want to know how to get "sigma" data.Is the original sigma data calculated by the formula or how ? Thanks

wahln commented 2 years ago

First of all, for everyone reading this I would like to link this: https://github.com/e0404/matRad/wiki/Particle-Base-Data-File

machine.data.sigma is the width of the scattering kernel in water. That means it tabulates the lateral width of the proton dose distribution for an infinitesimally small pencil-beam impinging on water. To get this value you either

the machine.data.initFocus allows you to store multiple beam optics setings (i.e., foci). The beam optics is parameterized by the width of the beam at certain distances from the source, e.g., through measurements of the beam width in air. machine.data.initFocus.sigma thus tabulates the incident sigma at the distances given in machine.data.initFocus.dist. protons_Generic.mat gives an example for only a single focus setting for a non-convergent beam. That is, the beam width does not change traveling through vacuum/air (initFocus.sigma). This is why there are two eqaul initFocus.sigma values tabulated for 0 and a large distance (initFocus.dist). If you have multiple focus settings, dist & sigma become matrices with as many rows as focus indices. The initFocus.SisFWHMAtIso additionally stores the FWHM of the beam at the isocenter, as this value may be used to select the beam focus automatically. In the protons_Generic.mat file with constant beam width, this is thus just 2*sqrt(2*ln(2)) * sigma.

So, finally: how does machine.data.initFocus.sigma and machine.data.sigma interact in the dose calculation? Since machine.data.sigma is the width of the pencil-beam kernel and machine.data.initFocus.sigma tabulates the incident width, both need to be convolved. Since both are Gaussians, this is down to a new Gaussian whose variance equals the sum of the initSigma^2 and the sigma^2.

wahln commented 2 years ago

I want to add, if it is not obvious: you should not "change" protons_Generic.mat into your own data. You should create a second file, e.g. "protons_myOwnData.mat". matRad will then allow you to switch between both files.

LGDi commented 2 years ago

Thanks a lot for your comment ~ Through simulation, I obtained an overall dose distribution curve, and then fitted it to a Gaussian. I can get a sigma, but it needs sigma at each depth.

markbangert commented 2 years ago

Then you need to perform the fit in each depth. :)

Am Di., 21. Dez. 2021 um 03:28 Uhr schrieb LGDi @.***>:

Thanks a lot for your comment ~ Through simulation, I obtained an overall dose distribution curve, and then fitted it to a Gaussian. I can get a sigma, but it needs sigma at each depth.

— Reply to this email directly, view it on GitHub https://github.com/e0404/matRad/issues/540#issuecomment-998417841, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNPY7OTOTRJLBK4WNNPRRDUR7Q45ANCNFSM5KNO6GFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

LGDi commented 2 years ago

Thanks for your comment ~ Now, I can get some sigma of each layer. I want to know how to understand ' SisFWHMAtIso describes for each focus index the initial FWHM at isocenter '.Whether further calculation is needed.I can understand that the full width at half maximum is getting smaller and smaller, but the individual FWHM calculated by me is getting larger and larger. With the increase of incident energy, the energy distribution is more and more concentrated, but the number of layers between the peak half and the peak does increase.

wahln commented 2 years ago

Sorry, I don't understand what you mean with "it is getting smaller and smaller" and what this has to do with energy distribution.

But just to make this clear once again, there's basically two parts in the base data which are given for each initial energy setting:

The SisFWHMAtIso is, for each focus for each energy, the lateral width of the beam in air at the isocenter. It depends fully on the beam optics of your machine. Basically, it comes from turning the beam on, holding a foil at isocenter to measure the beam profile. It has nothing to do with the energy distribution, or the dose kernel tables for Z, LET, sigma, etc. In the protons_Generic.mat, the beam is getting more narrow (smaller SisFWHMAtIso) with higher incident machine.data.energy, mainly because high-energetic beams are often more focused.

LGDi commented 2 years ago

Thank you very much for your guidance~ Now, I've almost built my own database.Thanks again

ni484call5 commented 1 month ago

Hello!

Thanks your discussion and sharing! I'm also trying to build a new base data for specific carbon therapy system. I have two group sigma data for each energy level

  1. in air: measure by lynx at isocenter(0), forward nozzle(-200mm), backward nozzle(+200mm)
  2. in water: calculated by monte carlo with SSD. Isocenter locate at water surface.

I guess the one measured in air at isocenter(0) will be multiplied by 2.355, transforming sigma to FWHM,and filled in machine.data(i).initFocus.SisFWHMAtIso.

My first question is about the definition of machine.data.initFocus.sigma and initFocus.dist I can't understand what's the definition of coordination of initFocus.dist and initFocus.sigma? For example, in carbon_Generic.mat, machine.data(1).initFocus.dist is [0,20000]. Does the dist from 0 to 20000 manifest the distance from vacumn pipe surface to isocenter in unit of mm? It seems too long. In my case, should I fill in initFocus.dist with [-200,200] and initFocus.sigma with [sigma at (-200) forward nozzle, sigma at (+200) backward nozzle]

My second question is about the def of machine.data(i).sigma I notice the value of machine.data(1).sigma in carbon_Generic.mat is [0; 0.0066; 0.0102; 0.0143; ...]. I understand the first value should be 0 which have been mention in wiki/basedata. While I'm confused that the sigma value behind first depth are so small, ex 0.0066mm shown above. I guess all the value in machine.data(i).sigma is minus by sigma value at 0 depth. Is it correct? For example, there is a sigma table simulated in water. In column B shows original sigma value, and column C shows modified sets which will be filled in machine.data(i).sigma. In column C, C(i)= B(i) - $B$2.

sigma_script.xlsx

wahln commented 1 month ago

Correct, the spot width (sigma) in air needs to be written into machine.data.initFocus.sigma. machine.data.initFocus.dist is the distance from the virtual source to the isocenter, that's why the distance is so long. In the Generic machine, this is just set "generically" to [0,20000] at the same sigma value, describing a constant spot width is constant in air (which, of course, is not representing a realistic machine, but that's the point of the "Generic" dataset).

Now where's the virtual source in a scanning system? Often you have two virtual sources per X/Y scanning magnet (that is where the spot axis would have originated on the central beam axis given the direction after the scanning magnet). This would give you two source-to-axis/isocenter distances SAD_x/y. Since (1) these distances are often very large compared to the size of the spot grid and (2) the matRad pencil-beam algorithm and machine format do currently only support one virtual source, we usually choose the average between two as SAD. Thus, your initFocus.dist is SAD + differenceOfAirMeasurementFromIsocenter in mm (in your case SAD + [-200, 0, 200]).

Now regarding machine.data.sigma: The tabulated data in depth, in general, represents a pencil-beam kernel, i.e., the depth dose of an infinitesimally small impinging ion beam. This is why the sigma in the Generic set starts with 0 (yet, practically this could also be a value different than 0). This kernel will then be convolved with the incoming fluence, which is represented by the initFocus.sigma at the respective SSD (interpolated from the stored measurements). Since both are Gaussian, this convolution results in a Gaussian with sigma sigma_spot = sqrt(sigma_init^2 + sigma_kernel^2).