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

3dvolume

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

Best Answer

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);