11function test_suite = test_SVDPB
22
33 test_functions= localfunctions();
4-
4+
55 initTestSuite ;
6-
6+
77 function test_getSVDPBEngineFromPln
88 % Single gaussian lateral model
99 testData.pln = struct(' radiationMode' ,' photons' ,' machine' ,' Generic' );
1010 testData.pln.propDoseCalc.engine = ' SVDPB' ;
1111 engine = DoseEngines .matRad_PhotonPencilBeamSVDEngine .getEngineFromPln(testData .pln );
1212 assertTrue(isa(engine ,' DoseEngines.matRad_PhotonPencilBeamSVDEngine' ));
13-
13+
1414 function test_loadMachineForSVDPB
1515 possibleRadModes = DoseEngines .matRad_PhotonPencilBeamSVDEngine .possibleRadiationModes ;
1616 for i = 1 : numel(possibleRadModes )
2020 assertTrue(isfield(machine .meta , ' radiationMode' ));
2121 assertTrue(strcmp(machine .meta .radiationMode , possibleRadModes{i }));
2222 end
23-
23+
2424 function test_calcDoseSVDPBphotons
2525 testData = load(' photons_testData.mat' );
2626
2727 assertTrue(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
28-
28+
2929 testData.pln.propDoseCalc.engine = ' SVDPB' ;
3030 testData.pln.propDoseCalc.dosimetricLateralCutOff = 0.995 ;
3131 testData.pln.propDoseCalc.geometricLateralCutOff = 50 ;
3232 testData.pln.propDoseCalc.kernelCutOff = Inf ;
33+ if moxunit_util_platform_is_octave()
34+ % The random number generator is not consistent between octave and matlab
35+ testData.pln.propDoseCalc.enableDijSampling = false ;
36+ end
3337 resultGUI = matRad_calcDoseForward(testData .ct , testData .cst , testData .stf , testData .pln , ones(sum([testData .stf(: ).totalNumOfBixels]),1 ));
34-
38+
3539 assertTrue(isequal(fieldnames(resultGUI ),fieldnames(testData .resultGUI )));
3640 assertTrue(isequal(testData .ct .cubeDim , size(resultGUI .physicalDose )));
37- assertElementsAlmostEqual(resultGUI .physicalDose ,testData .resultGUI .physicalDose ,' relative' ,1e-2 );
38-
39-
41+ assertElementsAlmostEqual(resultGUI .physicalDose ,testData .resultGUI .physicalDose ,' relative' ,1e-2 , 1e-2 );
42+
43+
4044 function test_nonSupportedSettings
41- % Radiation mode other than photons not implemented
45+ % Radiation mode other than photons not implemented
4246 testData = load(' protons_testData.mat' );
43- testData.pln.propDoseCalc.engine = ' SVDPB' ;
47+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
4448 assertFalse(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
45-
49+
4650 % Invalid machine without radiation mode field
4751 testData.pln.machine = ' Empty' ;
48- testData.pln.propDoseCalc.engine = ' SVDPB' ;
52+ testData.pln.propDoseCalc.engine = ' SVDPB' ;
4953 assertExceptionThrown(@() DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ));
5054 assertFalse(DoseEngines .matRad_PhotonPencilBeamSVDEngine .isAvailable(testData .pln ,[]));
51-
52-
53-
54-
55+
56+
57+
58+
0 commit comments