marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
1.98k stars 257 forks source link

Bug: Thumbnail slices part of mesh #1085

Closed JeffreyWardman closed 2 months ago

JeffreyWardman commented 2 months ago
import vedo
import numpy as np

mesh = vedo.Mesh("snare.stl")

image_size=224
num_views = 16
sqrt_num_views = 4
images = []
for i in range(sqrt_num_views):
    for j in range(sqrt_num_views):
        image = mesh.thumbnail(
            size=(image_size, image_size),
            azimuth=360 * i / sqrt_num_views - 180,
            elevation=180 * j / sqrt_num_views - 90,
            zoom=1.25,
            axes=1,
        )
        images.append(image)

images = np.array(images)

ncols = np.floor(np.sqrt(num_views))
nrows = np.ceil(np.sqrt(num_views))

# Create a figure and axes
fig, axs = plt.subplots(4, 4, figsize=(10, 10))

# Flatten axes for easier indexing
axs = axs.flatten()

# Loop through each image and plot
for i in range(16):
    axs[i].imshow(images[i])
    # axs[i].axis("off")  # Turn off axis

# Adjust layout
plt.tight_layout()

# Show plot
plt.show()

snare.zip

marcomusy commented 2 months ago

fixed in master