backprojectionDDb_mex.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 Back-projection Branchless Distance Driven Code (CPU-Multithread)
  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. #include <omp.h>
  37. #define _USE_MATH_DEFINES
  38. #include <math.h>
  39. #include <time.h>
  40. // Global variable
  41. int nThreads;
  42. void backprojectionDDb(double* const pVolume,
  43. double* const pProj,
  44. double* const pTubeAngle,
  45. double* const pDetAngle,
  46. const int nProj,
  47. const int nPixX,
  48. const int nPixY,
  49. const int nSlices,
  50. const int nDetX,
  51. const int nDetY,
  52. const double dx,
  53. const double dy,
  54. const double dz,
  55. const double du,
  56. const double dv,
  57. const double DSD,
  58. const double DDR,
  59. const double DAG);
  60. void mapBoudaries(double* pBound,
  61. const int nElem,
  62. const double valueLeftBound,
  63. const double sizeElem,
  64. const double offset);
  65. void mapDet2Slice(double* const pXmapp,
  66. double* const pYmapp,
  67. double tubeX,
  68. double tubeY,
  69. double tubeZ,
  70. double * const pXcoord,
  71. double * const pYcoord,
  72. double * const pZcoord,
  73. double ZSlicecoord,
  74. const int nXelem,
  75. const int nYelem);
  76. void bilinear_interpolation(double* pSliceI,
  77. double* pProj,
  78. double* pObjX,
  79. double* pObjY,
  80. double* pDetmX,
  81. double* pDetmY,
  82. const int nPixXMap,
  83. const int nPixYMap,
  84. const int nDetXMap,
  85. const int nDetYMap,
  86. const int nDetX,
  87. const int nDetY,
  88. const unsigned int np);
  89. void differentiation(double* pVolume,
  90. double* pSliceI,
  91. double tubeX,
  92. double rtubeY,
  93. double rtubeZ,
  94. double* const pObjX,
  95. double* const pObjY,
  96. double* const pObjZ,
  97. const int nPixX,
  98. const int nPixY,
  99. const int nPixXMap,
  100. const int nPixYMap,
  101. const double du,
  102. const double dv,
  103. const double dx,
  104. const double dy,
  105. const double dz,
  106. const unsigned int nz);