diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2019-04-06 18:01:16 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2019-09-25 14:10:10 +0200 |
commit | 609e81d67217f4ff21c8a0aec82584da0fee1908 (patch) | |
tree | 9dc3da429ea0963117eb8a41a390a37a289a784d /cuda/3d/par3d_bp.cu | |
parent | 0c2482e1dce65ded6215cd5634d86b4c00381e27 (diff) | |
download | astra-609e81d67217f4ff21c8a0aec82584da0fee1908.tar.gz astra-609e81d67217f4ff21c8a0aec82584da0fee1908.tar.bz2 astra-609e81d67217f4ff21c8a0aec82584da0fee1908.tar.xz astra-609e81d67217f4ff21c8a0aec82584da0fee1908.zip |
Remove unmaintained, out of date 'STANDALONE' cuda code
Diffstat (limited to 'cuda/3d/par3d_bp.cu')
-rw-r--r-- | cuda/3d/par3d_bp.cu | 163 |
1 files changed, 0 insertions, 163 deletions
diff --git a/cuda/3d/par3d_bp.cu b/cuda/3d/par3d_bp.cu index 3673fa8..602f209 100644 --- a/cuda/3d/par3d_bp.cu +++ b/cuda/3d/par3d_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/par3d_fp.h" -#include "testutil.h" -#endif - #include <cstdio> #include <cassert> #include <iostream> @@ -317,161 +312,3 @@ bool Par3DBP(cudaPitchedPtr D_volumeData, } - -#ifdef STANDALONE -int main() -{ - SDimensions3D dims; - dims.iVolX = 256; - dims.iVolY = 256; - dims.iVolZ = 256; - dims.iProjAngles = 180; - dims.iProjU = 512; - dims.iProjV = 512; - dims.iRaysPerDet = 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); - - 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 - } - - - SPar3DProjection angle[180]; - angle[0].fRayX = 1; - angle[0].fRayY = 0; - angle[0].fRayZ = 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 < 180; ++i) { - angle[i] = angle[0]; - ROTATE0(Ray, i, i*2*M_PI/180); - ROTATE0(DetS, i, i*2*M_PI/180); - ROTATE0(DetU, i, i*2*M_PI/180); - ROTATE0(DetV, i, i*2*M_PI/180); - } -#undef ROTATE0 - - astraCUDA3d::Par3DFP(volData, projData, dims, angle, 1.0f); -#if 1 - 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, 0, 512); - } - - 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, 0, 512); - } -#endif - 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); - } - - astraCUDA3d::Par3DBP(volData, projData, dims, angle, 1.0f); -#if 1 - 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, 0, 60000); - } -#endif - -} -#endif |