glviewvol
diff src/dicomview.cc @ 3:32c4a7160350
den kanei kryo stin ellada
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 28 Dec 2014 21:48:15 +0200 |
parents | cc9e0d8590e2 |
children | 04330eb80b36 |
line diff
1.1 --- a/src/dicomview.cc Sun Dec 28 15:26:36 2014 +0200 1.2 +++ b/src/dicomview.cc Sun Dec 28 21:48:15 2014 +0200 1.3 @@ -1,21 +1,46 @@ 1.4 +#include <stdio.h> 1.5 #include "opengl.h" 1.6 #include "dicomview.h" 1.7 #include "rend_fast.h" 1.8 +#include "opt.h" 1.9 +#include "volume.h" 1.10 1.11 static int win_width, win_height; 1.12 static float cam_theta, cam_phi, cam_dist = 6; 1.13 1.14 static Renderer *rend; 1.15 +static Volume *vol; 1.16 1.17 extern "C" { 1.18 1.19 int init() 1.20 { 1.21 - rend = new RendererFast; 1.22 - if(!rend->init()) { 1.23 + if(!opt.fname) { 1.24 + fprintf(stderr, "you must specify the volume data filename\n"); 1.25 return -1; 1.26 } 1.27 1.28 + switch(opt.rend_type) { 1.29 + case REND_FAST: 1.30 + rend = new RendererFast; 1.31 + break; 1.32 + default: 1.33 + return -1; 1.34 + } 1.35 + 1.36 + if(!rend->init()) { 1.37 + fprintf(stderr, "renderer initialization failed\n"); 1.38 + return -1; 1.39 + } 1.40 + 1.41 + VoxelVolume *voxvol = new VoxelVolume; 1.42 + if(!voxvol->load(opt.fname)) { 1.43 + fprintf(stderr, "failed to load volume data from: %s\n", opt.fname); 1.44 + return -1; 1.45 + } 1.46 + vol = voxvol; 1.47 + rend->set_volume(vol); 1.48 + 1.49 return 0; 1.50 } 1.51 1.52 @@ -23,6 +48,7 @@ 1.53 { 1.54 rend->destroy(); 1.55 delete rend; 1.56 + delete vol; 1.57 } 1.58 1.59 void ev_display()