-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feature/122 add ability to use layered concentric infinite cylinders with refractive index mismatch #133
Merged
hayakawa16
merged 17 commits into
master
from
feature/122-add-ability-to-use-layered-concentric-infinite-cylinders-with-refractive-index-mismatch
Feb 29, 2024
Merged
Feature/122 add ability to use layered concentric infinite cylinders with refractive index mismatch #133
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8d0f0a0
To enable further expansion of tissue types to have multi-concentric …
hayakawa16 d478ef9
Determined that Photon masterminds crossing or reflecting at tissue r…
hayakawa16 2c42617
Merge branch 'master' into feature/122-add-ability-to-use-layered-con…
hayakawa16 a49b04f
Added new unit test class for new class added in prior commit, MultiC…
hayakawa16 afd25e1
Added new SingleInfiniteCylinderTissueTests because was not added whe…
hayakawa16 ce9e150
Code improvement and code correction for a MultiConcentricInfiniteCyl…
janakarana 1e26d76
Fixed failing unit test. Negative sign was missing.
janakarana 5f1c1ac
Added SingleInfiniteCylinderTissueTissueValidation and associated Tes…
hayakawa16 21f0ef9
Fixed GetNeighborRegionIndex in MultiConcentricInclusionTissue. This…
hayakawa16 4c0fcfc
Added SlantedRecessedFiber detector to loadMCResults.m and load_resul…
hayakawa16 c4f2e33
Put back 'datanames' for general use.
hayakawa16 a17fc4d
Code clean up of branch in preparation for PR review.
hayakawa16 acb7db7
Merge branch 'master' into feature/122-add-ability-to-use-layered-con…
hayakawa16 183b53c
More cleanup after sonarcloud review.
hayakawa16 8f73dac
Hopefully cleaned up issue of unreachable code path and of using type…
hayakawa16 7a86d09
Try again to modify code so that all code paths reachable.
hayakawa16 6f8a824
PR review code clean up.
hayakawa16 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 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 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 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
207 changes: 207 additions & 0 deletions
207
...DataStructuresValidation/TissueInputs/SingleInfiniteCylinderTissueInputValidationTests.cs
This file contains 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,207 @@ | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Vts.Common; | ||
using Vts.MonteCarlo; | ||
using Vts.MonteCarlo.Detectors; | ||
using Vts.MonteCarlo.Sources; | ||
using Vts.MonteCarlo.Tissues; | ||
|
||
namespace Vts.Test.MonteCarlo.DataStructuresValidation.TissueInputs | ||
{ | ||
[TestFixture] | ||
public class SingleInfiniteCylinderTissueInputValidationTests | ||
{ | ||
/// <summary> | ||
/// Test to check that underlying MultiLayerTissue is good | ||
/// </summary> | ||
[Test] | ||
public void validate_underlying_multilayer_tissue_definition() | ||
{ | ||
var input = new SimulationInput( | ||
10, | ||
"", | ||
new SimulationOptions(), | ||
new DirectionalPointSourceInput(), | ||
new SingleInfiniteCylinderTissueInput( | ||
new InfiniteCylinderTissueRegion( | ||
new Position(0, 0, 10), | ||
2.0, | ||
new OpticalProperties()), | ||
// define layer tissues that are incorrect | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, 20.0), | ||
new OpticalProperties(0.01, 1.0, 0.8, 1.4)), | ||
new LayerTissueRegion( | ||
new DoubleRange(100.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
} | ||
), | ||
new List<IDetectorInput>() | ||
{ | ||
new FluenceOfXAndYAndZDetectorInput() | ||
} | ||
); | ||
var result = SimulationInputValidation.ValidateInput(input); | ||
Assert.IsFalse(result.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Test to check that infinite cylinders have non-zero axis definitions. | ||
/// </summary> | ||
[Test] | ||
public void validate_infinite_cylinder_has_nonzero_radii() | ||
{ | ||
var input = new SimulationInput( | ||
10, | ||
"", | ||
new SimulationOptions(), | ||
new DirectionalPointSourceInput(), | ||
new SingleInfiniteCylinderTissueInput( | ||
// set one infinite cylinder radius to 0.0 | ||
new InfiniteCylinderTissueRegion( | ||
new Position(0, 0, 1), | ||
0.0, // radius=0 | ||
new OpticalProperties()), | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, 20.0), | ||
new OpticalProperties(0.01, 1.0, 0.8, 1.4)), | ||
new LayerTissueRegion( | ||
new DoubleRange(20.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
} | ||
), | ||
new List<IDetectorInput>() | ||
{ | ||
new FluenceOfXAndYAndZDetectorInput() | ||
} | ||
); | ||
var result = SimulationInputValidation.ValidateInput(input); | ||
Assert.IsFalse(result.IsValid); | ||
} | ||
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. Line feed |
||
|
||
/// <summary> | ||
/// Test to check that at least one tissue layer is defined | ||
/// </summary> | ||
[Test] | ||
public void validate_at_least_one_tissue_layer_defined() | ||
{ | ||
var input = new SimulationInput( | ||
10, | ||
"", | ||
new SimulationOptions(), | ||
new DirectionalPointSourceInput(), | ||
new SingleInfiniteCylinderTissueInput( | ||
new InfiniteCylinderTissueRegion( | ||
new Position(0, 0, 1), | ||
2.0, | ||
new OpticalProperties()), | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
} | ||
), | ||
new List<IDetectorInput>() | ||
{ | ||
new FluenceOfXAndYAndZDetectorInput() | ||
} | ||
); | ||
var result = SimulationInputValidation.ValidateInput(input); | ||
Assert.IsFalse(result.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Test to check that infinite cylinder is entirely contained within tissue layer | ||
/// </summary> | ||
[Test] | ||
public void validate_infinite_cylinders_are_within_tissue_layer() | ||
{ | ||
var input = new SimulationInput( | ||
10, | ||
"", | ||
new SimulationOptions(), | ||
new DirectionalPointSourceInput(), | ||
new SingleInfiniteCylinderTissueInput( | ||
// set infinite cylinder radius to go beyond layer | ||
new InfiniteCylinderTissueRegion( | ||
new Position(0, 0, 1), | ||
15.0, | ||
new OpticalProperties()), | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, 20.0), | ||
new OpticalProperties(0.01, 1.0, 0.8, 1.4)), | ||
new LayerTissueRegion( | ||
new DoubleRange(20.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
} | ||
), | ||
new List<IDetectorInput>() | ||
{ | ||
new FluenceOfXAndYAndZDetectorInput() | ||
} | ||
); | ||
var result = SimulationInputValidation.ValidateInput(input); | ||
Assert.IsFalse(result.IsValid); | ||
} | ||
|
||
/// <summary> | ||
/// Test to check two layer tissue with one layer enclosing concentric infinite cylinders works | ||
/// </summary> | ||
[Test] | ||
public void validate_infinite_cylinder_within_one_layer_of_multilayer_works() | ||
{ | ||
var input = new SimulationInput( | ||
10, | ||
"", | ||
new SimulationOptions(), | ||
new DirectionalPointSourceInput(), | ||
new SingleInfiniteCylinderTissueInput( | ||
new InfiniteCylinderTissueRegion( | ||
new Position(0, 0, 5), | ||
2.0, | ||
new OpticalProperties(1.0, 1.0, 0.8, 1.4)), | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, 10.0), | ||
new OpticalProperties(0.01, 1.0, 0.8, 1.4)), | ||
new LayerTissueRegion( | ||
new DoubleRange(10.0, 20.0), | ||
new OpticalProperties(0.1, 1.5, 0.8, 1.3)), | ||
new LayerTissueRegion( | ||
new DoubleRange(20.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
} | ||
), | ||
new List<IDetectorInput>() | ||
{ | ||
new FluenceOfXAndYAndZDetectorInput() | ||
} | ||
); | ||
var result = SimulationInputValidation.ValidateInput(input); | ||
Assert.IsTrue(result.IsValid); | ||
} | ||
} | ||
} |
This file contains 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.
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.
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.
This is nitpicky but I like to see a space between methods and therefore a line feed after the method and before the comments for the next method. I use space to help me find the individual methods.