-
Notifications
You must be signed in to change notification settings - Fork 35
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
initial commit of bone scaffold #239
Conversation
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.
@vickieshim - I have added some suggestion to clean up the current code. In addition, it would be good to get the annotations in once you have that ready. I would also suggest writing a unit test for bone1. You can look at tests/test_cylinder.py and come up with something similar for testing bone1. Let me know if you need any help or have any question.
from scaffoldmaker.utils.shieldmesh import ShieldMesh3D | ||
from scaffoldmaker.utils.spheremesh import SphereMesh, SphereShape | ||
from scaffoldmaker.utils.zinc_utils import exnode_string_from_nodeset_field_parameters | ||
from scaffoldmaker.utils.derivativemoothing import DerivativeSmoothing |
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.
Delete line if not planning to use DerivativeSmoothing
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.
Leaving it just in case
|
||
class MeshType_3d_bone1 (Scaffold_base): | ||
""" | ||
Generates a solid cylinder using a ShieldMesh of all cube elements, |
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.
Ident to match indentation of start of docstring (""")
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.
Done
'Upper scale': 1.0, | ||
'Upper scale_Z': 1.0, | ||
'Lower scale': 1.0, | ||
'Lower scale_Z': 2.0 |
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 'Lower scale_Z' set as 2.0 for a specific reason?
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.
Changed to 1
'Number of elements across transition', | ||
'Number of elements along', | ||
'Shell element thickness proportion', | ||
# 'Lower half', |
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.
Delete line if you are not planning to use it 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.
Deleted
'Refine', | ||
'Refine number of elements across major', | ||
'Refine number of elements along', | ||
'Upper scale', |
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.
Move these 4 scaling parameters ('Upper scale', 'Upper scale_Z', 'Lower scale', 'Lower_scale_Z') to before the "Refine" option to be consistent with the style in all our other scaffolds.
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.
Done
hemisphere2.nodeId[elementsCountAcross[2] // 2][n2][n1] = nodesIdCylinderDistalEnd[count] | ||
count += 1 | ||
|
||
# # rangeOfRequiredElements = [[0, elementsCountAcross[0]], [0, elementsCountAcross[1]], [0, 1]] |
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.
Delete block o commented out code
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.
Done
# # annotationGroup.createMarkerNode(nodeIdentifier, coordinates, boneCoordinatesValues) | ||
# # nodeIdentifier += 1 | ||
|
||
# smoothing = DerivativeSmoothing(region, coordinates) |
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.
Delete if not planning to use derivative smoothing
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.
Done
rangeOfRequiredElements) | ||
|
||
# *********************************************************************************************************************** | ||
# top half of the hemisphere |
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 code for making the second hemisphere follows the same structure as the ones used in the first hemisphere, with some difference in parameters. Try combining them into one set of code with a loop instead of having two sets of similar code. It will reduce the length of the code and make your code look more elegant.
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.
Will try at the next iteration?
@@ -0,0 +1,461 @@ | |||
""" | |||
Generates a solid bone using a ShieldMesh of all cube elements, | |||
with variable numbers of elements in major, minor, shell and axial directions. |
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.
remove space at start of line
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.
Done
options['Number of elements across major'] = 4 | ||
if options['Number of elements across major'] % 2: | ||
options['Number of elements across major'] += 1 | ||
|
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.
Delete space between lines
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.
Done
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.
To really make it a valid bone scaffold it should have 1 or more in-built parameter sets that make more realistic bone shapes, and these need annotations.
Furthermore it lacks a test to validate it works going forward.
Approving as it works, and completing it will be easier with it in the codebase.
No description provided.