How to create polygonal mesh of a moving object in an image stack

2 views (last 30 days)
I have image stack of moving object. How can I draw a polygonal mesh of this object?

Answers (1)

TED MOSBY
TED MOSBY on 25 Mar 2025
Hi Rom,
You can stack your individual images(slices) along the 3rd dimension. If you already have the 3D volume then skip this step.
If you have a labeled or thresholded volume where the object is “1” (or some nonzero label) and everything else is “0,” you’re good to go. Otherwise, you can use thresholding, morphological operations, or more advanced segmentation methods (like active contours, deep learning, etc.) to isolate the region of interest.
Then use 'isosurface' and 'isosurface' related functions (like 'isonormals') to create a polygon mesh (triangulated surface) of an isosurface in a 3D volume.
An example code might look like below:
% Suppose you have a 3D volume called volumeData of size [X Y Z]
% where the object has intensity values of 1 (or above some threshold)
% and the background is 0.
% 1) Generate an isosurface at an isovalue
isosurfVal = 0.5; % For a binary volume with 0 and 1
p = patch(isosurface(volumeData, isosurfVal));
% 2) Optionally compute normals for better visualization
isonormals(volumeData, p);
set(p, 'FaceColor', 'red', 'EdgeColor', 'none');
% 3) Adjust aspect ratio and visualize
daspect([1 1 1]);
view(3);
axis tight;
camlight;
lighting gouraud;
Feel free to adjust the code according to your use case.
Hope this helps!

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!