e0404 / matRad

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

How to change default photons_Generic machine into our own machine ? #263

Closed torsionfield closed 3 years ago

torsionfield commented 6 years ago

Hello

I'm a freshman of radiotherapy field. So I don't understand how to change the code related to the machine information, such as "photons_Generic.mat".

Actually, when I open the file, "photons_Generic.mat", in matlab, the "machine" table comes up. After I load the table, I could see "Machine.data" table.

In this table, "Machine.data",

"betas , energy, m, primaryFluence, kernel, kernelPos" field are represented :

I'd like to know the meaning of each field, and what I have to do in order to change the default machine into our own machine.

Thanks

mingersming commented 6 years ago

We are sorry, but at the moment you can only use the specific photon pencil beam kernel created from base data for the implemented machine. Please be patient, in a further release of matRad there should be a routine to implement your own base data.

For now, I will give you a brief explanation of the "Machine.data" content:

[1] Bortfeld, T. , Schlegel, W. and Rhein, B. (1993), Decomposition of pencil beam kernels for fast dose calculations in three‐dimensional treatment planning. Med. Phys., 20: 311-318.

torsionfield commented 6 years ago

Thanks a lot for your comment ~

markbangert commented 6 years ago

together with @mingersming I started to develop a framework to compute the kernels directly based on measurements as detailed in [1]. Please check out https://github.com/e0404/photonPencilBeamKernelCalc and let us know if you need further help.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically closed because it has not seen any activity in four weeks. This happens usually when the issue has already been solved or it is no longer relevant. If that's not the case, feel free to reopen the issue.

bwheelz36 commented 3 years ago

Hi, I also would be interested in being able to update the machine data, and just wanted to check that this is still the most up to date status? it is the most recent information I have been able to find... thanks!

wahln commented 3 years ago

There's not much change on the matRad side. However, I think there was some more development on the https://github.com/e0404/photonPencilBeamKernelCalc repository, which is able to generate the base data in matRad format from typical measurements.

naninano1 commented 3 years ago

Dear mingersming and markbangert,

How can I manipulate the original matRad or the respiratory data to be able to commission other photon energies than 6MV?

mingersming commented 3 years ago

You can use the already mentioned photonPencilBeamKernelCalc repository. First, you need the energy dependent base data for your LINAC (TPR measurements, output factors and primary fluence). Afterwards you make use of the function ppbkc_generateBaseData.m and feed it with the name of your machine and a specific base data folder. (Compare the content of the input dir with the directory structure in the repository, e.g. synergy folder, replace the energy comment in the params.dat through your own energy and edit the value of FWHM for some fine-tuning.) Finally, you copy the created mat file to your matRad working dir, and you are able to use it in the GUI or even command line.

In this way, I have created base data for 15MV and 6MV for an Elekta machine without problems. But for FFF the kernel calculation is not correct.

naninano1 commented 3 years ago

Thank you very much for your reply. Today, for starting and testing, I tried to generate mat file for your machine data (Synergy folder). What I did: 1- I copied the photonPencilBeamKernelCalc contents to matRad folder and added them to matlab environment. 2- Defined the "inputDir" as "...\Synergy\" 3- I ran the ppbkc_generateBaseData.m in matlab

it shows these errors:

_**Not enough input arguments.

Error in ppbkc_generateBaseData (line 18) machine.meta.name = name;

Undefined function or variable 'kernelResolution'. Error in ppbkcgenerateBaseData (line 128) machine.data.kernelPos = kernelResolution * [0:(kernelExtension/2-1)];**

mingersming commented 3 years ago

Perfect, that you tried it on your own. But as the error suggest, you missed the first of two parameters for the function ppbkc_generateBaseData. Please specify a name, e.g. ppbkc_generateBaseData('Synergy', '')

naninano1 commented 3 years ago

I appreciate your support. With your guide, I could generate photons_Synergy.mat file. However, I am not sure whether it works. Because there are some general errors related to optimization. I am going to ask it in an appropriate topic (#481 )

mingersming commented 3 years ago

Glade to hear that you could create a machine file.

markbangert commented 3 years ago

Also glad to hear you made the next step and sorry for not chipping in to the discussion earlier. Before clsoing this issue for the time being, though, I wanted to make the point that you have to use your own machine file with care. Please make a couple of validation simulations at different compleity so you know how accurate your model actually is. I would recomment starting with open fileds of different size and at different source to axis distance. Then you can proceed to an IMRT case with one beam, finally multiple beams.

Little-Stars520 commented 2 weeks ago

Hi,@markbangert @mingersming I'm not sure if we can continue this discussion here. When I try to run ppbkc_generateBaseData.m, it shows these errors: Function or variable 'getIpOptions' is not recognized. And then I found that this function does not exist. I would like to ask where this function is placed.

Besides, I found that there are two columns in primflu.dat, "0" and "1", what do these two columns mean.

I have raised an issue, but I would like to ask again here. I would like to know whether MLC is considered in matrad and whether it supports me to change the properties of MLC, such as transmission, curvature, tongue and groove width.

wahln commented 2 weeks ago

Hi @Little-Stars520 , the photon dose calculation in matRad is not very advanced and only a pencil-beam dose calculation. MLC information is only considered "indirectly" through the shape of the fitted kernel from corresponding measurements. In general, I also would say that when you want to really change MLC parameters and observe the effects, it is also more suitable to model the MLC as a geometry component in a Monte Carlo algorithm, because pencil-beam kernel algorithms in general try to incorporate as many machine details as possible in the precomputation of the kernels. There is some experimental TOPAS branch one could start with, but then you still would need to have a source model / phase-space file for your LINAC. I really would like to, at some point, improve the photon dose calculation algorithm with better machine models and MLC options, but currently we don't have the resources for that.

mingersming commented 2 weeks ago

Hi.

Please check if the optimization toolbox is included in your Matlab installation. It´s not a function inside the repository.

The first line in primflu.dat means distance (0 mm) from the central axis with a relative primary fluence of 1 (100%).

Best regards.

Little-Stars520 commented 2 weeks ago

Thank you very much for your quick response.@wahln I'm a freshman of the dose calculation. When I model the MLC as a geometric component in the Monte Carlo algorithm, do I need to use the Monte Carlo algorithm to build the entire convolution kernel? At this time, it seems that the pencil beam is no longer needed. I feel that this is very complicated. In addition, can you provide more references or books on dose calculation? Since the graduation thesis of Martin Siggel you provided is not in English, it is difficult for me to understand it.