pyfast 4.12.0__cp36-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. fast/README.md +41 -0
  2. fast/__init__.py +22 -0
  3. fast/bin/DirectML.dll +0 -0
  4. fast/bin/FAST.dll +0 -0
  5. fast/bin/InferenceEngineONNXRuntime.dll +0 -0
  6. fast/bin/InferenceEngineOpenVINO.dll +0 -0
  7. fast/bin/InferenceEngineTensorFlow.dll +0 -0
  8. fast/bin/InferenceEngineTensorRT.dll +0 -0
  9. fast/bin/JKQTCommonSharedLib_Release.dll +0 -0
  10. fast/bin/JKQTFastPlotterSharedLib_Release.dll +0 -0
  11. fast/bin/JKQTMathTextSharedLib_Release.dll +0 -0
  12. fast/bin/JKQTPlotterSharedLib_Release.dll +0 -0
  13. fast/bin/OpenCL.dll +0 -0
  14. fast/bin/OpenIGTLink.dll +0 -0
  15. fast/bin/Qt5Concurrent.dll +0 -0
  16. fast/bin/Qt5Core.dll +0 -0
  17. fast/bin/Qt5DBus.dll +0 -0
  18. fast/bin/Qt5Gui.dll +0 -0
  19. fast/bin/Qt5Multimedia.dll +0 -0
  20. fast/bin/Qt5MultimediaWidgets.dll +0 -0
  21. fast/bin/Qt5Network.dll +0 -0
  22. fast/bin/Qt5OpenGL.dll +0 -0
  23. fast/bin/Qt5PrintSupport.dll +0 -0
  24. fast/bin/Qt5SerialPort.dll +0 -0
  25. fast/bin/Qt5Sql.dll +0 -0
  26. fast/bin/Qt5Svg.dll +0 -0
  27. fast/bin/Qt5Test.dll +0 -0
  28. fast/bin/Qt5Widgets.dll +0 -0
  29. fast/bin/Qt5Xml.dll +0 -0
  30. fast/bin/UFFviewer.exe +0 -0
  31. fast/bin/_fast.pyd +0 -0
  32. fast/bin/brotlicommon.dll +0 -0
  33. fast/bin/brotlidec.dll +0 -0
  34. fast/bin/brotlienc.dll +0 -0
  35. fast/bin/cache.json +114134 -0
  36. fast/bin/dcmdata.dll +0 -0
  37. fast/bin/dcmimage.dll +0 -0
  38. fast/bin/dcmimgle.dll +0 -0
  39. fast/bin/dcmjpeg.dll +0 -0
  40. fast/bin/fast_configuration.txt +14 -0
  41. fast/bin/gna.dll +0 -0
  42. fast/bin/ijg12.dll +0 -0
  43. fast/bin/ijg16.dll +0 -0
  44. fast/bin/ijg8.dll +0 -0
  45. fast/bin/jxl.dll +0 -0
  46. fast/bin/jxl_cms.dll +0 -0
  47. fast/bin/jxl_threads.dll +0 -0
  48. fast/bin/libcrypto-1_1-x64.dll +0 -0
  49. fast/bin/libjpeg.dll +0 -0
  50. fast/bin/libopenslide-1.dll +0 -0
  51. fast/bin/libssl-1_1-x64.dll +0 -0
  52. fast/bin/oflog.dll +0 -0
  53. fast/bin/ofstd.dll +0 -0
  54. fast/bin/onnxruntime.dll +0 -0
  55. fast/bin/onnxruntime_providers_shared.dll +0 -0
  56. fast/bin/openvino.dll +0 -0
  57. fast/bin/openvino_auto_batch_plugin.dll +0 -0
  58. fast/bin/openvino_auto_plugin.dll +0 -0
  59. fast/bin/openvino_c.dll +0 -0
  60. fast/bin/openvino_gapi_preproc.dll +0 -0
  61. fast/bin/openvino_hetero_plugin.dll +0 -0
  62. fast/bin/openvino_intel_cpu_plugin.dll +0 -0
  63. fast/bin/openvino_intel_gna_plugin.dll +0 -0
  64. fast/bin/openvino_intel_gpu_plugin.dll +0 -0
  65. fast/bin/openvino_ir_frontend.dll +0 -0
  66. fast/bin/openvino_onnx_frontend.dll +0 -0
  67. fast/bin/openvino_paddle_frontend.dll +0 -0
  68. fast/bin/plugins.xml +24 -0
  69. fast/bin/realsense2.dll +0 -0
  70. fast/bin/runPipeline.exe +0 -0
  71. fast/bin/systemCheck.exe +0 -0
  72. fast/bin/tbb.dll +0 -0
  73. fast/bin/tbb_preview.dll +0 -0
  74. fast/bin/tbbbind.dll +0 -0
  75. fast/bin/tbbmalloc.dll +0 -0
  76. fast/bin/tbbmalloc_proxy.dll +0 -0
  77. fast/bin/tiff.dll +0 -0
  78. fast/bin/zlib.dll +0 -0
  79. fast/doc/bright-plotting-style.ini +66 -0
  80. fast/doc/dark-plotting-style.ini +66 -0
  81. fast/doc/fonts/UFL.txt +96 -0
  82. fast/doc/fonts/Ubuntu-Bold.ttf +0 -0
  83. fast/doc/fonts/Ubuntu-BoldItalic.ttf +0 -0
  84. fast/doc/fonts/Ubuntu-Italic.ttf +0 -0
  85. fast/doc/fonts/Ubuntu-Light.ttf +0 -0
  86. fast/doc/fonts/Ubuntu-LightItalic.ttf +0 -0
  87. fast/doc/fonts/Ubuntu-Medium.ttf +0 -0
  88. fast/doc/fonts/Ubuntu-MediumItalic.ttf +0 -0
  89. fast/doc/fonts/Ubuntu-Regular.ttf +0 -0
  90. fast/doc/fonts/UbuntuMono-Bold.ttf +0 -0
  91. fast/doc/fonts/UbuntuMono-BoldItalic.ttf +0 -0
  92. fast/doc/fonts/UbuntuMono-Italic.ttf +0 -0
  93. fast/doc/fonts/UbuntuMono-Regular.ttf +0 -0
  94. fast/doc/images/FAST_logo_square.png +0 -0
  95. fast/doc/images/fast_icon.ico +0 -0
  96. fast/doc/images/fast_icon.png +0 -0
  97. fast/entry_points.py +14 -0
  98. fast/fast.py +20057 -0
  99. fast/kernels/Algorithms/AirwaySegmentation/AirwaySegmentation.cl +85 -0
  100. fast/kernels/Algorithms/ApplyColormap/ApplyColormap.cl +146 -0
  101. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding2D.cl +61 -0
  102. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding3D.cl +61 -0
  103. fast/kernels/Algorithms/BlockMatching/BlockMatching.cl +257 -0
  104. fast/kernels/Algorithms/CenterlineExtraction/CenterlineExtraction.cl +153 -0
  105. fast/kernels/Algorithms/CoherentPointDrift/CoherentPointDrift.cl +0 -0
  106. fast/kernels/Algorithms/Color/ColorToGrayscale.cl +22 -0
  107. fast/kernels/Algorithms/Color/GrayscaleToColor.cl +19 -0
  108. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing2D.cl +35 -0
  109. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing3D.cl +75 -0
  110. fast/kernels/Algorithms/GradientVectorFlow/EulerGradientVectorFlow.cl +174 -0
  111. fast/kernels/Algorithms/GradientVectorFlow/MultigridGradientVectorFlow.cl +407 -0
  112. fast/kernels/Algorithms/HounsefieldConverter/HounsefieldConverter.cl +22 -0
  113. fast/kernels/Algorithms/ImageAdd/ImageAdd.cl +79 -0
  114. fast/kernels/Algorithms/ImageCaster/ImageCaster.cl +38 -0
  115. fast/kernels/Algorithms/ImageChannelConverter/ImageChannelConverter.cl +121 -0
  116. fast/kernels/Algorithms/ImageFlipper/ImageFlipper2D.cl +23 -0
  117. fast/kernels/Algorithms/ImageFlipper/ImageFlipper3D.cl +51 -0
  118. fast/kernels/Algorithms/ImageGradient/ImageGradient.cl +71 -0
  119. fast/kernels/Algorithms/ImageInverter/ImageInverter.cl +30 -0
  120. fast/kernels/Algorithms/ImageMultiply/ImageMultiply.cl +79 -0
  121. fast/kernels/Algorithms/ImagePatch/PatchStitcher2D.cl +22 -0
  122. fast/kernels/Algorithms/ImagePatch/PatchStitcher3D.cl +95 -0
  123. fast/kernels/Algorithms/ImageResampler/ImageResampler2D.cl +40 -0
  124. fast/kernels/Algorithms/ImageResampler/ImageResampler3D.cl +32 -0
  125. fast/kernels/Algorithms/ImageResizer/ImageResizer.cl +134 -0
  126. fast/kernels/Algorithms/ImageSharpening/ImageSharpening.cl +47 -0
  127. fast/kernels/Algorithms/ImageSlicer/ImageSlicer.cl +77 -0
  128. fast/kernels/Algorithms/ImageTransposer/ImageTransposer2D.cl +16 -0
  129. fast/kernels/Algorithms/ImageTransposer/ImageTransposer3D.cl +45 -0
  130. fast/kernels/Algorithms/IntensityClipping/IntensityClipping2D.cl +19 -0
  131. fast/kernels/Algorithms/IntensityClipping/IntensityClipping3D.cl +20 -0
  132. fast/kernels/Algorithms/IntensityNormalization/IntensityNormalization.cl +85 -0
  133. fast/kernels/Algorithms/IntensityNormalization/ZeroMeanUnitVariance.cl +76 -0
  134. fast/kernels/Algorithms/KalmanFilterModelSegmentation/AppearanceModels/RidgeEdge/RidgeEdgeModel.cl +81 -0
  135. fast/kernels/Algorithms/LabelModifier/LabelModifier.cl +20 -0
  136. fast/kernels/Algorithms/LaplacianOfGaussian/LaplacianOfGaussian2D.cl +27 -0
  137. fast/kernels/Algorithms/LevelSet/LevelSetSegmentation.cl +132 -0
  138. fast/kernels/Algorithms/LungSegmentation/LungSegmentation.cl +22 -0
  139. fast/kernels/Algorithms/MeshToSegmentation/MeshToSegmentation.cl +184 -0
  140. fast/kernels/Algorithms/Morphology/Dilation.cl +56 -0
  141. fast/kernels/Algorithms/Morphology/Erosion.cl +64 -0
  142. fast/kernels/Algorithms/NeuralNetwork/NeuralNetwork.cl +122 -0
  143. fast/kernels/Algorithms/NeuralNetwork/VertexTensorToSegmentation.cl +13 -0
  144. fast/kernels/Algorithms/NonLocalMeans/NonLocalMeans2D.cl +94 -0
  145. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing2D.cl +57 -0
  146. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing3D.cl +58 -0
  147. fast/kernels/Algorithms/Skeletonization/Skeletonization2D.cl +77 -0
  148. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction.cl +519 -0
  149. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction_no_3d_write.cl +739 -0
  150. fast/kernels/Algorithms/TemporalSmoothing/ImageMovingAverage.cl +66 -0
  151. fast/kernels/Algorithms/TemporalSmoothing/ImageWeightedMovingAverage.cl +74 -0
  152. fast/kernels/Algorithms/TissueSegmentation/TissueSegmentation.cl +18 -0
  153. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/InverseGradientSegmentation.cl +203 -0
  154. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/TubeSegmentationAndCenterlineExtraction.cl +566 -0
  155. fast/kernels/Algorithms/Ultrasound/EnvelopeAndLogCompressor.cl +45 -0
  156. fast/kernels/Algorithms/Ultrasound/ScanConverter.cl +76 -0
  157. fast/kernels/Algorithms/UltrasoundImageCropper/UltrasoundImageCropper.cl +31 -0
  158. fast/kernels/Algorithms/UltrasoundImageEnhancement/UltrasoundImageEnhancement.cl +27 -0
  159. fast/kernels/Algorithms/VectorMedianFilter/VectorMedianFilter.cl +31 -0
  160. fast/kernels/ImageFill.cl +30 -0
  161. fast/kernels/ImageMinMax.cl +196 -0
  162. fast/kernels/ImageSum.cl +170 -0
  163. fast/kernels/Tests/Algorithms/DoubleFilter.cl +7 -0
  164. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.frag +8 -0
  165. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.geom +69 -0
  166. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.vert +17 -0
  167. fast/kernels/Visualization/HeatmapRenderer/HeatmapRenderer.cl +51 -0
  168. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.frag +11 -0
  169. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.vert +15 -0
  170. fast/kernels/Visualization/ImageRenderer/ImageRenderer.vert +15 -0
  171. fast/kernels/Visualization/ImageRenderer/ImageRendererFLOAT.frag +18 -0
  172. fast/kernels/Visualization/ImageRenderer/ImageRendererINT.frag +18 -0
  173. fast/kernels/Visualization/ImageRenderer/ImageRendererUINT.frag +18 -0
  174. fast/kernels/Visualization/LineRenderer/LineRenderer.frag +8 -0
  175. fast/kernels/Visualization/LineRenderer/LineRenderer.geom +35 -0
  176. fast/kernels/Visualization/LineRenderer/LineRenderer.vert +20 -0
  177. fast/kernels/Visualization/LineRenderer/LineRenderer3D.frag +8 -0
  178. fast/kernels/Visualization/LineRenderer/LineRenderer3D.vert +20 -0
  179. fast/kernels/Visualization/LineRenderer/LineRendererJoints.frag +15 -0
  180. fast/kernels/Visualization/LineRenderer/LineRendererJoints.vert +24 -0
  181. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.frag +11 -0
  182. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.vert +16 -0
  183. fast/kernels/Visualization/SegmentationRenderer/SegmentationPyramidRenderer.frag +53 -0
  184. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.frag +52 -0
  185. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.vert +15 -0
  186. fast/kernels/Visualization/TextRenderer/TextRenderer.frag +11 -0
  187. fast/kernels/Visualization/TextRenderer/TextRenderer.vert +20 -0
  188. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.frag +49 -0
  189. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.vert +35 -0
  190. fast/kernels/Visualization/VectorFieldRenderer/VectorFieldColorRenderer.cl +30 -0
  191. fast/kernels/Visualization/VertexRenderer/VertexRenderer.frag +14 -0
  192. fast/kernels/Visualization/VertexRenderer/VertexRenderer.vert +23 -0
  193. fast/kernels/Visualization/View.cl +10 -0
  194. fast/kernels/Visualization/VolumeRenderer/AlphaBlendingVolumeRenderer.cl +211 -0
  195. fast/kernels/Visualization/VolumeRenderer/MaximumIntensityProjection.cl +139 -0
  196. fast/kernels/Visualization/VolumeRenderer/ThresholdVolumeRenderer.cl +178 -0
  197. fast/licenses/LICENSE +203 -0
  198. fast/licenses/MSVC/MSVC_redis_files_license.txt +96 -0
  199. fast/licenses/OpenIGTLink/LICENSE.txt +30 -0
  200. fast/licenses/OpenJPEG/LICENSE +39 -0
  201. fast/licenses/OpenSlide/COPYING.LESSER +504 -0
  202. fast/licenses/PCRE2/LICENCE.md +103 -0
  203. fast/licenses/SQLite/PUBLIC-DOMAIN.txt +9 -0
  204. fast/licenses/THIRD_PARTY_TF_C_LICENSES +7955 -0
  205. fast/licenses/cairo/COPYING +33 -0
  206. fast/licenses/cairo/COPYING-LGPL-2.1 +510 -0
  207. fast/licenses/cairo/COPYING-MPL-1.1 +470 -0
  208. fast/licenses/clarius/LICENSE +29 -0
  209. fast/licenses/dcmtk/COPYRIGHT +1034 -0
  210. fast/licenses/directml/LICENSE-CODE.txt +21 -0
  211. fast/licenses/directml/LICENSE.txt +48 -0
  212. fast/licenses/directml/ThirdPartyNotices.txt +103 -0
  213. fast/licenses/eigen/COPYING.APACHE +203 -0
  214. fast/licenses/eigen/COPYING.BSD +26 -0
  215. fast/licenses/eigen/COPYING.GPL +674 -0
  216. fast/licenses/eigen/COPYING.LGPL +502 -0
  217. fast/licenses/eigen/COPYING.MINPACK +51 -0
  218. fast/licenses/eigen/COPYING.MPL2 +373 -0
  219. fast/licenses/eigen/COPYING.README +18 -0
  220. fast/licenses/fast/LICENSE +25 -0
  221. fast/licenses/gdk-pixbuf/COPYING +502 -0
  222. fast/licenses/glib/COPYING +175 -0
  223. fast/licenses/hdf5/COPYING +106 -0
  224. fast/licenses/jkqtplotter/LICENSE +505 -0
  225. fast/licenses/jpegxl/LICENSE.brotli +19 -0
  226. fast/licenses/jpegxl/LICENSE.highway +201 -0
  227. fast/licenses/jpegxl/LICENSE.jpeg-xl +27 -0
  228. fast/licenses/jpegxl/LICENSE.skcms +29 -0
  229. fast/licenses/jpegxl/PATENTS +22 -0
  230. fast/licenses/libdicom/LICENSE +21 -0
  231. fast/licenses/libffi/LICENSE +21 -0
  232. fast/licenses/libjpeg-turbo/LICENSE.md +135 -0
  233. fast/licenses/libjpeg-turbo/README.ijg +260 -0
  234. fast/licenses/libpng/LICENSE +134 -0
  235. fast/licenses/libtiff/LICENSE.md +23 -0
  236. fast/licenses/libxml2/Copyright +24 -0
  237. fast/licenses/onnxruntime/LICENSE +21 -0
  238. fast/licenses/onnxruntime/Privacy.md +21 -0
  239. fast/licenses/onnxruntime/ThirdPartyNotices.txt +6156 -0
  240. fast/licenses/opencl/LICENSE +201 -0
  241. fast/licenses/openssl/LICENSE.txt +125 -0
  242. fast/licenses/openvino/Apache_license.txt +201 -0
  243. fast/licenses/openvino/EULA.htm +43 -0
  244. fast/licenses/openvino/EULA.rtf +61 -0
  245. fast/licenses/openvino/EULA.txt +163 -0
  246. fast/licenses/openvino/GNA SOFTWARE LICENSE AGREEMENT.txt +1 -0
  247. fast/licenses/openvino/Intel_Software_Development_Products.rtf +1217 -0
  248. fast/licenses/openvino/Intel_Software_Development_Products.txt +707 -0
  249. fast/licenses/openvino/LICENSE +201 -0
  250. fast/licenses/openvino/OpenVINOsupport.txt +12 -0
  251. fast/licenses/openvino/onednn_third-party-programs.txt +557 -0
  252. fast/licenses/openvino/readme.txt +60 -0
  253. fast/licenses/openvino/redist.txt +42 -0
  254. fast/licenses/openvino/runtime-third-party-programs.txt +1400 -0
  255. fast/licenses/openvino/tbb_third-party-programs.txt +230 -0
  256. fast/licenses/pixman/COPYING +42 -0
  257. fast/licenses/proxy-libintl/COPYING +482 -0
  258. fast/licenses/qt5/LICENSE.FDL +450 -0
  259. fast/licenses/qt5/LICENSE.GPL3-EXCEPT +704 -0
  260. fast/licenses/qt5/LICENSE.GPLv2 +292 -0
  261. fast/licenses/qt5/LICENSE.GPLv3 +686 -0
  262. fast/licenses/qt5/LICENSE.LGPLv21 +514 -0
  263. fast/licenses/qt5/LICENSE.LGPLv3 +175 -0
  264. fast/licenses/qt5/LICENSE.QT-LICENSE-AGREEMENT +1331 -0
  265. fast/licenses/realsense/LICENSE +202 -0
  266. fast/licenses/realsense/NOTICE +937 -0
  267. fast/licenses/semaphore/Semaphore_LICENSE.txt +17 -0
  268. fast/licenses/tiff/COPYRIGHT +21 -0
  269. fast/licenses/uthash/LICENSE +21 -0
  270. fast/licenses/zip/UNLICENSE +26 -0
  271. fast/licenses/zlib/README +115 -0
  272. fast/licenses/zlib-ng/LICENSE.md +19 -0
  273. fast/pipelines/uff_viewer/colormap_and_reject.fpl +26 -0
  274. fast/pipelines/uff_viewer/default.fpl +9 -0
  275. fast/pipelines/uff_viewer/non_local_means.fpl +34 -0
  276. fast/plugins/audio/qtaudio_wasapi.dll +0 -0
  277. fast/plugins/audio/qtaudio_windows.dll +0 -0
  278. fast/plugins/bearer/qgenericbearer.dll +0 -0
  279. fast/plugins/generic/qtuiotouchplugin.dll +0 -0
  280. fast/plugins/iconengines/qsvgicon.dll +0 -0
  281. fast/plugins/imageformats/qgif.dll +0 -0
  282. fast/plugins/imageformats/qicns.dll +0 -0
  283. fast/plugins/imageformats/qico.dll +0 -0
  284. fast/plugins/imageformats/qjpeg.dll +0 -0
  285. fast/plugins/imageformats/qsvg.dll +0 -0
  286. fast/plugins/imageformats/qtga.dll +0 -0
  287. fast/plugins/imageformats/qtiff.dll +0 -0
  288. fast/plugins/imageformats/qwbmp.dll +0 -0
  289. fast/plugins/imageformats/qwebp.dll +0 -0
  290. fast/plugins/mediaservice/dsengine.dll +0 -0
  291. fast/plugins/mediaservice/qtmedia_audioengine.dll +0 -0
  292. fast/plugins/mediaservice/wmfengine.dll +0 -0
  293. fast/plugins/platforms/qdirect2d.dll +0 -0
  294. fast/plugins/platforms/qminimal.dll +0 -0
  295. fast/plugins/platforms/qoffscreen.dll +0 -0
  296. fast/plugins/platforms/qwindows.dll +0 -0
  297. fast/plugins/platformthemes/qxdgdesktopportal.dll +0 -0
  298. fast/plugins/playlistformats/qtmultimedia_m3u.dll +0 -0
  299. fast/plugins/printsupport/windowsprintersupport.dll +0 -0
  300. fast/plugins/sqldrivers/qsqlite.dll +0 -0
  301. fast/plugins/sqldrivers/qsqlodbc.dll +0 -0
  302. fast/plugins/styles/qwindowsvistastyle.dll +0 -0
  303. pyfast-4.12.0.dist-info/METADATA +81 -0
  304. pyfast-4.12.0.dist-info/RECORD +307 -0
  305. pyfast-4.12.0.dist-info/WHEEL +5 -0
  306. pyfast-4.12.0.dist-info/entry_points.txt +5 -0
  307. pyfast-4.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,77 @@
