qvolray
diff src/volume.cc @ 13:17d9dc2edc91
first qt version
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 10 Apr 2012 06:11:16 +0300 |
parents | 8990b5d2c7fe |
children | 535762131d34 |
line diff
1.1 --- a/src/volume.cc Mon Apr 09 23:43:13 2012 +0300 1.2 +++ b/src/volume.cc Tue Apr 10 06:11:16 2012 +0300 1.3 @@ -44,14 +44,14 @@ 1.4 1.5 /* load the first image to determine slice dimensions */ 1.6 img_init(&img); 1.7 - if(img_load(&img, slist.begin().name.c_str()) == -1) { 1.8 - fprintf(stderr, "failed to load volume slice: %s\n", slist->name); 1.9 + if(img_load(&img, slist.begin()->c_str()) == -1) { 1.10 + fprintf(stderr, "failed to load volume slice: %s\n", slist.begin()->c_str()); 1.11 return false; 1.12 } 1.13 1.14 sz[0] = img.width; 1.15 sz[1] = img.height; 1.16 - printf("volume dimensions: %dx%dx%d\n", img.width, img.height, vol->sz[2]); 1.17 + printf("volume dimensions: %dx%dx%d\n", img.width, img.height, sz[2]); 1.18 1.19 /* allocate the whole volume at once */ 1.20 voxels = new float[sz[0] * sz[1] * sz[2] * 4]; 1.21 @@ -63,15 +63,15 @@ 1.22 int x, y, xsz, ysz; 1.23 float *pixels, *src; 1.24 1.25 - if(!(pixels = img_load_pixels(slice.name.c_str(), &xsz, &ysz, IMG_FMT_GREYF))) { 1.26 - fprintf(stderr, "failed to load volume slice: %s\n", slice.name.c_str()); 1.27 + if(!(pixels = (float*)img_load_pixels(slice.c_str(), &xsz, &ysz, IMG_FMT_GREYF))) { 1.28 + fprintf(stderr, "failed to load volume slice: %s\n", slice.c_str()); 1.29 delete [] voxels; 1.30 return false; 1.31 } 1.32 1.33 if(xsz != sz[0] || ysz != sz[1]) { 1.34 fprintf(stderr, "inconsistent dimensions for slice %s: %dx%d (%dx%d expected)\n", 1.35 - slice.name.c_str(), xsz, ysz, sz[0], sz[1]); 1.36 + slice.c_str(), xsz, ysz, sz[0], sz[1]); 1.37 delete [] voxels; 1.38 return false; 1.39 } 1.40 @@ -145,7 +145,7 @@ 1.41 } 1.42 } 1.43 1.44 -bool read_voldesc(const char *fname, std::list<std::string> *slist) const 1.45 +bool Volume::read_voldesc(const char *fname, std::list<std::string> *slist) 1.46 { 1.47 FILE *fp = 0; 1.48 char buf[512], *slash, *prefix = ""; 1.49 @@ -164,9 +164,9 @@ 1.50 return false; 1.51 } 1.52 1.53 - if((slash = strrchr(fname, '/'))) { 1.54 + if((slash = strrchr((char*)fname, '/'))) { 1.55 int len = slash - fname + 1; 1.56 - prefix = alloca(len + 1); 1.57 + prefix = (char*)alloca(len + 1); 1.58 memcpy(prefix, fname, len); 1.59 prefix[len] = 0; 1.60 }