PDA

View Full Version : How to generate MIP (Maximum Intensity Projection)



KraftDinner
10-01-2004, 08:21 AM
Now that I have the 3D Texture mapping working and am able to generate images by passing a plane through the 3D texture map, the next thing I need to do is to figure out how to blend the images together to make a single mip image out of the slices...

This code goes a slice at a time through the 3D texture and produces an image of the slice on the z plane. I need to combine these slices into one slice where the pixel value is the maximum value...

So if I had 16 images then i would look at pixel(0,0,n) where n is the slice number and output a single new pixel at pixel(0,0) of value x where x was the 'brightest' pixel.

If I understand glTexGen it does the iterations through the volume for me?

Looking at some of the links dorbie posted on 3D Textures one of them was on MIP (http://www.opengl.org/resources/tutorials/sig99/advanced99/notes/node304.html)

However the EXT functions don't seem to be known to my version of OpenGL which I believe is 1.4


void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

static int slice = 0;
float z;

z = (1.0/((float) (iDepth-1))) * (float) slice;

glBegin(GL_QUADS);

glTexCoord3f(0.0, 0.0, z); glVertex3f(-1.0, -1.0, 0.0);
glTexCoord3f(1.0, 0.0, z); glVertex3f(-1.0, 1.0, 0.0);
glTexCoord3f(1.0, 1.0, z); glVertex3f( 1.0, 1.0, 0.0);
glTexCoord3f(0.0, 1.0, z); glVertex3f( 1.0, -1.0, 0.0);

glEnd();

glFlush();

slice = (slice+1) % iDepth;
}

10-02-2004, 02:06 PM
hey drbob, minmax was added to the core in version 1.2:
http://www.opengl.org/documentation/spec.html

get your extensions and required headers:
http://oss.sgi.com/projects/ogl-sample/registry/

minmax spec:
http://oss.sgi.com/projects/ogl-sample/registry/EXT/blend_minmax.txt

you need to check the extension string to see if you have it on your card (you should if it's 1.4 compliant). make sure your drivers are current.

you might find this area helpful in general:
http://www.opengl.org/resources/faq/getting_started.html

10-02-2004, 02:15 PM
correction: added to the spec, not the core. if you look at the end of the spec, you'll see a list of extensions, grouped by the version current when they were added.

arekkusu
10-04-2004, 10:37 AM
EXT_blend_minmax is supported (http://homepage.mac.com/arekkusu/bugs/GLInfo.html) on all nvidia cards and Radeon 8500+ on OS X.

GL_MAX_EXT should just work. Make sure you #include <OpenGL/glext.h>