-
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
Merged
+499
−174
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
2b513f3
Minor bug fix: correct call to matRad_getIsocenter
remocristoforetti 786c0f4
Minor bug fix: explicit direction for mean(), effective if only one v…
remocristoforetti d095e94
Bug fix: add rangeShifterEq thickness as property
remocristoforetti d4ba549
Allow user to set rangeShifterEqThickness
remocristoforetti e2f9e8e
Bug fix: handle of target entry/exit point when taregt begins/ends on…
remocristoforetti c8b6743
Bug fix: get equivalent thickness of range shifter
remocristoforetti 4436e6a
Big fix: call to matRad_calcSigmaRashi
remocristoforetti be84504
Allow access to getRangeShiftersFromStf
remocristoforetti 9814d26
Bug fix: handling of range shifters
remocristoforetti 924c44b
Allow for special characters in filenames for system call
remocristoforetti 238b83b
Big fix: Move position of range shifter
remocristoforetti 7a223f1
Add tests for range shfter generation and calculation
remocristoforetti b05a836
Add test for matRad_calcSigmaRashi
remocristoforetti 1834041
Bug fix: range shifter field handling
remocristoforetti 856730b
Remove plotting from raShi test
remocristoforetti 8bc7fd9
Update use of round functon for Octave compatibility
remocristoforetti 7390a02
Minor typo fixes; add externalCalculation option for MCsquare engine
remocristoforetti aeb01c6
Remove read external option for MCsquare
remocristoforetti 9790a96
Octave compatibility for MCsquare test
remocristoforetti 550b64a
Octave test compatibility
remocristoforetti 5e6a53c
Merge branch 'dev' of https://github.com/e0404/matRad into dev_rangeS…
remocristoforetti 5954592
change visBool to visualize
remocristoforetti e367933
change diff_voi to camelCase notation
remocristoforetti 1878540
Removed else-end
remocristoforetti f2b3dee
Remove comment
remocristoforetti 404e963
Update info display for range shifter
remocristoforetti d286410
minor bug fix
remocristoforetti aea37e7
typo fix
remocristoforetti f9aad41
Fix name test_suite
remocristoforetti 3c35b5e
Bug fix for error when only bixels with range shifter are present
remocristoforetti 3f0deac
Add raShi MCsqaure test
remocristoforetti f9f8689
Merge branch 'dev' of https://github.com/e0404/matRad into dev_rangeS…
remocristoforetti ad41ae5
Octave compatibility
remocristoforetti adb603f
Merge branch 'dev' into dev_rangeShifterMCFix
wahln File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
449 changes: 298 additions & 151 deletions
449
matRad/doseCalc/+DoseEngines/matRad_ParticleMCsquareEngine.m
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ | |
|
|
||
|
|
||
| % Calculated isocenter. | ||
| isoCenter = mean(coord); | ||
| isoCenter = mean(coord, 1); | ||
|
|
||
|
|
||
| % Visualization | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wahln marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| 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 | ||
| 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 | ||
| 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 | ||
|
|
||
| function test_MCsquareRaShi | ||
| 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'); | ||
|
|
||
| pln.propStf.gantryAngles = 0; | ||
| pln.propStf.couchAngles = 0; | ||
| stfGenerator = matRad_StfGeneratorParticleSingleBeamlet(pln); | ||
| stfGenerator.useRangeShifter = true; | ||
| stf = stfGenerator.generate(ct,cst); | ||
|
|
||
|
|
||
| w = 1; | ||
|
|
||
| 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); | ||
|
|
||
| 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, "####RangeShifterWaterEquivalentThickness"))); | ||
| assertTrue(str2double(linesBixelFile(find(strcmp(linesBixelFile, "####RangeShifterWaterEquivalentThickness"))+1)) == stf.ray.rangeShifter.eqThickness); | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.