Skip to content
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

Conversation

hayakawa16
Copy link
Member

Hi, this is a draft of a PR so I can see file differences and make sure all looks good. I will assign reviewers when I'm ready for review.

hayakawa16 and others added 11 commits February 1, 2024 12:27
…inclusion tissues, I created a MultiConcentricInclusionTissue that MultiConcentricCylinderTissue can use to be created. This allows for possible MultiConcentricEllipsoidTissues to be defined in the future. Modified InfiniteCylinderTissueRegion ContainsPosiiton method to allow to very large radius cylinders (@janakarana found error).  All unit tests pass.  Now can work on refractive index mismatch edits.
…egion boundaries. Added comments to SingleInclusionTissue and MultiConcentricInclusionTissue describing this. Added code in MultiConcentricInclusionTissue to handle reflection and refraction. This will inturn handle MultiConcentricInfiniteCylinderTissue. All unit tests pass. Now onto writing tests to verify these code changes.
…centric-infinite-cylinders-with-refractive-index-mismatch
…oncentricInclusionTissue. Like other tissue classes that provide a general definition that can be invoked by particular classes, e.g. SingleInclusionTissue is used to create SingleEllipsoidTissue, this MultiConcentricInclusionTissue is used to create MultiConcentricInfiniteCylinderTissue. Methods like GetReflectedDirection, GetRefractedDirection are in MultiConcentricInclusionTissue and rely on accessing the SurfaceNormal from the particular inclusion class to know how to code these methods. Rearranged unit tests of class methods to match order methods are in class being tested.
…ts. Some code cleanup in InfiniteCylinderTissueRegion and CylinderTissueRegionToolbox. Corrected MultiConcentricInfiniteTissueInput Validation to NOT check for refractive index mismatch now.
…was previously written for only 2 infinite cylinders, now works for any number of cylinders. Also put back the switch statement particular case that agrees with default. Code cleanup says to remove this particular case but I think it improved readability.
@hayakawa16
Copy link
Member Author

I'm ready for review.

@hayakawa16
Copy link
Member Author

I just saw sonarcloud review. Give me a bit to address these.

@hayakawa16
Copy link
Member Author

Okay I'm ready for review.

Copy link
Member

@janakarana janakarana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks fine to me

Copy link
Member

@lmalenfant lmalenfant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these are just suggestions so I have no problem approving if you don't want to fix them now.

);
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}
Copy link
Member

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.

);
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line feed

new Random());
index = _tissue.GetNeighborRegionIndex(photon);
Assert.AreEqual(2, index);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line feed

var cosTheta = _tissue.GetAngleRelativeToBoundaryNormal(photon);
Assert.AreEqual(1,cosTheta);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line feed

{
FileIO.FileDelete(file);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line feed

var iCloned = FileIO.ReadFromJson<SingleInfiniteCylinderTissueInput>("SingleInfiniteCylinderTissue.txt");

Assert.AreEqual(iCloned.Regions[1].RegionOP.Mua, i.Regions[1].RegionOP.Mua);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line feed

"SingleInfiniteCylinderTissueInput: tissue layer is assumed to be at least a single layer with air layer above and below",
"SingleInfiniteCylinderTissueInput: redefine tissue definition to contain at least a single layer of tissue");
}
if (!tempResult.IsValid) { return tempResult; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the braces here if it is on one line.

"Resize radii and or Center so that infinite cylinders entirely within tissue layer");
}

if (!tempResult.IsValid) { return tempResult; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the braces if the code is on one line.

{
// check that layer definition is valid
var tempResult = MultiLayerTissueInputValidation.ValidateLayers(layers);
if (!tempResult.IsValid){ return tempResult; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the braces if the code is on one line.

"SingleInfiniteCylinderTissueInput: infinite cylinder has radius equal to 0",
"SingleInfiniteCylinderTissueInput: make sure infinite cylinder radius is > 0");
}
if (!tempResult.IsValid) { return tempResult; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the braces if the code is on one line.

@hayakawa16
Copy link
Member Author

Hi @lmalenfant, thanks for your review. I can make these edits.

@hayakawa16
Copy link
Member Author

I have updated code and pushed.

On another topic. I pulled master and ran an infile that I ran in August 2023 and obtained identical results. Then I pulled this branch and ran the same infile. The results are not identical. I think they are statistically equivalent but not sure. I'd like to know for sure before I merge this branch into master.

Copy link

sonarcloud bot commented Feb 28, 2024

@lmalenfant
Copy link
Member

I also noticed that we cannot merge right now because I made the master branch read only. We either have to force push or remove the lock. I checked that box so we can't push to master without a PR. I need to do more research to figure out the best protection.

@hayakawa16
Copy link
Member Author

I've performed my analysis of results using master and this branch and they agree within variance.

@hayakawa16
Copy link
Member Author

I feel okay about merging this into master. Should I check "Merge without waiting for requirements to be met (bypass branch protections)" and click "Merge pull request"?

@lmalenfant
Copy link
Member

@hayakawa16 yes go ahead and merge, I think you just need to check the box and then the button will be available.

@hayakawa16 hayakawa16 merged commit a73fab5 into master Feb 29, 2024
2 checks passed
@hayakawa16 hayakawa16 deleted the feature/122-add-ability-to-use-layered-concentric-infinite-cylinders-with-refractive-index-mismatch branch March 4, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to use layered concentric infinite cylinders with refractive index mismatch
3 participants