-
Notifications
You must be signed in to change notification settings - Fork 17
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
Resolve #47 #48
Resolve #47 #48
Conversation
- ensure parentStructure attribute is initialized by calling AllenCompartment.getTreePath() - fix bug in AllenCompartment.getChildren() - set pre-computed volume for mouse brain root OBJMesh - AllenUtils.getOntologies() returns List instead of Collection - create tests for AllenCompartment and AllenUtils - misc code cleanup
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.
Nice! the tests are going to be super important
@@ -340,7 +336,7 @@ public OBJMesh getMesh() { | |||
*/ | |||
@Override | |||
public boolean isParentOf(final BrainAnnotation childCompartment) { | |||
if (childCompartment == null || !(childCompartment instanceof AllenCompartment)) |
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.
@carshadi , won't you get a NPE here if the childCompartment being tested is null? nodes in a reconstruction can be associated with a null compartment, e.g., isParentOf((AllenCompartment)null);
Why remove the null check?
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.
IntelliJ suggested that the null check was not necessary, apparently instanceof
returns false
if the operand is null
https://stackoverflow.com/questions/2950319/is-null-check-needed-before-calling-instanceof
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.
I did not know that! good to know. Oh boy. I should adopt IntelliJ. I have never be warned in Eclipse, and have been doing null checks from day one!
@@ -258,33 +259,29 @@ public AllenCompartment getAncestor(final int level) { | |||
final ArrayList<AllenCompartment> children = new ArrayList<>(); | |||
final Collection<AllenCompartment> allCompartments = AllenUtils.getOntologies(); | |||
for (AllenCompartment c : allCompartments) { | |||
if (isChildOf(c) && c.getTreePath().size() <= maxLevel) | |||
if (c.isChildOf(this) && c.getTreePath().size() <= maxLevel) |
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.
nice! quite embarrassing how this war wrong
Resolve #47
parentStructure
attribute is initialized by callingAllenCompartment.getTreePath()
AllenCompartment.getChildren(final int level)
OBJMesh
AllenUtils.getOntologies()
returnsList
instead ofCollection
AllenCompartment
andAllenUtils
pinging @tferr