projectionDDb_mex_cuda.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. %% Author: Rodrigo de Barros Vimieiro
  3. % Date: March, 2019
  4. % rodrigo.vimieiro@gmail.com
  5. % =========================================================================
  6. %{
  7. % -------------------------------------------------------------------------
  8. %
  9. % -------------------------------------------------------------------------
  10. % DESCRIPTION:
  11. % This is the header function
  12. % ---------------------------------------------------------------------
  13. % Copyright (C) <2019> <Rodrigo de Barros Vimieiro>
  14. %
  15. % This program is free software: you can redistribute it and/or modify
  16. % it under the terms of the GNU General Public License as published by
  17. % the Free Software Foundation, either version 3 of the License, or
  18. % (at your option) any later version.
  19. %
  20. % This program is distributed in the hope that it will be useful,
  21. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. % GNU General Public License for more details.
  24. %
  25. % You should have received a copy of the GNU General Public License
  26. % along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. %}
  28. % =========================================================================
  29. %% 3-D Projection Branchless Distance Driven header
  30. */
  31. //typedef double user_dataType;
  32. //typedef float user_dataType;
  33. //#define user_mexdataType mxDOUBLE_CLASS
  34. //#define user_mexdataType mxSINGLE_CLASS
  35. #include "mex.h"
  36. #define _USE_MATH_DEFINES
  37. #include <math.h>
  38. // Includes CUDA
  39. #include <cuda_runtime.h>
  40. // Utilities and timing functions
  41. #include <helper_functions.h> // includes cuda.h and cuda_runtime_api.h
  42. // CUDA helper functions
  43. #include <helper_cuda.h> // helper functions for CUDA error check
  44. #define integrateXcoord 1
  45. #define integrateYcoord 0
  46. /*
  47. Reference: TIGRE - https://github.com/CERN/TIGRE
  48. */
  49. #define cudaCheckErrors(msg) \
  50. do { \
  51. cudaError_t __err = cudaGetLastError(); \
  52. if (__err != cudaSuccess) { \
  53. mexPrintf("%s \n",msg);\
  54. mexErrMsgIdAndTxt("MATLAB:mexcpp:typeargin",cudaGetErrorString(__err));\
  55. } \
  56. } while (0)
  57. void projectionDDb(double* const h_pProj, double* const h_pVolume, double* const h_pTubeAngle, double* const h_pDetAngle, const double idXProj, const unsigned int nProj, const unsigned int nPixX,
  58. const unsigned int nPixY, const unsigned int nSlices, const unsigned int nDetX, const unsigned int nDetY, const double dx, const double dy, double dz, const double du,
  59. const double dv, const double DSD, const double DDR, const double DAG);