mcanet / STL-Volume-Model-Calculator

STL Volume Model Calculator Python
MIT License
150 stars 57 forks source link

Can this calculator convert volume data to stl or isosurface mesh? #20

Open s1kcode opened 11 months ago

s1kcode commented 11 months ago

I got (100,100,100) array data. Can this code convert it to be isosurface or stl obj?

mcanet commented 11 months ago

I push a new version that should be able to make this area and volume calculations using nii and dcm files.

Easy convert to nii:


import numpy as np
import nibabel as nib

# Create a 3D array
data = np.random.rand(100, 100, 100)

# Create a NIfTI image
img = nib.Nifti1Image(data, np.eye(4))

# Save the image
nib.save(img, 'output.nii')

Let me know if it works for you.