Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsShowcase → voxel raytracer prototype
voxel raytracer prototype
2007-04-22, 3:01 PM #1
i started working on a voxel engine yesterday, currently processing an MRI scan of somebody's body (from legs to head).

the MRI scan is a 3-dimensional image, 512x512x226 8-bit grayscale.


normally, a pixel refers to the color at a specific X,Y position in a 2d image.
whereas a voxel refers to a color at a specific X,Y,Z position in a 3d image.

imagine you had a rubix cube that was all black on the outside but had colored squares on the inside. if you just look at the rubix cube, it appears solid black, even though you know there are actually colors inside it. the same thing occurs if you simply 'draw' an MRI or CAT scan; it will appear to be a solid black cube.

in order to draw the person or object(s) INSIDE the scan, raytracing is used. for each pixel in the image being rendered, a ray is shot into the 3d volume. the ray will continue penetrating the volume until a non-black voxel is hit, which is subsequently drawn.



making the raytracing fast is difficult. lets say we are trying to produce a 800x600 rendering of the 512x512x226 mri scan. thats 480,000 individual raytracing operations that HAVE to be performed. if a 'brute force' approach was taken for the raytracing, there would be over 28 trillion ray-to-voxel tests being performed. on a modern computer, it could take hours, days or even months to produce one lousy 800x600 image!!

i implemented an octree-based culling solution which is currently allowing me to render a 800x600 image in approximately 2 or 3 minutes.

unfortunately, the raytracing is severely broken. this is a prototype, and both my first voxel engine AND first raytracer, so im pleased with the fact that i can make out anything at all in the image ;)

http://binarydemons.com/~strike/files/mri.wmv
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-04-22, 3:02 PM #2
....In english please?
2007-04-22, 3:49 PM #3
Where did you get the sample scan? I was thinking of taking a look at some medical imaging stuff but I couldn't find any data to work with.
Detty. Professional Expert.
Flickr Twitter
2007-04-22, 6:31 PM #4
http://149.142.216.30/DICOM_FILES/DICOMfilesIndex.html

you will need to find an sdk to read dicom (.dcm) files or download some software to batch convert to a more concrete format such as bmp. just keep in mind that you will lose all additional information about the image (such as slice location and pixelspacing, which i mentioned briefly in the video).

i recommend IrfanView if you want to convert to another format.

http://www.irfanview.com/

note that you will need to download the plugins pack in addition to the IrfanView installer in order to read dicom files; both are free on their download page.
[ B A H ]
Bad *** by nature,
Hackers by choice
2007-04-22, 10:32 PM #5
Cool.
"it is time to get a credit card to complete my financial independance" — Tibby, Aug. 2009
2007-04-23, 8:16 AM #6
Your work really makes me wonder if it would be more efficient for me to drop this whole computer science stuff and start learning some voodoo practices, you know, like "spiritual thievery" or something.
BTW: Did you know that Intel revealed plans to build a hardware-acceleration card for raytracing?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2007-04-28, 8:55 PM #7
worked on voxel engine a bit more today, turns out my ray/box test was screwed up. results are much better now that it's fixed, although still some major issues as you can see. that clean-looking slice should actually be flat, but i lost the pixelspacing values after IrfanView converted all the images to BMP files ;)

512x512x520 8-bit CAT Scan (130mb)


[http://binarydemons.com/~strike/files/raytrace.jpg]
[ B A H ]
Bad *** by nature,
Hackers by choice

↑ Up to the top!