3D Medical Reconstruction
CT Volume Rendering
import numpy as np
from skimage import measure
class VolumeRenderer:
def __init__(self, volume, spacing):
self.volume, self.spacing = volume, spacing
def maximum_intensity_projection(self, axis=2):
return np.max(self.volume, axis=axis)
def generate_mesh(self, iso_value):
verts, faces, normals, _ = measure.marching_cubes(
self.volume, level=iso_value, spacing=self.spacing)
return {'vertices': verts, 'faces': faces, 'normals': normals}