Skip to content

Commit

Permalink
Add skelelton property
Browse files Browse the repository at this point in the history
  • Loading branch information
AlainKadar committed Nov 3, 2023
1 parent 6bdab6b commit 83ad1ba
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions StructuralGT/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ def debubble(g, elements):
g._skeleton = skeletonize_3d(canvas)/255

if g._2d:
g._skeleton_3d = np.swapaxes(np.array([g.skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g.skeleton])
g._skeleton_3d = np.swapaxes(np.array([g._skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g._skeleton])
else:
g._skeleton_3d = np.asarray(g.skeleton)
g._skeleton_3d = np.asarray(g._skeleton)

positions = np.asarray(np.where(g._skeleton_3d!=0)).T
with gsd.hoomd.open(name=g.gsd_name, mode='w') as f:
Expand All @@ -339,10 +339,10 @@ def merge_nodes(g, disk_size):
g._skeleton = skel_ID.merge_nodes(canvas, disk_size)

if g._2d:
g._skeleton_3d = np.swapaxes(np.array([g.skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g.skeleton])
g._skeleton_3d = np.swapaxes(np.array([g._skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g._skeleton])
else:
g._skeleton_3d = np.asarray(g.skeleton)
g._skeleton_3d = np.asarray(g._skeleton)

positions = np.asarray(np.where(g._skeleton_3d!=0)).T
with gsd.hoomd.open(name=g.gsd_name, mode='w') as f:
Expand All @@ -366,10 +366,10 @@ def prune(g, size):
g._skeleton = skel_ID.pruning(canvas, size)

if g._2d:
g._skeleton_3d = np.swapaxes(np.array([g.skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g.skeleton])
g._skeleton_3d = np.swapaxes(np.array([g._skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g._skeleton])
else:
g._skeleton_3d = np.asarray(g.skeleton)
g._skeleton_3d = np.asarray(g._skeleton)

positions = np.asarray(np.where(g._skeleton_3d!=0)).T
with gsd.hoomd.open(name=g.gsd_name, mode='w') as f:
Expand All @@ -393,10 +393,10 @@ def remove_objects(g, size):
g._skeleton = remove_small_objects(canvas, size, connectivity=2)

if g._2d:
g._skeleton_3d = np.swapaxes(np.array([g.skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g.skeleton])
g._skeleton_3d = np.swapaxes(np.array([g._skeleton]), 2, 1)
g._skeleton_3d = np.asarray([g._skeleton])
else:
g._skeleton_3d = np.asarray(g.skeleton)
g._skeleton_3d = np.asarray(g._skeleton)

positions = np.asarray(np.where(g._skeleton_3d!=0)).T
with gsd.hoomd.open(name=g.gsd_name, mode='w') as f:
Expand Down

0 comments on commit 83ad1ba

Please sign in to comment.