# HG changeset patch # User Eleni Maria Stea # Date 1395696488 -7200 # Node ID 4e02e18e70ef82b927f45e05965b819af79a499e # Parent 0f4fff558737b579b5508e47039b343671b917e9 quick backup - shaders 4 transfer function preview diff -r 0f4fff558737 -r 4e02e18e70ef convert.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/convert.sh Mon Mar 24 23:28:08 2014 +0200 @@ -0,0 +1,6 @@ +#!/bin/sh + +for i in *.dcm; do + name=`basename $i .dcm` + convert $i $name.png +done diff -r 0f4fff558737 -r 4e02e18e70ef data/kardia.vol --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/data/kardia.vol Mon Mar 24 23:28:08 2014 +0200 @@ -0,0 +1,81 @@ +VOLUME +zaspect = 1 + +SLICES + +/home/eleni/code/med/test1/data/magix/IM-0001-0001.png +/home/eleni/code/med/test1/data/magix/IM-0001-0002.png +/home/eleni/code/med/test1/data/magix/IM-0001-0003.png +/home/eleni/code/med/test1/data/magix/IM-0001-0004.png +/home/eleni/code/med/test1/data/magix/IM-0001-0005.png +/home/eleni/code/med/test1/data/magix/IM-0001-0006.png +/home/eleni/code/med/test1/data/magix/IM-0001-0007.png +/home/eleni/code/med/test1/data/magix/IM-0001-0008.png +/home/eleni/code/med/test1/data/magix/IM-0001-0009.png +/home/eleni/code/med/test1/data/magix/IM-0001-0010.png +/home/eleni/code/med/test1/data/magix/IM-0001-0011.png +/home/eleni/code/med/test1/data/magix/IM-0001-0012.png +/home/eleni/code/med/test1/data/magix/IM-0001-0013.png +/home/eleni/code/med/test1/data/magix/IM-0001-0014.png +/home/eleni/code/med/test1/data/magix/IM-0001-0015.png +/home/eleni/code/med/test1/data/magix/IM-0001-0016.png +/home/eleni/code/med/test1/data/magix/IM-0001-0017.png +/home/eleni/code/med/test1/data/magix/IM-0001-0018.png +/home/eleni/code/med/test1/data/magix/IM-0001-0019.png +/home/eleni/code/med/test1/data/magix/IM-0001-0020.png +/home/eleni/code/med/test1/data/magix/IM-0001-0021.png +/home/eleni/code/med/test1/data/magix/IM-0001-0022.png +/home/eleni/code/med/test1/data/magix/IM-0001-0023.png +/home/eleni/code/med/test1/data/magix/IM-0001-0024.png +/home/eleni/code/med/test1/data/magix/IM-0001-0025.png +/home/eleni/code/med/test1/data/magix/IM-0001-0026.png +/home/eleni/code/med/test1/data/magix/IM-0001-0027.png +/home/eleni/code/med/test1/data/magix/IM-0001-0028.png +/home/eleni/code/med/test1/data/magix/IM-0001-0029.png +/home/eleni/code/med/test1/data/magix/IM-0001-0030.png +/home/eleni/code/med/test1/data/magix/IM-0001-0031.png +/home/eleni/code/med/test1/data/magix/IM-0001-0032.png +/home/eleni/code/med/test1/data/magix/IM-0001-0033.png +/home/eleni/code/med/test1/data/magix/IM-0001-0034.png +/home/eleni/code/med/test1/data/magix/IM-0001-0035.png +/home/eleni/code/med/test1/data/magix/IM-0001-0036.png +/home/eleni/code/med/test1/data/magix/IM-0001-0037.png +/home/eleni/code/med/test1/data/magix/IM-0001-0038.png +/home/eleni/code/med/test1/data/magix/IM-0001-0039.png +/home/eleni/code/med/test1/data/magix/IM-0001-0040.png +/home/eleni/code/med/test1/data/magix/IM-0001-0041.png +/home/eleni/code/med/test1/data/magix/IM-0001-0042.png +/home/eleni/code/med/test1/data/magix/IM-0001-0043.png +/home/eleni/code/med/test1/data/magix/IM-0001-0044.png +/home/eleni/code/med/test1/data/magix/IM-0001-0045.png +/home/eleni/code/med/test1/data/magix/IM-0001-0046.png +/home/eleni/code/med/test1/data/magix/IM-0001-0047.png +/home/eleni/code/med/test1/data/magix/IM-0001-0048.png +/home/eleni/code/med/test1/data/magix/IM-0001-0049.png +/home/eleni/code/med/test1/data/magix/IM-0001-0050.png +/home/eleni/code/med/test1/data/magix/IM-0001-0051.png +/home/eleni/code/med/test1/data/magix/IM-0001-0052.png +/home/eleni/code/med/test1/data/magix/IM-0001-0053.png +/home/eleni/code/med/test1/data/magix/IM-0001-0054.png +/home/eleni/code/med/test1/data/magix/IM-0001-0055.png +/home/eleni/code/med/test1/data/magix/IM-0001-0056.png +/home/eleni/code/med/test1/data/magix/IM-0001-0057.png +/home/eleni/code/med/test1/data/magix/IM-0001-0058.png +/home/eleni/code/med/test1/data/magix/IM-0001-0059.png +/home/eleni/code/med/test1/data/magix/IM-0001-0060.png +/home/eleni/code/med/test1/data/magix/IM-0001-0061.png +/home/eleni/code/med/test1/data/magix/IM-0001-0062.png +/home/eleni/code/med/test1/data/magix/IM-0001-0063.png +/home/eleni/code/med/test1/data/magix/IM-0001-0064.png +/home/eleni/code/med/test1/data/magix/IM-0001-0065.png +/home/eleni/code/med/test1/data/magix/IM-0001-0066.png +/home/eleni/code/med/test1/data/magix/IM-0001-0067.png +/home/eleni/code/med/test1/data/magix/IM-0001-0068.png +/home/eleni/code/med/test1/data/magix/IM-0001-0069.png +/home/eleni/code/med/test1/data/magix/IM-0001-0070.png +/home/eleni/code/med/test1/data/magix/IM-0001-0071.png +/home/eleni/code/med/test1/data/magix/IM-0001-0072.png +/home/eleni/code/med/test1/data/magix/IM-0001-0073.png +/home/eleni/code/med/test1/data/magix/IM-0001-0074.png +/home/eleni/code/med/test1/data/magix/IM-0001-0075.png +/home/eleni/code/med/test1/data/magix/IM-0001-0076.png diff -r 0f4fff558737 -r 4e02e18e70ef src/main.cc --- a/src/main.cc Mon Mar 03 23:12:13 2014 +0200 +++ b/src/main.cc Mon Mar 24 23:28:08 2014 +0200 @@ -19,15 +19,15 @@ static void keyboard_up(unsigned char key, int x, int y); static void mouse(int button, int state, int x, int y); static void motion(int x, int y); - static bool init_xfer(void); static void display_xfer(void); static void reshape_xfer(int x, int y); static void mouse_xfer(int button, int state, int x, int y); static void motion_xfer(int x, int y); -//todo keyb esc +static void volume_preview (); static int mainwin_id, xferwin_id; +//todo keyb esc static int win_xsz, win_ysz; static float cam_phi, cam_theta, cam_dist = 6; @@ -171,6 +171,42 @@ return ui; } +static void volume_preview () +{ + float aspect = win_xsz / win_ysz; + float z = 0.0; + + glDisable(GL_LIGHTING); + + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(-aspect, aspect, -1.0, 1.0, -1.0, 1.0); + + glBindTexture(GL_TEXTURE_3D, vol->get_texture()); + glEnable(GL_TEXTURE_3D); + glBegin(GL_QUADS); + glColor3f(1.0, 0.0, 0.0); + glTexCoord3f(0, 0, z); glVertex3f(-1.0, 1.0, 0.0); + glTexCoord3f(0, 1, z); glVertex3f(-1.0, 0.5, 0.0); + glTexCoord3f(1, 1, z); glVertex3f(-0.5, 0.5, 0.0); + glTexCoord3f(1, 0, z); glVertex3f(-0.5, 1.0, 0.0); + glEnd(); + glDisable(GL_TEXTURE_3D); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + + glEnable(GL_LIGHTING); +} + static void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -201,7 +237,7 @@ } mesh->draw(); - //TODO: draw threshold + volume_preview(); glutSwapBuffers(); assert(glGetError() == GL_NO_ERROR); }