Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sdorkenw/MeshParty
Browse files Browse the repository at this point in the history
  • Loading branch information
ceesem committed Jul 27, 2023
2 parents 16e9f82 + f9e8ef1 commit 5da0a94
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.16.11
current_version = 1.16.13
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/skeletons.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Again assuming you have a mesh object loaded, the key function is :func:`meshpar

::

from trimesh_io import skeletonize
from meshparty import skeletonize

# skeletonize the mesh using a 12 um invalidation radius
# assuming units of mesh.vertices is in nm
Expand Down
2 changes: 1 addition & 1 deletion meshparty/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.16.11"
__version__ = "1.16.13"
16 changes: 9 additions & 7 deletions meshparty/trimesh_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,15 @@ def _download_meshes_thread_precomputed(args):

while len(download_segids):
download_now = download_segids[:100]
download_segids = download_segids[len(download_now):]

cv_meshes = cv.mesh.get(
download_now,
remove_duplicate_vertices=remove_duplicate_vertices,
fuse=False
)
download_segids = download_segids[len(download_now):]
if isinstance(cv.mesh, ShardedMultiLevelPrecomputedMeshSource):
cv_meshes = cv.mesh.get(download_now)
else:
cv_meshes = cv.mesh.get(
download_now,
remove_duplicate_vertices=remove_duplicate_vertices,
fuse=False
)

for segid, cv_mesh in cv_meshes.items():
mesh = Mesh(
Expand Down
24 changes: 10 additions & 14 deletions meshparty/trimesh_vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,18 @@ def render_actors(actors, camera=None, do_save=False, filename=None,
if VIDEO_WIDTH is not None:
logging.warning('VIDEO_WIDTH is deprecated, please use VIDEO_WIDTH')
video_width=VIDEO_WIDTH
print('setting up renderer')
# create a rendering window and renderer
ren, renWin, iren = _setup_renderer(
video_width, video_height, back_color, camera=camera)
print('done setting up')
for a in actors:
# assign actor to the renderer
ren.AddActor(a)
print('actors added')
# render
if camera is None:
ren.ResetCamera()
else:
ren.ResetCameraClippingRange()
camera.ViewingRaysModified()
print('camera set')
if return_keyframes:
key_frame_cameras = []

Expand All @@ -304,7 +300,6 @@ def vtkKeyPress(obj, event):
return
iren.AddObserver("KeyPressEvent", vtkKeyPress)
renWin.Render()
print('render done')
if do_save is False:
trackCamera = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(trackCamera)
Expand All @@ -324,7 +319,6 @@ def vtkKeyPress(obj, event):
writer.SetFileName(filename)
writer.SetInputData(w2if.GetOutput())
writer.Write()
print('finalizing..')
renWin.Finalize()

if return_keyframes:
Expand Down Expand Up @@ -609,15 +603,17 @@ def skeleton_actor(sk,
data = vertex_data

if data is not None:
if normalize_property:
data = data / np.nanmax(data)
sk_mesh.GetPointData().SetScalars(numpy_to_vtk(data))
lut = vtk.vtkLookupTable()
if lut_map is not None:
lut_map(lut)
lut.Build()
colors, map_colors = process_colors(data, sk.vertices)
vtk_colors = numpy_to_vtk(colors)
vtk_colors.SetName('colors')
sk_mesh.GetPointData().SetScalars(vtk_colors)
if map_colors:
lut = vtk.vtkLookupTable()
if lut_map is not None:
lut_map(lut)
lut.Build()
mapper.SetLookupTable(lut)
mapper.ScalarVisibilityOn()
mapper.SetLookupTable(lut)

actor = vtk.vtkActor()
actor.SetMapper(mapper)
Expand Down

0 comments on commit 5da0a94

Please sign in to comment.