Skip to content

Commit dddf27c

Browse files
Fabio-Danb96935fdwahlnCopilot
authored
Feature/vhee (#828)
* changes to master * revert * dev edits * merged Fabio & Louis merged * Normalize line endings * Renormalize file modes * Ignore DS_Store * Correct File Modes for MCSquare * incorrect merge revert and code cleanup * Final cleanup of incorrect merge * fix VHEE stf generator name in matRad config * fix some naming issue and GUI display * Add TOPAS parameters to FermiEyges machine and facilitate use of the TOPAS interface * use physics list from publication * add paper reference to VHEE physics list * Updated Authors/Citation & Added VHEE example * Integrate asymmetric calculation for focused VHEE into matRad_ParticleHongPencilBeamEngine, drop VHEE Engine due to only minor additions. * revert matRad.m script * matRad.m script now also includes comments for VHEE * Single Bixel stf generator orks with VHEE now. * rename example to keep order * Update Normalization of machine data * fix tests * * add test data * add stf test * fix stf generator default radiation mode setting * * Final code cleanup * Decision to name the default VHEE engine "Generic" instead of "FermiEyges" * Added documentation * Remove commented code Co-authored-by: Copilot <[email protected]> * add some basic tests to cover VHEE engine for both divergent and focused beam * more comprehensive dose calculation tests * Update VHEE tests * update energy handling in stf VHEE generator and tests --------- Co-authored-by: b96935fd <[email protected]> Co-authored-by: Fabdan <[email protected]> Co-authored-by: Niklas Wahl <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 6e2cd3d commit dddf27c

27 files changed

+594
-143
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ coverage.xml
55
coverage.json
66
*.asv
77
build/
8+
.DS_Store

AUTHORS.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ List of all matRad developers that contributed code (alphabetical)
1111
* Louis Charton
1212
* Eric Christiansen
1313
* Remo Cristoforetti
14+
* Fabio D'Andrea
1415
* Marios Dallas
1516
* Edgardo Doerner
17+
* Louis Ermeneux
1618
* Simona Facchiano
1719
* Hubert Gabrys
1820
* Josefine Handrack
@@ -37,6 +39,7 @@ List of all matRad developers that contributed code (alphabetical)
3739
* Claus Sarnighausen
3840
* Carsten Scholz
3941
* Camilo Sevilla
42+
* Mateusz Sitarz
4043
* Alexander Stadler
4144
* Uwe Titt
4245
* Niklas Wahl

CITATION.cff

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ authors:
2525
given-names: "Eric"
2626
- family-names: "Cristoforetti"
2727
given-names: "Remo"
28+
- family-names: "D'Andrea"
29+
given-names: "Fabio"
2830
- family-names: "Dallas"
2931
given-names: "Marios"
3032
- family-names: "Doerner"
@@ -33,6 +35,8 @@ authors:
3335
given-names: "Swantje"
3436
- family-names: "Ellerbrock"
3537
given-names: "Malte"
38+
- family-names: "Ermeneux"
39+
given-names: "Louis"
3640
- family-names: "Facchiano"
3741
given-names: "Simona"
3842
- family-names: "Gabryś"
@@ -87,6 +91,8 @@ authors:
8791
given-names: "Carsten"
8892
- family-names: "Sevilla"
8993
given-names: "Camilo"
94+
- family-names: "Sitarz"
95+
given-names: "Mateusz"
9096
- family-names: "Stadler"
9197
given-names: "Alexander"
9298
- family-names: "Ulrich"

examples/matRad_example20_VHEE.m

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
%% Example: VHEE Treatment Plan
2+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3+
%
4+
% Copyright 2017 the matRad development team.
5+
%
6+
% This file is part of the matRad project. It is subject to the license
7+
% terms in the LICENSE file found in the top-level directory of this
8+
% distribution and at https://github.com/e0404/matRad/LICENSE.md. No part
9+
% of the matRad project, including this file, may be copied, modified,
10+
% propagated, or distributed except according to the terms contained in the
11+
% LICENSE file.
12+
%
13+
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14+
%% this example contributors
15+
% Authors : F. D'Andrea ; A. Bennan ; L. Ermeneux ; N. Wahl
16+
%
17+
% Based on implementation proposed by M. Sitarz et al. (doi:10.1002/mp.17392)
18+
% Generic machine using FermiEyges model based on work of M.G. Ronga et al. (doi:10.1002/mp.16697)
19+
% Applied matRad for a VHEE study as described by F. D'andrea et al. (doi:10.1016/j.phro.2025.100732)
20+
% Focused machine based on work of L. Whitmore et al. (doi:10.1038/s41598-021-93276-8)
21+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22+
23+
%% In this example we will show
24+
% (i) how to load patient data into matRad
25+
% (ii) how to setup a VHEE dose calculation
26+
% (iii) how to inversely optimize the pencil beam intensities directly from
27+
% command window in MATLAB.
28+
29+
%% set matRad runtime configuration
30+
matRad_rc; %If this throws an error, run it from the parent directory first to set the paths
31+
32+
%% Patient Data Import
33+
% Let's begin with a clear Matlab environment and import the prostate
34+
% patient into your workspace
35+
load('PROSTATE.mat');
36+
37+
%% Treatment Plan
38+
% Here, we would like to use VHEE for treatment planning. Next, we need to
39+
% define a treatment machine to correctly load the corresponding base data.
40+
% matRad features two base data for VHEE, a divergent beam
41+
% (VHEE_Generic.mat) based on a FermiEyges model that has to be called
42+
% through 'Generic' and a Focused beam (VHEE_Focused.mat), to be called by
43+
% 'Focused'.
44+
pln.radiationMode = 'VHEE'; % either photons / protons / helium / carbon / brachy / VHEE
45+
pln.machine = 'Generic'; % Generic / Focused VHEE - (Focused still in development)
46+
pln.bioModel = 'none'; % 'none' for VHEE
47+
48+
%% plan parameters
49+
% Now we have to set the remaining plan parameters.
50+
% beam geometry settings
51+
pln.numOfFractions = 30;
52+
pln.propStf.energy = 200; % set VHEE beam energy in MeV [100,150 or 200 MeV]
53+
pln.propStf.bixelWidth = 5; % [mm] / also corresponds to lateral spot spacing for particles
54+
pln.propStf.gantryAngles = [35, 110, 180, 250, 325]; % [°] ;
55+
pln.propStf.couchAngles = [0 0 0 0 0]; % [°] ;
56+
pln.propStf.numOfBeams = numel(pln.propStf.gantryAngles);
57+
pln.propStf.isoCenter = ones(pln.propStf.numOfBeams,1) * matRad_getIsoCenter(cst,ct,0);
58+
59+
% dose calculation settings
60+
pln.propDoseCalc.doseGrid.resolution.x = 3; % [mm]
61+
pln.propDoseCalc.doseGrid.resolution.y = 3; % [mm]
62+
pln.propDoseCalc.doseGrid.resolution.z = 3; % [mm]
63+
pln.propDoseCalc.engine = 'HongPB';
64+
65+
% optimization settings
66+
pln.propOpt.quantityOpt = 'physicalDose'; % Quantity to optimizer (could also be RBExDose, BED, effect)
67+
pln.propOpt.optimizer = 'IPOPT'; % We can also utilize 'fmincon' from Matlab's optimization toolbox
68+
pln.propOpt.runDAO = false; % 1/true: run DAO, 0/false: don't / will be ignored for particles
69+
pln.propSeq.runSequencing = false; % true: run sequencing, false: don't / will be ignored for particles and also triggered by runDAO below
70+
71+
%% generate steering file
72+
stf = matRad_generateStf(ct,cst,pln);
73+
74+
%% dose calculation
75+
dij = matRad_calcDoseInfluence(ct, cst, stf, pln);
76+
77+
%% inverse planning for imrt
78+
resultGUI = matRad_fluenceOptimization(dij,cst,pln); % Future work - remove low weighted spots to aid MC
79+
80+
%% use the GUI widgets directly to visualize the result
81+
viewer = matRad_ViewingWidget();
82+
viewer.doseOpacity = 0.35; %lets change the doseOpacity
83+
84+
dvhwidget = matRad_DVHStatsWidget();
85+
dvhwidget.selectedDisplayOption = 'physicalDose';
86+
87+
%% Export parameter files for a TOPAS recalculation
88+
% set number of histories lower than default for this example (default: 1e8)
89+
pln.propDoseCalc.numHistoriesDirect = 5e6;
90+
pln.propDoseCalc.engine = 'TOPAS';
91+
pln.propDoseCalc.externalCalculation = 'write';
92+
resultGUI_MC = matRad_calcDoseForward(ct,cst,stf,pln,resultGUI.w);
93+

matRad.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525

2626
% meta information for treatment plan
2727
pln.numOfFractions = 30;
28-
pln.radiationMode = 'photons'; % either photons / protons / helium / carbon / brachy
29-
pln.machine = 'Generic'; % generic for RT / LDR or HDR for BT
28+
pln.radiationMode = 'photons'; % either photons / protons / helium / carbon / brachy / VHEE
29+
pln.machine = 'Generic'; % generic for RT / LDR or HDR for BT / Generic or Focused for VHEE
3030

31-
pln.bioModel = 'none'; % none: for photons, protons, carbon, brachy % constRBE: constant RBE for photons and protons
31+
pln.bioModel = 'none'; % none: for all % constRBE: constant RBE for photons and protons
3232
% MCN: McNamara-variable RBE model for protons % WED: Wedenberg-variable RBE model for protons
3333
% LEM: Local Effect Model for carbon ions % HEL: data-driven RBE parametrization for helium
3434

matRad/MatRad_Config.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ function setDefaultProperties(obj)
201201
obj.defaults.machine.carbon = 'Generic';
202202
obj.defaults.machine.brachy = 'HDR';
203203
obj.defaults.machine.fallback = 'Generic';
204+
obj.defaults.machine.VHEE = 'Generic';
205+
204206

205207
%Default Bio Model
206208
obj.defaults.bioModel.photons = 'none';
@@ -209,9 +211,10 @@ function setDefaultProperties(obj)
209211
obj.defaults.bioModel.carbon = 'LEM';
210212
obj.defaults.bioModel.brachy = 'none';
211213
obj.defaults.bioModel.fallback = 'none';
212-
214+
obj.defaults.bioModel.VHEE = 'none';
215+
213216
%Default Steering/Geometry Properties
214-
obj.defaults.propStf.generator = {'PhotonIMRT','ParticleIMPT','SimpleBrachy'};
217+
obj.defaults.propStf.generator = {'PhotonIMRT','ParticleIMPT','SimpleBrachy','VHEE'};
215218
obj.defaults.propStf.longitudinalSpotSpacing = 2;
216219
obj.defaults.propStf.addMargin = true; %expand target for beamlet finding
217220
obj.defaults.propStf.bixelWidth = 5;

matRad/basedata/VHEE_Focused.mat

19.1 KB
Binary file not shown.

matRad/basedata/VHEE_Generic.mat

102 KB
Binary file not shown.

matRad/basedata/matRad_MCemittanceBaseData.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
if isfield(machine.data(ixE), 'energySpectrum') && ~obj.forceSpectrumApproximation
123123
energySpectrum = machine.data(ixE).energySpectrum;
124124
if isfield(energySpectrum,'type') && strcmp(energySpectrum.type,'gaussian')
125-
energyData.NominalEnergy = ones(1,4) * machine.data(ixE).energy(:);
125+
energyData.NominalEnergy = machine.data(ixE).energy(:);
126126
energyData.MeanEnergy = machine.data(ixE).energySpectrum.mean(:);
127127
energyData.EnergySpread = machine.data(ixE).energySpectrum.sigma(:);
128128
else

matRad/bioModels/matRad_EmptyBiologicalModel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1717
properties (Constant)
1818
model = 'none';
19-
possibleRadiationModes = {'photons', 'protons', 'carbon', 'helium', 'brachy'};
19+
possibleRadiationModes = {'photons', 'protons', 'carbon', 'helium', 'brachy','VHEE'};
2020
requiredQuantities = {};
2121
defaultReportQuantity = 'physicalDose';
2222
end

0 commit comments

Comments
 (0)