How to combine volume rendering with POV?

How to combine volume rendering with POV?

Post by Joseph J. Stro » Fri, 15 May 1998 04:00:00



I have a 3D voxel dataset that defines a brain (MRI data, for those who are
curious).  I can do a great volume rendering of this using MacVol [1].  But
I really want to include this in a POV-Ray animation and make a little
video of sectioning through the brain.  Is this possible?  Can POV-Ray do
the volume rendering for me?  Or is there someway to include the output of
a volume renderer into a POV-Ray scene (short of copying and pasting by
hand)?

Many thanks,
-- Joe

[1] http://www.strout.net/macsoft/macvol/

,------------------------------------------------------------------.
|    Joseph J. Strout           Department of Neuroscience, UCSD   |

`------------------------------------------------------------------'

 
 
 

How to combine volume rendering with POV?

Post by Robert Dawso » Sat, 16 May 1998 04:00:00




Quote:> I have a 3D voxel dataset that defines a brain (MRI data, for those who
are
> curious).  I can do a great volume rendering of this using MacVol [1].
But
> I really want to include this in a POV-Ray animation and make a little
> video of sectioning through the brain.  Is this possible?  Can POV-Ray do
> the volume rendering for me?  Or is there someway to include the output
of
> a volume renderer into a POV-Ray scene (short of copying and pasting by
> hand)?

        I don't know the format of your voxel data, but it should not be
impossible to convert it to POV using a very basic text editor in
combination
with a spreadsheet (a stats package like MINITAB also works well). Here's
the plan: Import the data into the spreadsheet
and cut, paste, and fill columns till you have something like
    A      B     C       D     E       F     G      H     I
 STRING0 1.000 STRING1 1.000 STRING2 1.000 STRING3 0.345 STRING4 ...
 STRING0 2.000 STRING1 1.000 STRING2 1.000 STRING3 0.352 STRING4
...

where STRING* are the textstrings that should go between the numbers to
make a POV fragment like

object{Voxel translate<    
                                1.000
                                        ,
                                          1.000
                                                  ,
                                                    1.000
                                                            > pigment{ color RGB<
                                                                                          0.345
                                                                                                  ,

(etc). Or you can put in placeholders S1,S2,... at this time - or even
values like -999, -998, -997... if you are using a primitive numbers-only
program.

        Now cut and paste to your text editor and tidy up. If you used
placeholders to avoid long textstrings in your spreadsheet, now use
search-and-replace to get the correct text.

Add

#declare Voxel =   <what you want a voxel to be>
#declare Brain = union{

        <your voxels>

        }

You can then intersect with a plane or box, or difference a box from it,
and get a sectioned  view. Move the plane or box - and there you are,
animated...

        Of course, the *proper* tool for this is SED or something like it.  But
I'll have my render going this way while the average non-Unix-wizard is
still rereading the manual...

        -Robert Dawson

 
 
 

How to combine volume rendering with POV?

Post by Joseph J. Stro » Sat, 16 May 1998 04:00:00






>> I have a 3D voxel dataset that defines a brain... But
>> I really want to include this in a POV-Ray animation and make a little
>> video of sectioning through the brain.  Is this possible?  Can POV-Ray do
>> the volume rendering for me?

>        I don't know the format of your voxel data, but it should not be
>impossible to convert it to POV...

Yes, I'm a Python programmer, so any kind of conversion is very easy for me
to automate.  ;)

Quote:>make a POV fragment like

>object{Voxel translate<1.000, 1.000, 1.000> pigment{ color RGB<0.345> },

>Add

>#declare Voxel =   <what you want a voxel to be>
>#declare Brain = union{

>        <your voxels>

>        }

So if I understand you correctly, you're suggesting I declare a "Voxel" as
some primitive (probably a Box), and then union all my voxels (1.3 million
of them!) together and render.

OK, I hadn't thought of that.  But I was rather hoping for something more
elegant.  Some kind of map, but in 3D.

My dataset defines the density (or transparency) of each voxel.  Each voxel
should be a tiny cube, through which light passes or reflects to varying
degrees.

A texture map or some such sounds promising, except that it's only
two-dimensional; is there some way to apply it to a slab rather than to a
plane, so that it has some thickness?  Then I could just stack up 84 slabs
to make my volume.

Thanks,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout           Department of Neuroscience, UCSD   |

`------------------------------------------------------------------'

 
 
 

How to combine volume rendering with POV?

Post by Amalthea » Sat, 16 May 1998 04:00:00


I haven't looked into this much at all, but there is a demonstration of making
the full volume of a head at the POV-Ray iso surface patch home page.  I don't
know if they used data similiar to what you have, but it may be worth a look:

http://www.public.usit.net/rsuzuki/e/povray/iso/index.html

Hope that is of some use.

-Mike

 
 
 

How to combine volume rendering with POV?

Post by Joseph J. Stro » Sat, 16 May 1998 04:00:00




>I haven't looked into this much at all, but there is a demonstration of making
>the full volume of a head at the POV-Ray iso surface patch home page.  I don't
>know if they used data similiar to what you have, but it may be worth a look:

