From 609e81d67217f4ff21c8a0aec82584da0fee1908 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sat, 6 Apr 2019 18:01:16 +0200 Subject: Remove unmaintained, out of date 'STANDALONE' cuda code --- cuda/3d/sirt3d.cu | 161 ------------------------------------------------------ 1 file changed, 161 deletions(-) (limited to 'cuda/3d/sirt3d.cu') diff --git a/cuda/3d/sirt3d.cu b/cuda/3d/sirt3d.cu index 869b2fd..e68bde8 100644 --- a/cuda/3d/sirt3d.cu +++ b/cuda/3d/sirt3d.cu @@ -30,10 +30,6 @@ along with the ASTRA Toolbox. If not, see . #include "astra/cuda/3d/arith3d.h" #include "astra/cuda/3d/cone_fp.h" -#ifdef STANDALONE -#include "testutil.h" -#endif - #include #include @@ -375,160 +371,3 @@ bool doSIRT(cudaPitchedPtr& D_volumeData, } -#ifdef STANDALONE - -using namespace astraCUDA3d; - -int main() -{ - SDimensions3D dims; - dims.iVolX = 256; - dims.iVolY = 256; - dims.iVolZ = 256; - dims.iProjAngles = 100; - dims.iProjU = 512; - dims.iProjV = 512; - dims.iRaysPerDet = 1; - - SConeProjection angle[100]; - angle[0].fSrcX = -2905.6; - angle[0].fSrcY = 0; - angle[0].fSrcZ = 0; - - angle[0].fDetSX = 694.4; - angle[0].fDetSY = -122.4704; - angle[0].fDetSZ = -122.4704; - - angle[0].fDetUX = 0; - angle[0].fDetUY = .4784; - //angle[0].fDetUY = .5; - angle[0].fDetUZ = 0; - - angle[0].fDetVX = 0; - angle[0].fDetVY = 0; - angle[0].fDetVZ = .4784; - -#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 < 100; ++i) { - angle[i] = angle[0]; - ROTATE0(Src, i, i*2*M_PI/100); - ROTATE0(DetS, i, i*2*M_PI/100); - ROTATE0(DetU, i, i*2*M_PI/100); - ROTATE0(DetV, i, i*2*M_PI/100); - } -#undef ROTATE0 - - - cudaPitchedPtr volData = allocateVolumeData(dims); - cudaPitchedPtr projData = allocateProjectionData(dims); - zeroProjectionData(projData, dims); - - float* pbuf = new float[100*512*512]; - copyProjectionsFromDevice(pbuf, projData, dims); - copyProjectionsToDevice(pbuf, projData, dims); - delete[] pbuf; - -#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; ++i) { - for (unsigned int y = 0; y < 256; ++y) - for (unsigned int x = 0; x < 256; ++x) - slice[y*256+x] = (i-127.5)*(i-127.5)+(y-127.5)*(y-127.5)+(x-127.5)*(x-127.5) < 4900 ? 1.0f : 0.0f; - - 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::ConeFP(volData, projData, dims, angle, 1.0f); - -#else - - for (int i = 0; i < 100; ++i) { - char fname[32]; - sprintf(fname, "Tiffs/%04d.png", 4*i); - unsigned int w,h; - float* bufp = loadImage(fname, w,h); - - for (int j = 0; j < 512*512; ++j) { - float v = bufp[j]; - if (v > 236.0f) v = 236.0f; - v = logf(236.0f / v); - bufp[j] = 256*v; - } - - for (int j = 0; j < 512; ++j) { - cudaMemcpy(((float*)projData.ptr)+100*512*j+512*i, bufp+512*j, 512*sizeof(float), cudaMemcpyHostToDevice); - } - - delete[] bufp; - - } -#endif - -#if 0 - float* bufs = new float[100*512]; - - for (int i = 0; i < 512; ++i) { - cudaMemcpy(bufs, ((float*)projData.ptr)+100*512*i, 100*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, 100, 512, bufs); - } - - float* bufp = new float[512*512]; - - for (int i = 0; i < 100; ++i) { - for (int j = 0; j < 512; ++j) { - cudaMemcpy(bufp+512*j, ((float*)projData.ptr)+100*512*j+512*i, 512*sizeof(float), cudaMemcpyDeviceToHost); - } - - char fname[20]; - sprintf(fname, "proj%03d.png", i); - saveImage(fname, 512, 512, bufp); - } -#endif - - zeroVolumeData(volData, dims); - - cudaPitchedPtr maskData; - maskData.ptr = 0; - - astraCUDA3d::doSIRT(volData, projData, maskData, dims, angle, 50); -#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); - - char fname[20]; - sprintf(fname, "vol%03d.png", i); - saveImage(fname, 256, 256, buf); - } -#endif - - return 0; -} -#endif - -- cgit v1.2.3