Filter particular voxels from 3D volume and then reconstruct the volume

2 vues (au cours des 30 derniers jours)
Hi guys, I need some help with the following issue. A 3D volume is read. The value at each voxel indicates a particular characteristic. So let's say the 3D volume read is a box. Then at voxel value = 1, you find a cone inside that box. At voxel value = 2, you find a sphere inside that box and so on. What I want to do is filter the voxels which have a particular value, and then reconstruct the volume they represent. So if I want to filter out for 1, I want to reconstruct the cone using all the voxels that have the value 1.
I have filtered out the voxels I'm interested in using this but I'm not sure what to use for reconstructing the volume and how. I tried using isosurface but failed. Thank you!
for i=1:box_dims(1)
for j=1:box_dims(2)
for k=1:box_dims(3)
if V(i,j,k)==1
end
end
end
end

Réponse acceptée

Image Analyst
Image Analyst le 16 Jan 2016
It's very very simple - just one line of code. Let's say you want the blob labeled #2, just do this:
output = ismember(V, 2);
  2 commentaires
Image Analyst
Image Analyst le 16 Jan 2016
iijoclu's "Answer" moved here because it's a Comment to me, not an independent Answer to the original question at the top of the page:
Edit - stupid question. So I have used this:
output = ismember(V, 2);
output = smooth3(output);
patch(isosurface(output,0.5),'edgecolor','none','facecolor','r');
view(3);
camlight;
lighting gouraud;
axis equal;
axis vis3d;
So is this the only method to do it, using ismember? Can it not be done by using those 3 for loops?
Thank you!
Image Analyst
Image Analyst le 16 Jan 2016
You could, but why would you want to? Just say output(i,j,k)=1 inside the for loop. And you'd have to preallocate output with output=zeros(size(V)) before the loop. I encourage you not to do that though. It's more complicated, harder to follow, and probably takes longer.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by