From bcff7884bb89dbecd394c75a8f57b0a54a743b52 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 16 Apr 2014 11:13:33 +0000 Subject: Change allocate/zeroVolume to volume/sinogram-specific variants --- cuda/2d/sart.cu | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'cuda/2d/sart.cu') diff --git a/cuda/2d/sart.cu b/cuda/2d/sart.cu index 7f499ce..79c00ef 100644 --- a/cuda/2d/sart.cu +++ b/cuda/2d/sart.cu @@ -105,15 +105,18 @@ void SART::reset() bool SART::init() { if (useVolumeMask) { - allocateVolume(D_tmpData, dims.iVolWidth, dims.iVolHeight, tmpPitch); - zeroVolume(D_tmpData, tmpPitch, dims.iVolWidth, dims.iVolHeight); + allocateVolumeData(D_tmpData, tmpPitch, dims); + zeroVolumeData(D_tmpData, tmpPitch, dims); } - allocateVolume(D_projData, dims.iProjDets, 1, projPitch); - zeroVolume(D_projData, projPitch, dims.iProjDets, 1); + // NB: Non-standard dimensions + SDimensions linedims = dims; + linedims.iProjAngles = 1; + allocateProjectionData(D_projData, projPitch, linedims); + zeroProjectionData(D_projData, projPitch, linedims); - allocateVolume(D_lineWeight, dims.iProjDets, dims.iProjAngles, linePitch); - zeroVolume(D_lineWeight, linePitch, dims.iProjDets, dims.iProjAngles); + allocateProjectionData(D_lineWeight, linePitch, dims); + zeroProjectionData(D_lineWeight, linePitch, dims); // We can't precompute lineWeights when using a mask if (!useVolumeMask) @@ -138,13 +141,13 @@ bool SART::setProjectionOrder(int* _projectionOrder, int _projectionCount) bool SART::precomputeWeights() { - zeroVolume(D_lineWeight, linePitch, dims.iProjDets, dims.iProjAngles); + zeroProjectionData(D_lineWeight, linePitch, dims); if (useVolumeMask) { callFP(D_maskData, maskPitch, D_lineWeight, linePitch, 1.0f); } else { // Allocate tmpData temporarily - allocateVolume(D_tmpData, dims.iVolWidth, dims.iVolHeight, tmpPitch); - zeroVolume(D_tmpData, tmpPitch, dims.iVolWidth, dims.iVolHeight); + allocateVolumeData(D_tmpData, tmpPitch, dims); + zeroVolumeData(D_tmpData, tmpPitch, dims); processVol(D_tmpData, 1.0f, tmpPitch, dims.iVolWidth, dims.iVolHeight); @@ -193,7 +196,7 @@ bool SART::iterate(unsigned int iterations) if (useVolumeMask) { // BP, mask, and add back // TODO: Try putting the masking directly in the BP - zeroVolume(D_tmpData, tmpPitch, dims.iVolWidth, dims.iVolHeight); + zeroVolumeData(D_tmpData, tmpPitch, dims); callBP_SART(D_tmpData, tmpPitch, D_projData, projPitch, angle); processVol(D_volumeData, D_maskData, D_tmpData, volumePitch, dims.iVolWidth, dims.iVolHeight); } else { @@ -216,8 +219,8 @@ float SART::computeDiffNorm() { unsigned int pPitch; float *D_p; - allocateVolume(D_p, dims.iProjDets, dims.iProjAngles, pPitch); - zeroVolume(D_p, pPitch, dims.iProjDets, dims.iProjAngles); + allocateProjectionData(D_p, pPitch, dims); + zeroProjectionData(D_p, pPitch, dims); // copy sinogram to D_p cudaMemcpy2D(D_p, sizeof(float)*pPitch, D_sinoData, sizeof(float)*sinoPitch, sizeof(float)*(dims.iProjDets), dims.iProjAngles, cudaMemcpyDeviceToDevice); -- cgit v1.2.3