1
+
2
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
3
+
4
+ void checkNeighborhood(
5
+ const int2 position,
6
+ __read_only image2d_t readImage,
7
+ __write_only image2d_t writeImage,
8
+ __global char* stop,
9
+ uchar add
10
+ ) {
11
+ const int2 offsets[9] = {
12
+ {0,0},
13
+ {0,1},
14
+ {1,1},
15
+ {1,0},
16
+ {1,-1},
17
+ {0,-1},
18
+ {-1,-1},
19
+ {-1,0},
20
+ {-1,1}
21
+ };
22
+ // Read all neighbors
23
+ uchar neighbors[9];
24
+ neighbors[0] = read_imageui(readImage, sampler, position).x;
25
+ if(neighbors[0] == 1) { // check if current pixel is background
26
+ uchar sum = 0;
27
+ uchar transitions = 0; // number of 0-1 transitions
28
+ bool previousWasZero = false;
29
+ for(uchar i = 1; i < 9; i++) {
30
+ neighbors[i] = read_imageui(readImage, sampler, position+offsets[i]).x;
31
+ sum += neighbors[i];
32
+ if(previousWasZero && neighbors[i] == 1) {
33
+ transitions++;
34
+ }
35
+ if(neighbors[i] == 0) {
36
+ previousWasZero = true;
37
+ } else {
38
+ previousWasZero = false;
39
+ }
40
+ }
41
+ // Check last one
42
+ if(previousWasZero && neighbors[1] == 1) {
43
+ transitions++;
44
+ }
45
+
46
+ if(sum >= 2 && sum <= 6 &&
47
+ transitions == 1 &&
48
+ neighbors[1]*neighbors[3]*neighbors[5+add] == 0 &&
49
+ neighbors[3-add]*neighbors[5]*neighbors[7] == 0) {
50
+ // Delete pixel
51
+ write_imageui(writeImage, position, 0);
52
+ stop[0] = 0; // A pixel was deleted, continue
53
+ } else {
54
+ write_imageui(writeImage, position, 1);
55
+ }
56
+ } else {
57
+ write_imageui(writeImage, position, 0);
58
+ }
59
+ }
60
+
61
+ __kernel void thinningStep1(
62
+ __read_only image2d_t readImage,
63
+ __write_only image2d_t writeImage,
64
+ __global char* stop
65
+ ) {
66
+ const int2 position = {get_global_id(0), get_global_id(1)};
67
+ checkNeighborhood(position, readImage, writeImage, stop, 0);
68
+ }
69
+
70
+ __kernel void thinningStep2(
71
+ __read_only image2d_t readImage,
72
+ __write_only image2d_t writeImage,
73
+ __global char* stop
74
+ ) {
75
+ const int2 position = {get_global_id(0), get_global_id(1)};
76
+ checkNeighborhood(position, readImage, writeImage, stop, 2);
77
+ }
@@ -0,0 +1,519 @@
1
+ #pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
2
+
3
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
4
+ __constant sampler_t sampler2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
5
+
6
+ __constant int4 cubeOffsets[8] = {
7
+ {0, 0, 0, 0},
8
+ {1, 0, 0, 0},
9
+ {0, 0, 1, 0},
10
+ {1, 0, 1, 0},
11
+ {0, 1, 0, 0},
12
+ {1, 1, 0, 0},
13
+ {0, 1, 1, 0},
14
+ {1, 1, 1, 0},
15
+ };
16
+
17
+ __kernel void constructHPLevel(
18
+ __read_only image3d_t readHistoPyramid,
19
+ __write_only image3d_t writeHistoPyramid
20
+ ) {
21
+
22
+ int4 writePos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
23
+ int4 readPos = writePos*2;
24
+ int writeValue = read_imagei(readHistoPyramid, sampler, readPos).x + // 0
25
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[1]).x + // 1
26
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[2]).x + // 2
27
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[3]).x + // 3
28
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[4]).x + // 4
29
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[5]).x + // 5
30
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[6]).x + // 6
31
+ read_imagei(readHistoPyramid, sampler, readPos+cubeOffsets[7]).x; // 7
32
+
33
+ write_imagei(writeHistoPyramid, writePos, writeValue);
34
+ }
35
+
36
+ int4 scanHPLevel(int target, __read_only image3d_t hp, int4 current) {
37
+
38
+ int8 neighbors = {
39
+ read_imagei(hp, sampler, current).x,
40
+ read_imagei(hp, sampler, current + cubeOffsets[1]).x,
41
+ read_imagei(hp, sampler, current + cubeOffsets[2]).x,
42
+ read_imagei(hp, sampler, current + cubeOffsets[3]).x,
43
+ read_imagei(hp, sampler, current + cubeOffsets[4]).x,
44
+ read_imagei(hp, sampler, current + cubeOffsets[5]).x,
45
+ read_imagei(hp, sampler, current + cubeOffsets[6]).x,
46
+ read_imagei(hp, sampler, current + cubeOffsets[7]).x
47
+ };
48
+
49
+ int acc = current.s3 + neighbors.s0;
50
+ int8 cmp;
51
+ cmp.s0 = acc <= target;
52
+ acc += neighbors.s1;
53
+ cmp.s1 = acc <= target;
54
+ acc += neighbors.s2;
55
+ cmp.s2 = acc <= target;
56
+ acc += neighbors.s3;
57
+ cmp.s3 = acc <= target;
58
+ acc += neighbors.s4;
59
+ cmp.s4 = acc <= target;
60
+ acc += neighbors.s5;
61
+ cmp.s5 = acc <= target;
62
+ acc += neighbors.s6;
63
+ cmp.s6 = acc <= target;
64
+ cmp.s7 = 0;
65
+
66
+
67
+ current += cubeOffsets[(cmp.s0+cmp.s1+cmp.s2+cmp.s3+cmp.s4+cmp.s5+cmp.s6+cmp.s7)];
68
+ current.s0 = current.s0*2;
69
+ current.s1 = current.s1*2;
70
+ current.s2 = current.s2*2;
71
+ current.s3 = current.s3 +
72
+ cmp.s0*neighbors.s0 +
73
+ cmp.s1*neighbors.s1 +
74
+ cmp.s2*neighbors.s2 +
75
+ cmp.s3*neighbors.s3 +
76
+ cmp.s4*neighbors.s4 +
77
+ cmp.s5*neighbors.s5 +
78
+ cmp.s6*neighbors.s6 +
79
+ cmp.s7*neighbors.s7;
80
+ return current;
81
+
82
+ }
83
+
84
+
85
+ __constant char offsets3[72] = {
86
+ // 0
87
+ 0,0,0,
88
+ 1,0,0,
89
+ // 1
90
+ 1,0,0,
91
+ 1,0,1,
92
+ // 2
93
+ 1,0,1,
94
+ 0,0,1,
95
+ // 3
96
+ 0,0,1,
97
+ 0,0,0,
98
+ // 4
99
+ 0,1,0,
100
+ 1,1,0,
101
+ // 5
102
+ 1,1,0,
103
+ 1,1,1,
104
+ // 6
105
+ 1,1,1,
106
+ 0,1,1,
107
+ // 7
108
+ 0,1,1,
109
+ 0,1,0,
110
+ // 8
111
+ 0,0,0,
112
+ 0,1,0,
113
+ // 9
114
+ 1,0,0,
115
+ 1,1,0,
116
+ // 10
117
+ 1,0,1,
118
+ 1,1,1,
119
+ // 11
120
+ 0,0,1,
121
+ 0,1,1
122
+ };
123
+
124
+ __constant char triTable[4096] =
125
+ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
126
+ 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
127
+ 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
128
+ 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
129
+ 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
130
+ 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
131
+ 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
132
+ 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,
133
+ 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
134
+ 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
135
+ 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
136
+ 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,
137
+ 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
138
+ 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,
139
+ 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,
140
+ 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
141
+ 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
142
+ 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
143
+ 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
144
+ 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,
145
+ 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
146
+ 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,
147
+ 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,
148
+ 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,
149
+ 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
150
+ 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,
151
+ 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,
152
+ 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,
153
+ 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,
154
+ 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,
155
+ 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,
156
+ 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,
157
+ 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158
+ 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
159
+ 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
160
+ 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,
161
+ 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
162
+ 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,
163
+ 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,
164
+ 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,
165
+ 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
166
+ 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,
167
+ 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,
168
+ 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,
169
+ 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,
170
+ 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,
171
+ 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,
172
+ 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,
173
+ 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
174
+ 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,
175
+ 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,
176
+ 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
177
+ 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,
178
+ 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,
179
+ 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,
180
+ 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,
181
+ 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,
182
+ 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,
183
+ 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,
184
+ 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,
185
+ 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,
186
+ 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,
187
+ 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,
188
+ 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
189
+ 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
190
+ 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
191
+ 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
192
+ 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,
193
+ 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
194
+ 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,
195
+ 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,
196
+ 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,
197
+ 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
198
+ 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,
199
+ 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,
200
+ 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,
201
+ 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,
202
+ 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,
203
+ 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,
204
+ 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,
205
+ 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
206
+ 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,
207
+ 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,
208
+ 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,
209
+ 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,
210
+ 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,
211
+ 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,
212
+ 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,
213
+ 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,
214
+ 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,
215
+ 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,
216
+ 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,
217
+ 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,
218
+ 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,
219
+ 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,
220
+ 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,
221
+ 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
222
+ 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,
223
+ 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,
224
+ 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,
225
+ 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,
226
+ 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,
227
+ 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
228
+ 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,
229
+ 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,
230
+ 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,
231
+ 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,
232
+ 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,
233
+ 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,
234
+ 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,
235
+ 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,
236
+ 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
237
+ 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,
238
+ 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,
239
+ 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,
240
+ 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,
241
+ 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,
242
+ 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,
243
+ 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,
244
+ 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
245
+ 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,
246
+ 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,
247
+ 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,
248
+ 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,
249
+ 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,
250
+ 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
251
+ 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,
252
+ 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
253
+ 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
254
+ 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
255
+ 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
256
+ 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,
257
+ 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
258
+ 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,
259
+ 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,
260
+ 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,
261
+ 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
262
+ 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,
263
+ 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,
264
+ 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,
265
+ 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,
266
+ 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,
267
+ 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,
268
+ 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,
269
+ 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
270
+ 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,
271
+ 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,
272
+ 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,
273
+ 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,
274
+ 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,
275
+ 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,
276
+ 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,
277
+ 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,
278
+ 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
279
+ 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,
280
+ 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,
281
+ 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,
282
+ 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,
283
+ 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,
284
+ 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
285
+ 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
286
+ 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,
287
+ 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,
288
+ 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,
289
+ 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,
290
+ 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,
291
+ 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,
292
+ 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,
293
+ 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,
294
+ 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,
295
+ 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,
296
+ 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,
297
+ 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,
298
+ 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,
299
+ 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,
300
+ 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,
301
+ 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,
302
+ 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,
303
+ 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,
304
+ 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,
305
+ 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,
306
+ 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,
307
+ 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,
308
+ 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,
309
+ 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,
310
+ 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,
311
+ 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,
312
+ 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
313
+ 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,
314
+ 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,
315
+ 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
316
+ 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
317
+ 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
318
+ 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,
319
+ 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,
320
+ 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,
321
+ 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,
322
+ 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,
323
+ 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,
324
+ 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,
325
+ 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,
326
+ 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,
327
+ 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,
328
+ 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,
329
+ 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
330
+ 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,
331
+ 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,
332
+ 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
333
+ 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,
334
+ 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,
335
+ 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,
336
+ 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,
337
+ 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,
338
+ 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,
339
+ 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,
340
+ 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
341
+ 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,
342
+ 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,
343
+ 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,
344
+ 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,
345
+ 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,
346
+ 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
347
+ 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,
348
+ 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
349
+ 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,
350
+ 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,
351
+ 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,
352
+ 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,
353
+ 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,
354
+ 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,
355
+ 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,
356
+ 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,
357
+ 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,
358
+ 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,
359
+ 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,
360
+ 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
361
+ 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,
362
+ 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,
363
+ 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
364
+ 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
365
+ 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
366
+ 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,
367
+ 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,
368
+ 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
369
+ 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,
370
+ 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,
371
+ 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
372
+ 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
373
+ 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,
374
+ 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
375
+ 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,
376
+ 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
377
+ 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
378
+ 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
379
+ 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
380
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
381
+
382
+
383
+ #ifdef TYPE_UINT
384
+ #define READ_RAW_DATA (float)read_imageui
385
+ #elif TYPE_INT
386
+ #define READ_RAW_DATA (float)read_imagei
387
+ #else
388
+ #define READ_RAW_DATA read_imagef
389
+ #endif
390
+
391
+ __kernel void traverseHP(
392
+ __read_only image3d_t rawData,
393
+ __read_only image3d_t hp0, // Largest HP
394
+ __read_only image3d_t hp1,
395
+ __read_only image3d_t hp2,
396
+ __read_only image3d_t hp3,
397
+ __read_only image3d_t hp4,
398
+ __read_only image3d_t hp5,
399
+ #if SIZE > 64
400
+ __read_only image3d_t hp6,
401
+ #endif
402
+ #if SIZE > 128
403
+ __read_only image3d_t hp7,
404
+ #endif
405
+ #if SIZE > 256
406
+ __read_only image3d_t hp8,
407
+ #endif
408
+ #if SIZE > 512
409
+ __read_only image3d_t hp9,
410
+ #endif
411
+ __global float * coordinatesVBOBuffer,
412
+ __global float * normalVBOBuffer,
413
+ __private float isolevel,
414
+ __private int sum,
415
+ __private float spacing_x,
416
+ __private float spacing_y,
417
+ __private float spacing_z
418
+ ) {
419
+
420
+ int target = get_global_id(0);
421
+ if(target >= sum)
422
+ target = 0;
423
+
424
+ int4 cubePosition = {0,0,0,0}; // x,y,z,sum
425
+ #if SIZE > 512
426
+ cubePosition = scanHPLevel(target, hp9, cubePosition);
427
+ #endif
428
+ #if SIZE > 256
429
+ cubePosition = scanHPLevel(target, hp8, cubePosition);
430
+ #endif
431
+ #if SIZE > 128
432
+ cubePosition = scanHPLevel(target, hp7, cubePosition);
433
+ #endif
434
+ #if SIZE > 64
435
+ cubePosition = scanHPLevel(target, hp6, cubePosition);
436
+ #endif
437
+ cubePosition = scanHPLevel(target, hp5, cubePosition);
438
+ cubePosition = scanHPLevel(target, hp4, cubePosition);
439
+ cubePosition = scanHPLevel(target, hp3, cubePosition);
440
+ cubePosition = scanHPLevel(target, hp2, cubePosition);
441
+ cubePosition = scanHPLevel(target, hp1, cubePosition);
442
+ cubePosition = scanHPLevel(target, hp0, cubePosition);
443
+ cubePosition.x = cubePosition.x / 2;
444
+ cubePosition.y = cubePosition.y / 2;
445
+ cubePosition.z = cubePosition.z / 2;
446
+
447
+ char vertexNr = 0;
448
+ const uint cubeindex = read_imageui(hp0, sampler, cubePosition).y;
449
+
450
+ // max 5 triangles
451
+ for(int i = (target-cubePosition.s3)*3; i < (target-cubePosition.s3+1)*3; i++) { // for each vertex in triangle
452
+ const uchar edge = triTable[cubeindex*16 + i];
453
+ const int3 point0 = (int3)(cubePosition.x + offsets3[edge*6], cubePosition.y + offsets3[edge*6+1], cubePosition.z + offsets3[edge*6+2]);
454
+ const int3 point1 = (int3)(cubePosition.x + offsets3[edge*6+3], cubePosition.y + offsets3[edge*6+4], cubePosition.z + offsets3[edge*6+5]);
455
+
456
+ // Store vertex in VBO
457
+
458
+ // TODO Should use spacing in these calculations:
459
+ float3 spacing = {spacing_x, spacing_y, spacing_z};
460
+ const float3 forwardDifference0 = (float3)(
461
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x+1, point0.y, point0.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x-1, point0.y, point0.z, 0)).x),
462
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y+1, point0.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y-1, point0.z, 0)).x),
463
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z+1, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z-1, 0)).x)
464
+ );
465
+ const float3 forwardDifference1 = (float3)(
466
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x+1, point1.y, point1.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x-1, point1.y, point1.z, 0)).x),
467
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y+1, point1.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y-1, point1.z, 0)).x),
468
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z+1, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z-1, 0)).x)
469
+ );
470
+
471
+ const float value0 = READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z, 0)).x;
472
+ float diff = native_divide(
473
+ isolevel-value0,
474
+ READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z, 0)).x - value0);
475
+
476
+ // OpenCL on Mac is missing the mix function for some reason
477
+ #ifdef MAC_HACK
478
+ const float3 point0f = (float3)(point0.x, point0.y, point0.z);
479
+ const float3 point1f = (float3)(point1.x, point1.y, point1.z);
480
+ const float3 vertex = (point0f + (point1f-point0f)*diff)*spacing;
481
+ const float3 normal = normalize(forwardDifference0 + diff*(forwardDifference1-forwardDifference0));
482
+ #else
483
+ const float3 vertex = mix((float3)(point0.x, point0.y, point0.z), (float3)(point1.x, point1.y, point1.z), diff)*spacing;
484
+ const float3 normal = normalize(mix(forwardDifference0, forwardDifference1, diff));
485
+ #endif
486
+
487
+ vstore3(vertex, target*3 + vertexNr, coordinatesVBOBuffer);
488
+ vstore3(normal, target*3 + vertexNr, normalVBOBuffer);
489
+
490
+
491
+ ++vertexNr;
492
+ }
493
+ }
494
+
495
+ __constant uchar nrOfTriangles[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 4, 5, 5, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 4, 5, 4, 5, 3, 2, 3, 4, 4, 3, 4, 5, 3, 2, 4, 5, 5, 4, 5, 2, 4, 1, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 2, 4, 3, 4, 3, 5, 2, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 3, 4, 4, 3, 4, 5, 5, 4, 4, 3, 5, 2, 5, 4, 2, 1, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 2, 3, 4, 4, 5, 4, 5, 5, 2, 4, 3, 5, 4, 3, 2, 4, 1, 3, 4, 4, 5, 4, 5, 3, 4, 4, 5, 5, 2, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 2, 1, 3, 2, 4, 1, 2, 1, 1, 0};
496
+
497
+ __kernel void classifyCubes(
498
+ __write_only image3d_t histoPyramid,
499
+ __read_only image3d_t rawData,
500
+ __private float isolevel
501
+ ) {
502
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
503
+
504
+ const float first = READ_RAW_DATA(rawData, sampler, pos).x;
505
+
506
+ const uchar cubeindex =
507
+ ((first > isolevel)) |
508
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[1]).x > isolevel) << 1) |
509
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[3]).x > isolevel) << 2) |
510
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[2]).x > isolevel) << 3) |
511
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[4]).x > isolevel) << 4) |
512
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[5]).x > isolevel) << 5) |
513
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[7]).x > isolevel) << 6) |
514
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[6]).x > isolevel) << 7);
515
+
516
+
517
+ // Store number of triangles and cube index
518
+ write_imageui(histoPyramid, pos, (uint4)(nrOfTriangles[cubeindex], cubeindex, 0, 0));
519
+ }