|
| 1 | +classdef matRad_ParticleStfGeneratorSingleBeamlet < matRad_ParticleStfGeneratorRayBixelAbstract |
| 2 | + |
| 3 | + properties |
| 4 | + energy; |
| 5 | + end |
| 6 | + |
| 7 | + properties (Constant) |
| 8 | + name = 'Particle Single Beamlet'; |
| 9 | + shortName = 'particleSingleBixel'; |
| 10 | + possibleRadiationModes = {'protons','helium','carbon'}; |
| 11 | + end |
| 12 | + |
| 13 | + methods |
| 14 | + function this = matRad_ParticleStfGeneratorSingleBeamlet(pln) |
| 15 | + if nargin < 1 |
| 16 | + pln = []; |
| 17 | + end |
| 18 | + this@matRad_ParticleStfGeneratorRayBixelAbstract(pln); |
| 19 | + end |
| 20 | + end |
| 21 | + |
| 22 | + methods (Access = protected) |
| 23 | + function pbMargin = getPbMargin(this) |
| 24 | + pbMargin = 0; |
| 25 | + end |
| 26 | + |
| 27 | + function rayPos = getRayPositionMatrix(this,beam) |
| 28 | + % see superclass for information |
| 29 | + rayPos = [0 0 0]; |
| 30 | + end |
| 31 | + |
| 32 | + function beam = setBeamletEnergies(this,beam) |
| 33 | + if isempty(this.energy) |
| 34 | + % Select energy |
| 35 | + else |
| 36 | + [~,ix] = min(abs(this.energy-this.availableEnergies)); |
| 37 | + beam.ray.energy = this.availableEnergies(ix); |
| 38 | + end |
| 39 | + end |
| 40 | + end |
| 41 | + |
| 42 | + methods (Static) |
| 43 | + function [available,msg] = isAvailable(pln,machine) |
| 44 | + % see superclass for information |
| 45 | + |
| 46 | + if nargin < 2 |
| 47 | + machine = matRad_loadMachine(pln); |
| 48 | + end |
| 49 | + |
| 50 | + % Check superclass availability |
| 51 | + [available,msg] = matRad_ParticleStfGeneratorRayBixelAbstract.IsAvailable(pln,machine); |
| 52 | + |
| 53 | + if ~available |
| 54 | + return; |
| 55 | + else |
| 56 | + available = false; |
| 57 | + msg = []; |
| 58 | + end |
| 59 | + |
| 60 | + %checkBasic |
| 61 | + try |
| 62 | + checkBasic = isfield(machine,'meta') && isfield(machine,'data'); |
| 63 | + |
| 64 | + %check modality |
| 65 | + checkModality = any(strcmp(matRad_ParticleStfGeneratorSingleBeamlet.possibleRadiationModes, machine.meta.radiationMode)) && any(strcmp(matRad_ParticleStfGeneratorSingleBeamlet.possibleRadiationModes, pln.radiationMode)); |
| 66 | + |
| 67 | + %Sanity check compatibility |
| 68 | + if checkModality |
| 69 | + checkModality = strcmp(machine.meta.radiationMode,pln.radiationMode); |
| 70 | + end |
| 71 | + |
| 72 | + preCheck = checkBasic && checkModality; |
| 73 | + |
| 74 | + if ~preCheck |
| 75 | + return; |
| 76 | + end |
| 77 | + catch |
| 78 | + msg = 'Your machine file is invalid and does not contain the basic field (meta/data/radiationMode)!'; |
| 79 | + return; |
| 80 | + end |
| 81 | + |
| 82 | + available = preCheck; |
| 83 | + end |
| 84 | + end |
| 85 | +end |
0 commit comments