-
Notifications
You must be signed in to change notification settings - Fork 199
Range shifter positioning for MC and minor bug fixing #880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
2b513f3
786c0f4
d095e94
d4ba549
e2f9e8e
c8b6743
4436e6a
be84504
9814d26
924c44b
238b83b
7a223f1
b05a836
1834041
856730b
8bc7fd9
7390a02
aeb01c6
9790a96
550b64a
5e6a53c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ | |
|
|
||
|
|
||
| % Calculated isocenter. | ||
| isoCenter = mean(coord); | ||
| isoCenter = mean(coord, 1); | ||
|
|
||
|
|
||
| % Visualization | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -125,9 +125,21 @@ | |||||
| end | ||||||
|
|
||||||
| % find target entry & exit | ||||||
| diff_voi = [diff([rho{shiftScen}{end}])]; | ||||||
| entryIx = find(diff_voi == 1); | ||||||
| exitIx = find(diff_voi == -1); | ||||||
| if rho{shiftScen}{end}(1)~=0 | ||||||
| matRad_cfg.dispWarning('Target entry on the first voxel'); | ||||||
| entryIx = 1; | ||||||
| else | ||||||
| diff_voi = [diff([rho{shiftScen}{end}])]; | ||||||
| entryIx = find(diff_voi == 1); | ||||||
| end | ||||||
|
|
||||||
| if rho{shiftScen}{end}(end)~=0 | ||||||
| matRad_cfg.dispWarning('Target exit on the last voxel'); | ||||||
| exitIx = numel(rho{shiftScen}{1}); | ||||||
|
||||||
| exitIx = numel(rho{shiftScen}{1}); | |
| exitIx = numel(rho{shiftScen}{end}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff_voi does not align with camelCase naming convention actually.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| properties | ||
| useRangeShifter = false; | ||
| rangeShifterEqD | ||
| end | ||
|
|
||
| properties (Access = protected) | ||
|
|
@@ -66,10 +67,18 @@ function initialize(this) | |
| if this.useRangeShifter | ||
| %For now only a generic range shifter is used whose thickness is | ||
| %determined by the minimum peak width to play with | ||
| rangeShifterEqD = round(min(this.availablePeakPos)* 1.25); | ||
| this.availablePeakPosRaShi = this.availablePeakPos - rangeShifterEqD; | ||
|
|
||
| matRad_cfg.dispWarning('Use of range shifter enabled. matRad will generate a generic range shifter with WEPL %f to enable ranges below the shortest base data entry.',rangeShifterEqD); | ||
|
|
||
| if isempty(this.rangeShifterEqD) | ||
| this.rangeShifterEqD = round(min(this.availablePeakPos)* 1.25); | ||
| end | ||
|
|
||
| this.availablePeakPosRaShi = this.availablePeakPos - this.rangeShifterEqD; | ||
|
|
||
| % Available PeakPositionRaShi has to have same size() as | ||
| % availablePeaPos for indexing | ||
| this.availablePeakPosRaShi(this.availablePeakPosRaShi<0) = 0; | ||
|
|
||
| matRad_cfg.dispWarning('Use of range shifter enabled. matRad will generate a generic range shifter with WEPL %f to enable ranges below the shortest base data entry.',this.rangeShifterEqD); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning now only makes sense if the rangeShifterEqD is not provided, right?
|
||
| end | ||
|
|
||
| if sum(this.availablePeakPos<0)>0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| properties | ||
| energy; | ||
| raShiThickness = 50; %Range shifter to be used if useRangeShifter = true; | ||
| visBool = false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like "visBool". Alternative suggestions? "visualize"? |
||
| end | ||
|
|
||
| properties (Constant) | ||
|
|
@@ -50,12 +51,12 @@ function createPatientGeometry(this) | |
| matRad_cfg = MatRad_Config.instance(); | ||
|
|
||
| if isempty(this.isoCenter) | ||
| this.isoCenter = matRad_getIsoCenter(this.cst,this.ct,visBool); | ||
| this.isoCenter = matRad_getIsoCenter(this.cst,this.ct,this.visBool); | ||
| end | ||
|
|
||
| if ~isequal(size(this.isoCenter),[this.numOfBeams,3]) && ~size(this.isoCenter,1) ~= 1 | ||
| matRad_cfg.dispWarning('IsoCenter invalid, creating new one automatically!'); | ||
| this.isoCenter = matRad_getIsoCenter(this.cst,this.ct,visBool); | ||
| this.isoCenter = matRad_getIsoCenter(this.cst,this.ct,this.visBool); | ||
| end | ||
|
|
||
| if size(this.isoCenter,1) == 1 | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this also test with range shifter? I don't see it. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| function test_suite = test_MCsquareEngine | ||
|
|
||
| test_functions=localfunctions(); | ||
|
|
||
| initTestSuite; | ||
|
|
||
|
|
||
| function test_MCsquareDoseCalcBasic | ||
|
|
||
| matRad_cfg = MatRad_Config.instance(); | ||
| radModes = DoseEngines.matRad_ParticleMCsquareEngine.possibleRadiationModes; | ||
|
|
||
| for i = 1:numel(radModes) | ||
| load([radModes{i} '_testData.mat']); | ||
| pln.bioModel = matRad_bioModel(radModes{i},'none'); | ||
|
|
||
| w = ones(1,sum([stf(:).totalNumOfBixels])); | ||
|
|
||
| pln.propDoseCalc.engine = 'MCsquare'; | ||
| pln.propDoseCalc.externalCalculation = 'write'; | ||
| pln.propDoseCalc.numHistoriesDirect = 42; | ||
| resultGUI = matRad_calcDoseForward(ct,cst,stf,pln, w); | ||
|
|
||
| assertTrue(exist(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare'), 'dir')==7); % Check it exists and its a folder | ||
| assertTrue(exist(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'MCsquareConfig.txt'), 'file')==2); | ||
| assertTrue(exist(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'currBixels.txt'), 'file')==2); | ||
|
|
||
|
|
||
| % Check parameters | ||
| % Read config file | ||
| % linesConfigFile = readlines(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'MCsquareConfig.txt')); | ||
| fid = fopen(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'MCsquareConfig.txt'),'r'); | ||
| linesConfigFile = {}; | ||
| while ~feof(fid) | ||
| linesConfigFile{end+1,1} = fgetl(fid); | ||
| end | ||
| fclose(fid); | ||
|
|
||
|
|
||
| assertTrue(any(strcmp(linesConfigFile, "Num_Primaries 42"))); | ||
|
|
||
| % Read currBixel file | ||
| % linesBixelFile = readlines(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'currBixels.txt')); | ||
| fid = fopen(fullfile(matRad_cfg.primaryUserFolder, 'MCsquare', 'currBixels.txt'),'r'); | ||
| linesBixelFile = {}; | ||
| while ~feof(fid) | ||
| linesBixelFile{end+1,1} = fgetl(fid); | ||
| end | ||
| fclose(fid); | ||
|
|
||
| assertTrue(any(strcmp(linesBixelFile, "##NumberOfFields"))); | ||
| assertTrue(str2double(linesBixelFile(find(strcmp(linesBixelFile, "##NumberOfFields"))+1)) == numel(stf)); | ||
|
|
||
| end | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| function test_suite= test_sigmaRashi | ||
|
|
||
| test_functions=localfunctions(); | ||
|
|
||
| initTestSuite; | ||
|
|
||
| function test_calcSigmaRashi | ||
|
|
||
| baseDataEntry.range = 100; | ||
|
|
||
| rangeShifter.ID = 1; | ||
| rangeShifter.eqThickness = 1; | ||
| rangeShifter.sourceRashiDistance = 9000; | ||
|
|
||
| SSD = 10000; | ||
|
|
||
| sigma = matRad_calcSigmaRashi(baseDataEntry, rangeShifter, SSD); | ||
|
|
||
| assertElementsAlmostEqual(sigma,1.1,'relative',1e-2,1e-2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out access modifier changes the visibility of the
getRangeShiftersFromStfmethod from protected to public. This should either have the comment removed (if making it public is intentional) or be reverted toAccess = protected. Leaving it commented out is unclear and appears incomplete.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there actually a reason why this is commented? Could it be deleted?