Skip to content

Commit

Permalink
Bugfix/topas cordinate system (#790)
Browse files Browse the repository at this point in the history
* load scenario model

* TOAPS interface axis change

The beam direction is now alway along the topas world axis Z, and the patient is rotated accordingly

* some sanitizing and small bugfixes

---------

Co-authored-by: Niklas Wahl <[email protected]>
  • Loading branch information
JenHardt and wahln authored Nov 18, 2024
1 parent 30d5d9b commit 4a509ef
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
pln = [];
else
if ~(isstruct(pln) || isempty(pln))
matRad_cfg.dispError('Invalid pln!');
matRad_cfg.dispError('Invalid pln struct!');
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ function assignBioModelPropertiesFromPln(this, plnModel, warnWhenPropertyChanged
% already performed in dij construction

resultGUI = [];

if ~isa(this.multScen,'matRad_ScenarioModel')
this.multScen = matRad_ScenarioModel.create(this.multScen,struct('numOfCtScen',ct.numOfCtScen));
end

for i = 1:this.multScen.totNumScen
scenSubIx = this.multScen.linearMask(i,:);
Expand Down
4 changes: 2 additions & 2 deletions matRad/doseCalc/+DoseEngines/matRad_TopasMCEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ function writePatient(obj,ct,pln)
fprintf(fID,'d:Ma/%s/Density = %f g/cm3\n',unique_materials{ix},unique_rsp(ix));
end

fprintf(fID,'s:Ge/Patient/Parent="World"\n');
fprintf(fID,'s:Ge/Patient/Parent="Isocenter"\n');
fprintf(fID,'s:Ge/Patient/Type = "TsImageCube"\n');
fprintf(fID,'s:Ge/Patient/InputDirectory = "./"\n');
fprintf(fID,'s:Ge/Patient/InputFile = "%s"\n',dataFile);
Expand Down Expand Up @@ -2348,7 +2348,7 @@ function writePatient(obj,ct,pln)
% write patient environment
matRad_cfg.dispInfo('TOPAS: Writing patient environment\n');
fprintf(fID,'\n# -- Patient parameters\n');
fprintf(fID,'s:Ge/Patient/Parent="World"\n');
fprintf(fID,'s:Ge/Patient/Parent="Isocenter"\n');
fprintf(fID,'s:Ge/Patient/Type = "TsImageCube"\n');
fprintf(fID,'b:Ge/Patient/DumpImagingValues = "True"\n');
fprintf(fID,'s:Ge/Patient/InputDirectory = "./"\n');
Expand Down
29 changes: 13 additions & 16 deletions matRad/doseCalc/topas/world/TOPAS_matRad_geometry.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,23 @@ d:Ge/World/HLY=200.0 cm
d:Ge/World/HLZ=200.0 cm
b:Ge/World/Invisible = "TRUE"

s:Ge/Nozzle/Parent = "Isocenter"
s:Ge/Nozzle/Parent = "World"
s:Ge/Nozzle/Type = "Group"

s:Ge/Isocenter/Parent = "Gantry"
s:Ge/Isocenter/Parent = "Couch"
s:Ge/Isocenter/Type = "Group"
d:Ge/Isocenter/RotX = +90. deg
d:Ge/Isocenter/RotX = -90. deg
d:Ge/Isocenter/RotY = 0. deg
d:Ge/Isocenter/RotZ = +90. deg
d:Ge/Isocenter/RotZ = 0. deg

s:Ge/Gantry/Parent = "Couch"
s:Ge/Gantry/Type = "Group"
d:Ge/Gantry/RotX = 0. deg
d:Ge/Gantry/RotY = 0. deg
d:Ge/Gantry/RotZ = -1 * Sim/GantryAngle deg

s:Ge/Couch/Parent = "World"
s:Ge/Couch/Parent = "Gantry"
s:Ge/Couch/Type = "Group"
d:Ge/Couch/TransX = 0. cm
d:Ge/Couch/TransY = 0. cm
d:Ge/Couch/TransZ = 0. cm
d:Ge/Couch/RotX = 0. deg
d:Ge/Couch/RotY = -1 * Sim/CouchAngle deg
d:Ge/Couch/RotZ = 0. deg
d:Ge/Couch/RotY = 0. deg
d:Ge/Couch/RotZ = Sim/CouchAngle deg

s:Ge/Gantry/Parent = "World"
s:Ge/Gantry/Type = "Group"
d:Ge/Gantry/RotX = Sim/GantryAngle deg
d:Ge/Gantry/RotY = 0 deg
d:Ge/Gantry/RotZ = -90. deg
2 changes: 1 addition & 1 deletion matRad/planAnalysis/matRad_compareDose.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
posZ = posZ - isoCenterIx(3);
end

if exist('pln','var') && ~isempty(pln)
if exist('pln','var') && ~isempty(pln) && isfield(pln,'propOpt') && isfield(pln.propOpt,'quantityOpt')
if strcmp(pln.propOpt.quantityOpt,'physicalDose')
yLabelString = 'Dose [Gy]';
else
Expand Down

0 comments on commit 4a509ef

Please sign in to comment.