From e400ee95ac63ee788779605011bebcaf19b1c859 Mon Sep 17 00:00:00 2001 From: Pia Stammer <72029019+piastammer@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:56:22 +0200 Subject: [PATCH 1/4] Set default BAMStoIsoDist for topas machine file --- matRad_MCemittanceBaseData.m | 1 + 1 file changed, 1 insertion(+) diff --git a/matRad_MCemittanceBaseData.m b/matRad_MCemittanceBaseData.m index f05ce6362..66e1fef64 100644 --- a/matRad_MCemittanceBaseData.m +++ b/matRad_MCemittanceBaseData.m @@ -77,6 +77,7 @@ else obj.matRad_cfg.dispWarning('No information on BAMS to isocenter distance. Using generic value of 500mm'); obj.nozzleToIso = 500; + obj.machine.meta.BAMStoIsoDist = 500; end if all(isfield(machine.meta,{'SAD_x','SAD_y'})) From 59e3e43e8e1171a0866960e3a9d5823262b9d21d Mon Sep 17 00:00:00 2001 From: Pia Stammer <72029019+piastammer@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:22:15 +0200 Subject: [PATCH 2/4] removed redundant copyright statements & added Todos for documenation --- topas/matRad_TopasConfig.m | 66 +++++--------------------------------- 1 file changed, 8 insertions(+), 58 deletions(-) diff --git a/topas/matRad_TopasConfig.m b/topas/matRad_TopasConfig.m index 8d2f5e5d1..3913cdc65 100644 --- a/topas/matRad_TopasConfig.m +++ b/topas/matRad_TopasConfig.m @@ -183,19 +183,6 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) % stf: matRad steering struct % machine: machine to be used for calculation % w: (optional) weights in case of calcDoseDirect - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Copyright 2022 the matRad development team. - % - % This file is part of the matRad project. It is subject to the license - % terms in the LICENSE file found in the top-level directory of this - % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part - % of the matRad project, including this file, may be copied, modified, - % propagated, or distributed except according to the terms contained in the - % LICENSE file. - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class @@ -324,19 +311,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) % % output % topasCube: struct with all read out subfields - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Copyright 2022 the matRad development team. - % - % This file is part of the matRad project. It is subject to the license - % terms in the LICENSE file found in the top-level directory of this - % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part - % of the matRad project, including this file, may be copied, modified, - % propagated, or distributed except according to the terms contained in the - % LICENSE file. - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Load in saved MC parameters if isfile([folder filesep 'MCparam.mat']) @@ -401,19 +376,6 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) % % EXAMPLE calls: % topasCube = topasConfig.readExternal('pathToFolder') - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Copyright 2022 the matRad development team. - % - % This file is part of the matRad project. It is subject to the license - % terms in the LICENSE file found in the top-level directory of this - % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part - % of the matRad project, including this file, may be copied, modified, - % propagated, or distributed except according to the terms contained in the - % LICENSE file. - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % read in TOPAS files in dij dij = obj.readFiles(folder); @@ -452,19 +414,6 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) % % output % topasCube: struct with all read out subfields - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % - % Copyright 2022 the matRad development team. - % - % This file is part of the matRad project. It is subject to the license - % terms in the LICENSE file found in the top-level directory of this - % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part - % of the matRad project, including this file, may be copied, modified, - % propagated, or distributed except according to the terms contained in the - % LICENSE file. - % - % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class @@ -719,7 +668,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) end function dij = fillDij(obj,topasCubes,dij) - + %TODO: Insert documentation matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class % Load weights from parameter variable @@ -862,7 +811,7 @@ function writeAllFiles(obj,ct,cst,pln,stf,machine,w) end function writeRunHeader(obj,fID,fieldIx,runIx,ctScen) - + %TODO: Insert documentation fprintf(fID,'s:Sim/PlanLabel = "%s"\n',obj.label); if exist('ctScen','var') fprintf(fID,'s:Sim/ScoreLabel = "score_%s_field%d_ct%d_run%d"\n',obj.label,fieldIx,ctScen,runIx); @@ -903,7 +852,7 @@ function writeRunHeader(obj,fID,fieldIx,runIx,ctScen) end function writeFieldHeader(obj,fID,ctScen) - + %TODO: Insert documentation matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class if ~strcmp(obj.beamProfile,'phasespace') @@ -941,7 +890,7 @@ function writeFieldHeader(obj,fID,ctScen) end function writeScorers(obj,fID) - + %TODO: Insert documentation matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class obj.MCparam.outputType = obj.scorer.outputType; @@ -1150,7 +1099,7 @@ function writeScorers(obj,fID) end function writeStfFields(obj,ct,stf,pln,w,baseData) - + %TODO: Insert documentation matRad_cfg = MatRad_Config.instance(); %Instance of matRad configuration class isPhoton = false; @@ -2089,7 +2038,7 @@ function writePatient(obj,ct,pln) end function writeRangeShifter(~,fID,rangeShifter,sourceToNozzleDistance) - + %TODO: Insert documentation %Hardcoded PMMA range shifter for now pmma_rsp = 1.165; rsWidth = rangeShifter.eqThickness / pmma_rsp; @@ -2107,6 +2056,7 @@ function writeRangeShifter(~,fID,rangeShifter,sourceToNozzleDistance) end function writeMCparam(obj) + %TODO: Insert documentation %write MCparam file with basic parameters MCparam = obj.MCparam; save(fullfile(obj.workingDir,'MCparam.mat'),'MCparam','-v7'); From 42a4edc5026c666cc8d6590ffcac7cb1167ed967 Mon Sep 17 00:00:00 2001 From: Pia Stammer <72029019+piastammer@users.noreply.github.com> Date: Fri, 21 Jul 2023 14:44:01 +0200 Subject: [PATCH 3/4] added TODOs to check commented lines --- topas/matRad_TopasConfig.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/topas/matRad_TopasConfig.m b/topas/matRad_TopasConfig.m index 3913cdc65..250c21590 100644 --- a/topas/matRad_TopasConfig.m +++ b/topas/matRad_TopasConfig.m @@ -846,6 +846,7 @@ function writeRunHeader(obj,fID,fieldIx,runIx,ctScen) fprintf(fID,'\n'); fprintf(fID,['i:Ts/Seed = ',num2str(runIx),'\n']); + %TODO: remove or document %fprintf(fID,'includeFile = %s/TOPAS_Simulation_Setup.txt\n',obj.thisFolder); %fprintf(fID,'includeFile = %s/TOPAS_matRad_geometry.txt\n',obj.thisFolder); %fprintf(fID,'includeFile = %s/TOPAS_scorer_surfaceIC.txt\n',obj.thisFolder); @@ -1725,7 +1726,7 @@ function writeStfFields(obj,ct,stf,pln,w,baseData) obj.writeScorers(fileID); % Write dij-related config lines - % We should discuss here if that's something that has to be available for photons as well + % TODO: move this to github issue/todo -> We should discuss here if that's something that has to be available for photons as well if ~strcmp(obj.radiationMode,'photons') if obj.scorer.calcDij fprintf(fileID,'\n'); @@ -1941,7 +1942,7 @@ function writePatient(obj,ct,pln) fprintf(fID,['iv:Ge/Patient/SchneiderHounsfieldUnitSections = %i',repmat(' %g',1,numel(densityCorrection.unitSections)),'\n'],numel(densityCorrection.unitSections),densityCorrection.unitSections); fprintf(fID,['uv:Ge/Patient/SchneiderDensityOffset = %i',repmat(' %g',1,numel(densityCorrection.offset)),'\n'],numel(densityCorrection.offset),densityCorrection.offset); % this is needed for a custom fprintf format which formats integers i to 'i.' and floats without trailing zeros - % this is potentially not necessary but was done to mimick the original TOPAS Schneider converter file + % TODO: check whether this can be removed -> this is potentially not necessary but was done to mimick the original TOPAS Schneider converter file TOPASisFloat = mod(densityCorrection.factor,1)==0; fprintf(fID,['uv:Ge/Patient/SchneiderDensityFactor = %i ',strjoin(cellstr(char('%1.01f '.*TOPASisFloat' + '%1.15g '.*~TOPASisFloat'))),'\n'],numel(densityCorrection.factor),densityCorrection.factor); TOPASisFloat = mod(densityCorrection.factorOffset,1)==0; From 9cc05a8067072d25ce3010a9604727b46a5f2ffe Mon Sep 17 00:00:00 2001 From: Pia Stammer <72029019+piastammer@users.noreply.github.com> Date: Fri, 21 Jul 2023 16:53:47 +0200 Subject: [PATCH 4/4] added warning and TODO for single bixel example --- examples/matRad_example12_simpleParticleMonteCarlo.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/matRad_example12_simpleParticleMonteCarlo.m b/examples/matRad_example12_simpleParticleMonteCarlo.m index 172fbaba3..8fe0003b9 100644 --- a/examples/matRad_example12_simpleParticleMonteCarlo.m +++ b/examples/matRad_example12_simpleParticleMonteCarlo.m @@ -82,7 +82,7 @@ %% generate steering file stf = matRad_generateStf(ct,cst,pln); -%stf = matRad_generateSingleBixelStf(ct,cst,pln); %Example to create a single beamlet stf +%stf = matRad_generateSingleBixelStf(ct,cst,pln); %Example to create a single beamlet stf, WARNING: this sometimes does not produce all required output files (TODO: check this) %% analytical dose calculation dij = matRad_calcParticleDose(ct, stf, pln, cst); %Calculate particle dose influence matrix (dij) with analytical algorithm