-
Notifications
You must be signed in to change notification settings - Fork 193
How to execute matRad
To execute the matRad script using MATLAB you need to:
- Open matRad folder in MATLAB
- Set patient-specific parameters
- Execute inverse planning
- Import additional patient data
If you prefer to only use the GUI to execute matRad, check out the [matRadGUI tutorial](How to execute matRadGUI).
## Step 1: Open matRad folder in MATLABTo use matRad you need to open the matRad folder in MATLAB. Open MATLAB and navigate to the location of the files, if you have cloned the repository it is most likely located in your local Github folder (e.g."C:\Users\username\Documents\GitHub\matRad").
Inside the matRad folder there are several MATLAB-functions used to run matRad, named "matRad_*.m, and *.mat files containing base data and exemplary patient data sets. The main script to run matRad is called "matRad.m". It can be executed section by section.
## Step 2: Set patient-specific parameters In the first section the patient specific parameters have to be set ([see image below](#parametersScreenshot)).:- Which patient (-data) should be loaded
- Which beam angles should be used
- Which radiation mode should be used
The desired number of fractions can be set in line 52 in the screenshot.
The other parameters set in this section are generated automatically and should not be changed.
_Screenshot of the parameters section_
## Step 3: Execute inverse planning
The matRad.m script can now be executed step by step:
- load settings
- initial visualization
- generate steering file
- dose calculation
- inverse planning for IMRT
- sequencing
- visualization of the resulting treatment plan
- calculate DVH
To evaluate a single section you have to "activate" it (left mouse-click inside section) and then use "ctrl + enter" or use right mouse-click -> Evaluate Current Section.
**1. load settings**Now you can execute the first section. You should see the variables cst, ct and pln in your Worspace.

After the patient data is loaded you can execute the second Section to open the GUI:

In the GUI you can view the patient CT, change the plan parameters and adjust the optimization parameters.

The usage of the GUI is explained to more detail in the [matRadGUI tutorial](How to execute matRadGUI). Here we will focus on the "manual" execution of the matRad script. To "manually" change the optimization parameters you can adjust the cst-cell (see cst-cell documentation for more information).
**3. generate steering file**In this section the steering file (stf) is created and the matRad steering information is stored as a struct.

The Command Window should show you the progress

In this section the dose influence matrix (dij-struct) for the defined beam angles is calculated.

Again the progress should be shown in the Command Window.

In this section the fluence is optimized to find the bixel (photons) or spot (protons/carbon) weights minimizing the objective function.

During this process, the current objective function value is displayed:

For photon IMRT the application of a multileaf collimator is necessary. By sequencing the applicable dose distribution can be simulated. The third input of matRad_engelLeafSequencing(wOpt,stf,7,0) is the number of stratification levels. You can adjust this number to use the number of levels you want.

When the sequencing is finished, the result-struct is updated.
**7. visualization of the resulting treatment plan**Now you can visualize the resulting treatment plan using the GUI:

In the GUI you can see the resulting dose distribution for the calculated treatment plan. You can choose which plane and slice should be displayed. You can also display a dose profile plot by changing the plot type from intensity to profile.
If you have chosen a biological optimization, then you have several parameters you can choose to be displayed (e.g. RBE-weighted dose, biological effect, α or β values).

In this section the Dose-Volume-Histograms are calculated and visualized.


In the Command Window you will see the mean, maximum and minimum dose for every VOI.

matRad supports the import of patient data stored in the DICOM format. A set of functions designed for this purpose can be found in the subfolder 'dicomImport'. For more information about the usage of the import functions please check out this wiki page.
| Home | About |
Quick Setup |
Technical Docs | FAQ |
Home > matRad Setup Guide > Executing matRad script
- About matRad
- Setting up matRad
- Technical Documentation
Useful resources