diff options
Diffstat (limited to 'cuda/3d/cone_bp.cu')
-rw-r--r-- | cuda/3d/cone_bp.cu | 170 |
1 files changed, 0 insertions, 170 deletions
diff --git a/cuda/3d/cone_bp.cu b/cuda/3d/cone_bp.cu index 024c791..6b2c8a1 100644 --- a/cuda/3d/cone_bp.cu +++ b/cuda/3d/cone_bp.cu @@ -28,11 +28,6 @@ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>. #include "astra/cuda/3d/util3d.h" #include "astra/cuda/3d/dims3d.h" -#ifdef STANDALONE -#include "astra/cuda/3d/cone_fp.h" -#include "testutil.h" -#endif - #include <cstdio> #include <cassert> #include <iostream> @@ -380,168 +375,3 @@ bool ConeBP(cudaPitchedPtr D_volumeData, } - -#ifdef STANDALONE -int main() -{ - astraCUDA3d::SDimensions3D dims; - dims.iVolX = 512; - dims.iVolY = 512; - dims.iVolZ = 512; - dims.iProjAngles = 496; - dims.iProjU = 512; - dims.iProjV = 512; - dims.iRaysPerDetDim = 1; - dims.iRaysPerVoxelDim = 1; - - cudaExtent extentV; - extentV.width = dims.iVolX*sizeof(float); - extentV.height = dims.iVolY; - extentV.depth = dims.iVolZ; - - cudaPitchedPtr volData; // pitch, ptr, xsize, ysize - - cudaMalloc3D(&volData, extentV); - - cudaExtent extentP; - extentP.width = dims.iProjU*sizeof(float); - extentP.height = dims.iProjAngles; - extentP.depth = dims.iProjV; - - cudaPitchedPtr projData; // pitch, ptr, xsize, ysize - - cudaMalloc3D(&projData, extentP); - cudaMemset3D(projData, 0, extentP); - -#if 0 - float* slice = new float[256*256]; - cudaPitchedPtr ptr; - ptr.ptr = slice; - ptr.pitch = 256*sizeof(float); - ptr.xsize = 256*sizeof(float); - ptr.ysize = 256; - - for (unsigned int i = 0; i < 256*256; ++i) - slice[i] = 1.0f; - for (unsigned int i = 0; i < 256; ++i) { - cudaExtent extentS; - extentS.width = dims.iVolX*sizeof(float); - extentS.height = dims.iVolY; - extentS.depth = 1; - cudaPos sp = { 0, 0, 0 }; - cudaPos dp = { 0, 0, i }; - cudaMemcpy3DParms p; - p.srcArray = 0; - p.srcPos = sp; - p.srcPtr = ptr; - p.dstArray = 0; - p.dstPos = dp; - p.dstPtr = volData; - p.extent = extentS; - p.kind = cudaMemcpyHostToDevice; - cudaMemcpy3D(&p); -#if 0 - if (i == 128) { - for (unsigned int j = 0; j < 256*256; ++j) - slice[j] = 0.0f; - } -#endif - } -#endif - - - astraCUDA3d::SConeProjection angle[512]; - angle[0].fSrcX = -5120; - angle[0].fSrcY = 0; - angle[0].fSrcZ = 0; - - angle[0].fDetSX = 512; - angle[0].fDetSY = -256; - angle[0].fDetSZ = -256; - - angle[0].fDetUX = 0; - angle[0].fDetUY = 1; - angle[0].fDetUZ = 0; - - angle[0].fDetVX = 0; - angle[0].fDetVY = 0; - angle[0].fDetVZ = 1; - -#define ROTATE0(name,i,alpha) do { angle[i].f##name##X = angle[0].f##name##X * cos(alpha) - angle[0].f##name##Y * sin(alpha); angle[i].f##name##Y = angle[0].f##name##X * sin(alpha) + angle[0].f##name##Y * cos(alpha); } while(0) - for (int i = 1; i < 512; ++i) { - angle[i] = angle[0]; - ROTATE0(Src, i, i*2*M_PI/512); - ROTATE0(DetS, i, i*2*M_PI/512); - ROTATE0(DetU, i, i*2*M_PI/512); - ROTATE0(DetV, i, i*2*M_PI/512); - } -#undef ROTATE0 - -#if 0 - astraCUDA3d::ConeFP(volData, projData, dims, angle, 1.0f); -#endif -#if 0 - float* bufs = new float[180*512]; - - for (int i = 0; i < 512; ++i) { - cudaMemcpy(bufs, ((float*)projData.ptr)+180*512*i, 180*512*sizeof(float), cudaMemcpyDeviceToHost); - - printf("%d %d %d\n", projData.pitch, projData.xsize, projData.ysize); - - char fname[20]; - sprintf(fname, "sino%03d.png", i); - saveImage(fname, 180, 512, bufs); - } - - float* bufp = new float[512*512]; - - for (int i = 0; i < 180; ++i) { - for (int j = 0; j < 512; ++j) { - cudaMemcpy(bufp+512*j, ((float*)projData.ptr)+180*512*j+512*i, 512*sizeof(float), cudaMemcpyDeviceToHost); - } - - char fname[20]; - sprintf(fname, "proj%03d.png", i); - saveImage(fname, 512, 512, bufp); - } -#endif -#if 0 - for (unsigned int i = 0; i < 256*256; ++i) - slice[i] = 0.0f; - for (unsigned int i = 0; i < 256; ++i) { - cudaExtent extentS; - extentS.width = dims.iVolX*sizeof(float); - extentS.height = dims.iVolY; - extentS.depth = 1; - cudaPos sp = { 0, 0, 0 }; - cudaPos dp = { 0, 0, i }; - cudaMemcpy3DParms p; - p.srcArray = 0; - p.srcPos = sp; - p.srcPtr = ptr; - p.dstArray = 0; - p.dstPos = dp; - p.dstPtr = volData; - p.extent = extentS; - p.kind = cudaMemcpyHostToDevice; - cudaMemcpy3D(&p); - } -#endif - - astraCUDA3d::ConeBP(volData, projData, dims, angle, 1.0f); -#if 0 - float* buf = new float[256*256]; - - for (int i = 0; i < 256; ++i) { - cudaMemcpy(buf, ((float*)volData.ptr)+256*256*i, 256*256*sizeof(float), cudaMemcpyDeviceToHost); - - printf("%d %d %d\n", volData.pitch, volData.xsize, volData.ysize); - - char fname[20]; - sprintf(fname, "vol%03d.png", i); - saveImage(fname, 256, 256, buf); - } -#endif - -} -#endif |