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

How to export 3D mesh #642

Closed
darkworks opened this issue May 1, 2024 · 1 comment
Closed

How to export 3D mesh #642

darkworks opened this issue May 1, 2024 · 1 comment
Labels
question Troubleshooting requests

Comments

@darkworks
Copy link

darkworks commented May 1, 2024

Describe the problem
I want to reconstruct 3D mesh and export it to dxf or stl etc from tiff files. I had captured X-ray images of PCB BGA socket via scanner from various angles. I have total 60 tiff images. so am wondering how to reconstruct 3d mesh properly and export it to dxf or stl. so that can be viewed in 3d programs. I know dragonfly like programs can be used to generate 3d mesh but its commercial so i wonder something like dragonfly we can do here in opensource world or not

Sample code

import tomopy
import numpy as np
import dxchange
import matplotlib.pyplot as plt
from mayavi import mlab

# Set the file path and file prefix
file_path = '/home/techsys/Downloads/20240417_123930_bga_test_60proj/tif/'
file_prefix = ''

# Set the number of TIF files
num_files = 60

# Create a list of indices for the files to read
ind = list(range(1, num_files + 1))

# Read the TIF files into a 3D array
tif_files = [file_path + file_prefix + '{:02d}.tif'.format(i) for i in ind]
data = dxchange.reader.read_tiff_stack(tif_files[0], ind=ind)
data.shape, data.min(), data.max()

# compute angle
theta = tomopy.angles(data.shape[0], 0, 360)

# Find the rotation centre
rot_center = tomopy.find_center_vo(data)

# Reconstruct the 3D volume
recon = tomopy.recon(data, theta, center=rot_center, algorithm='gridrec')

# Save and Visualize 3d mesh
# How to save it to dxf or stl ? any tomopy call ?

images

image

@darkworks darkworks added the question Troubleshooting requests label May 1, 2024
@carterbox
Copy link
Member

TomoPy does not have any visualization or mesh processing algorithms. It is a tomography reconstruction library only, so these capabilities are out of the scope of this project.

Look for implementations (elsewhere) of the marching cubes algorithm to convert your data from a dense volume to sparse surface mesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Troubleshooting requests
Projects
None yet
Development

No branches or pull requests

2 participants