Jump to content
hossein1990

Convert Slice images to Volume

Recommended Posts

Hi there

 

Is there a way to make a volume from some image slices in Houdini?

like bring CT scan slices to a volume and see it in the 3d volume

Share this post


Link to post
Share on other sites
Posted (edited)

That should be fairly simple do achieve as long as you have a your images in an ordered list (img_1.tif, img_2.tif, img_3.tif, ...)
in a volume wrangle, use the texture function to read the image RGB values > luminance to convert to greyscale
and set the volume density using that value. getbbox, to convert x,z to u,v coordinates and the y coordinate as your image index.
something like this:

// number of images
int lastImageIndex=30;
// get bounds
vector bmin,bmax;
getbbox(0,bmin,bmax);
// create u,v,imageIndex(y coordinate)
float u = fit(@P.x,bmin.x,bmax.x,0,1);
float v = fit(@P.z,bmin.z,bmax.z,0,1);
int imageIndex = int(fit(@P.y,bmin.y,bmax.y,0,lastImageIndex));
// create imageName, sample RBD, convert to greyscale and write to density
string imageFileName = “/path/image_”+itoa(imageIndex)+”.tif”;
vector color = texture(imageFileName, u, v, "pixelblur", 2.0);
float greyscale = luminance(color);
@density = greyscale;

hope that makes sense.

Edited by bunker
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

you can also just create COP2 Network SOP, set method to Volume

and inside File COP reading your sequence of files

the output of cop2net will be your volume 

  • Like 1

Share this post


Link to post
Share on other sites

cool, I didn't know about the "COP2 Network SOP"
How do you load more than one image at a time though?

Share this post


Link to post
Share on other sites

it automatically loads all images of the sequence as z axis of the volume

  • Like 2

Share this post


Link to post
Share on other sites

Thank you both (bunker & anim) for the answers.

but I`m quite new in Houdini and I don`t know how to do it with VEX or COP2...

It would be great if you can explain in a simple way or link me to a video 

when I search about slices to a volume just brings me volume to slices which I don't need it...

In fact, I need to know these:

1- Import image slices in Houdini (they are already ordered and greyscale)

2- Show them as volume

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×