>http://www.public.usit.net/rsuzuki/e/povray/iso/index.html

Yes, this is exactly what I'm looking for -- but the "i_dat3d" plug-in,
which you need for the volume rendering, appears to be absent from the Mac
distribution.  =(

,------------------------------------------------------------------.
|    Joseph J. Strout           Department of Neuroscience, UCSD   |

`------------------------------------------------------------------'

 
 
 

How to combine volume rendering with POV?

Post by Durk Talsm » Sat, 16 May 1998 04:00:00





> >I haven't looked into this much at all, but there is a demonstration of making
> >the full volume of a head at the POV-Ray iso surface patch home page.  I don't
> >know if they used data similiar to what you have, but it may be worth a look:

> >http://www.public.usit.net/rsuzuki/e/povray/iso/index.html

> Yes, this is exactly what I'm looking for -- but the "i_dat3d" plug-in,
> which you need for the volume rendering, appears to be absent from the Mac
> distribution.  =(

Joseph,

I think this is the actual dataset and  is included in a seperate package. I'm
dwonloading the zipfile  (3dhead.zip) right now from

http://www.cdrom.com/pub/povray/objects/

B.t.w, since I'm a pschyo-physiologist, I'm very interested in what you're working
on.

Hope this helps,
Durk

> ,------------------------------------------------------------------.
> |    Joseph J. Strout           Department of Neuroscience, UCSD   |

> `------------------------------------------------------------------'

 
 
 

How to combine volume rendering with POV?

Post by Joseph J. Stro » Sat, 16 May 1998 04:00:00




>> Yes, this is exactly what I'm looking for -- but the "i_dat3d" plug-in,
>> which you need for the volume rendering, appears to be absent from the Mac
>> distribution.  =(

>I think this is the actual dataset and  is included in a seperate package.

No, I got the dataset (3dhead.zip).  "i_dat3d" is a plug-in function; it's
called by the following POV code:

#declare HEAD = function{ "data_3D_1", <-0.001>
//    parameters for "library":
//        p0: Nx,  p1: Ny,  p2: Nz
//        p3: case 0: text             case 1: 1 byte binary
//            case 2: 2 byte binary int    case 3: 4 byte binary int
//            case 4: 4 byte binary float
     library   "i_dat3d","3dhead", <256,256,109,2>

Quote:}

I don't entirely understand this code, but apparently "3dhead" is the
dataset, but "i_dat3d" is the function being applied to it.  I have source
code for this function in the "makedll" folder of the "Iso_demo" folder,
but no compiled version came with the Mac package.  (I tried to compile it
myself, but I don't have much experience making shared libraries.)

Quote:>B.t.w, since I'm a pschyo-physiologist, I'm very interested in what you're
>working on.

Well, it's a little educational video.  Should be pretty neat if I can get
this to work.

Thanks to all who've helped so far!

,------------------------------------------------------------------.
|    Joseph J. Strout           Department of Neuroscience, UCSD   |

`------------------------------------------------------------------'

 
 
 

How to combine volume rendering with POV?

Post by Coridon Hensh » Sat, 16 May 1998 04:00:00



 > I have a 3D voxel dataset that defines a brain (MRI data, for those who are
 > curious).

Your best bet would be to convert it into a triangle mesh, with one voxel
represented as a 12 triangle cube.

----------------------------------------------------------------------------
| This message does not reflect the views of Green Circle Communciations.  |
| OS/2 Warp - SCSI - free speech.  Do I pick losing causes or what?        |
| CGI, C/C++ and HTML spoken here.  http://www.myna.com/~gcircle/csbh.html |

 
 
 

How to combine volume rendering with POV?

Post by Ib Rasmuss » Sun, 17 May 1998 04:00:00



Quote:>A texture map or some such sounds promising, except that it's only
>two-dimensional; is there some way to apply it to a slab rather than to a
>plane, so that it has some thickness?  Then I could just stack up 84 slabs
>to make my volume.

I PovRay planes _do_ have thickness, in fact they take up half the
'universe', but a box may be better suited for your purpose. When you
apply an image_map to a box (or any other solid Pov-object) the colour
goes right through the object. You can add filter to some or all of
the colours, but if you layer 84 transparent boxes on top of each
other, you should expect some seriuos render times. (And don't forget
to adjust the max_trace_level).

/Ib

 
 
 

1. Volume Rendering with POV-Ray

Will POV-Ray render volume data? I have a 16 x 16 x 16 matrix of numbers
I want to render as a volume and use alpha curves to show highlighted
areas. Is there an object to handle this type of data? (In AVS is is a
uniform structured field).

2. Targa image format

3. Combining *.pov files for POV2.0

4. Free graphics for Christmas

5. Combining Macintosh macines to render

6. Matisse phone no.

7. combining 2 renders

8. WANTED: awesome SGI graphics/systems engineer

9. 3D rendering combined with ImageVision

10. combining 3 rendered avi's?

11. POV-Ray and volume ray tracing?

12. Spheres or blobs (POV) inside a volume defined by 3d points