License New BSD license
Lines 192
Keywords
MRI (3) PyOpenGL (9) Science! (1) Volume Rendering (9) wxPython (7)
Included in this Library
Permissions
Owner: Stou S.
Viewable by Everyone
Editable by All Siafoo Users
Hide
Siafoo – the intersection of pastebin, help desk, version control, and social networking Join Siafoo Now or Learn More

Volume Rendering MRI data using PyOpenGL Atom Feed 0

In Brief A rudimentary example of using the Volume Rendering Skeleton code to render basic MRI data in NIfTI or .hdr/.img format (whatever that is). Support for other formats (like vol) can be added easily.... more

A rudimentary example of using the Volume Rendering Skeleton code to render basic MRI data in NIfTI or .hdr/.img format (whatever that is). Support for other formats (like vol) can be added easily.

The way this works is to load the MRI data into a single-channel OpenGL 3D Texture. The texture values are sampled inside the Fragment shader and mapped to colors by the transfers function (which is a 4 channel 1D texture). The vertex shader is only there to assign the proper texture coordinates to the image planes (you can assign the coordinates directly to the image planes themselves from within Python but it's more work).

You should see something like this (which is the MRI_head dataset in hdr/img format):

http://www.siafoo.net/image/40?w=300

If you intend to work with NIfTI files, you will need to install PyNIfTI. The PyNIfTI sites provides a number of precompiled packages for several common distributions... if you are running Fedora 11 you can use the F10 nifticlib packages from the OpenSUSE package site but will have to install PyNIfTI from source (which isn't actually a big deal with easy_install)

Keys:

r - Reload shader sources

l - Toggle lighting