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

initial commit of bone scaffold #239

Merged
merged 2 commits into from
Mar 23, 2024
Merged

Conversation

vickieshim
Copy link
Contributor

No description provided.

Copy link
Contributor

@mlin865 mlin865 left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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,
Copy link
Contributor

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 (""")

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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',
Copy link
Contributor

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.

Copy link
Contributor Author

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',
Copy link
Contributor

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.

Copy link
Contributor Author

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]]
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Delete space between lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@rchristie rchristie left a 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.

@rchristie rchristie merged commit b06a795 into ABI-Software:main Mar 23, 2024
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.

3 participants