1+ function test_suite = test_SVDPB
2+
3+ test_functions= localfunctions();
4+
5+ initTestSuite ;
6+
7+ function test_getSVDPBEngineFromPln
8+ % Single gaussian lateral model
9+ testData.pln = struct(' radiationMode' ,' photons' ,' machine' ,' Generic' );
10+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
11+ engine = DoseEngines .matRad_PhotonPencilBeamSVDEngine .getEngineFromPln(testData .pln );
12+ assertTrue(isa(engine ,' DoseEngines.matRad_PhotonPencilBeamSVDEngine' ));
13+
14+ function test_loadMachineForSVDPB
15+ possibleRadModes = DoseEngines .matRad_PhotonPencilBeamSVDEngine .possibleRadiationModes ;
16+ for i = 1 : numel(possibleRadModes )
17+ machine = DoseEngines .matRad_PhotonPencilBeamSVDEngine .loadMachine(possibleRadModes{i },' Generic' );
18+ assertTrue(isstruct(machine ));
19+ assertTrue(isfield(machine , ' meta' ));
20+ assertTrue(isfield(machine .meta , ' radiationMode' ));
21+ assertTrue(strcmp(machine .meta .radiationMode , possibleRadModes{i }));
22+ end
23+
24+ function test_calcDoseSVDPBphotons
25+ testData = load(' photons_testData.mat' );
26+
27+ assertTrue(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
28+
29+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
30+ testData.pln.propDoseCalc.dosimetricLateralCutOff = 0.995 ;
31+ testData.pln.propDoseCalc.geometricLateralCutOff = 50 ;
32+ testData.pln.propDoseCalc.kernelCutOff = Inf ;
33+ resultGUI = matRad_calcDoseForward(testData .ct , testData .cst , testData .stf , testData .pln , ones(sum([testData .stf(: ).totalNumOfBixels]),1 ));
34+
35+ assertTrue(isequal(fieldnames(resultGUI ),fieldnames(testData .resultGUI )));
36+ assertTrue(isequal(testData .ct .cubeDim , size(resultGUI .physicalDose )));
37+ assertElementsAlmostEqual(resultGUI .physicalDose ,testData .resultGUI .physicalDose ,' relative' ,1e-2 );
38+
39+
40+ function test_nonSupportedSettings
41+ % Radiation mode other than photons not implemented
42+ testData = load(' protons_testData.mat' );
43+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
44+ assertFalse(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
45+
46+ % Invalid machine without radiation mode field
47+ testData.pln.machine = ' Empty' ;
48+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
49+ assertExceptionThrown(@() DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
50+ assertFalse(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ,[]));
51+
52+
53+
54+
0 commit comments