pyfast 4.12.0__cp36-abi3-macosx_10_13_x86_64.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 (279) hide show
  1. fast/README.md +41 -0
  2. fast/__init__.py +22 -0
  3. fast/bin/UFFviewer +0 -0
  4. fast/bin/fast_configuration.txt +14 -0
  5. fast/bin/runPipeline +0 -0
  6. fast/bin/systemCheck +0 -0
  7. fast/doc/bright-plotting-style.ini +66 -0
  8. fast/doc/dark-plotting-style.ini +66 -0
  9. fast/doc/fonts/UFL.txt +96 -0
  10. fast/doc/fonts/Ubuntu-Bold.ttf +0 -0
  11. fast/doc/fonts/Ubuntu-BoldItalic.ttf +0 -0
  12. fast/doc/fonts/Ubuntu-Italic.ttf +0 -0
  13. fast/doc/fonts/Ubuntu-Light.ttf +0 -0
  14. fast/doc/fonts/Ubuntu-LightItalic.ttf +0 -0
  15. fast/doc/fonts/Ubuntu-Medium.ttf +0 -0
  16. fast/doc/fonts/Ubuntu-MediumItalic.ttf +0 -0
  17. fast/doc/fonts/Ubuntu-Regular.ttf +0 -0
  18. fast/doc/fonts/UbuntuMono-Bold.ttf +0 -0
  19. fast/doc/fonts/UbuntuMono-BoldItalic.ttf +0 -0
  20. fast/doc/fonts/UbuntuMono-Italic.ttf +0 -0
  21. fast/doc/fonts/UbuntuMono-Regular.ttf +0 -0
  22. fast/doc/images/FAST_logo_square.png +0 -0
  23. fast/doc/images/fast_icon.ico +0 -0
  24. fast/doc/images/fast_icon.png +0 -0
  25. fast/entry_points.py +14 -0
  26. fast/fast.py +19961 -0
  27. fast/kernels/Algorithms/AirwaySegmentation/AirwaySegmentation.cl +85 -0
  28. fast/kernels/Algorithms/ApplyColormap/ApplyColormap.cl +146 -0
  29. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding2D.cl +61 -0
  30. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding3D.cl +61 -0
  31. fast/kernels/Algorithms/BlockMatching/BlockMatching.cl +257 -0
  32. fast/kernels/Algorithms/CenterlineExtraction/CenterlineExtraction.cl +153 -0
  33. fast/kernels/Algorithms/CoherentPointDrift/CoherentPointDrift.cl +0 -0
  34. fast/kernels/Algorithms/Color/ColorToGrayscale.cl +22 -0
  35. fast/kernels/Algorithms/Color/GrayscaleToColor.cl +19 -0
  36. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing2D.cl +35 -0
  37. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing3D.cl +75 -0
  38. fast/kernels/Algorithms/GradientVectorFlow/EulerGradientVectorFlow.cl +174 -0
  39. fast/kernels/Algorithms/GradientVectorFlow/MultigridGradientVectorFlow.cl +407 -0
  40. fast/kernels/Algorithms/HounsefieldConverter/HounsefieldConverter.cl +22 -0
  41. fast/kernels/Algorithms/ImageAdd/ImageAdd.cl +79 -0
  42. fast/kernels/Algorithms/ImageCaster/ImageCaster.cl +38 -0
  43. fast/kernels/Algorithms/ImageChannelConverter/ImageChannelConverter.cl +121 -0
  44. fast/kernels/Algorithms/ImageFlipper/ImageFlipper2D.cl +23 -0
  45. fast/kernels/Algorithms/ImageFlipper/ImageFlipper3D.cl +51 -0
  46. fast/kernels/Algorithms/ImageGradient/ImageGradient.cl +71 -0
  47. fast/kernels/Algorithms/ImageInverter/ImageInverter.cl +30 -0
  48. fast/kernels/Algorithms/ImageMultiply/ImageMultiply.cl +79 -0
  49. fast/kernels/Algorithms/ImagePatch/PatchStitcher2D.cl +22 -0
  50. fast/kernels/Algorithms/ImagePatch/PatchStitcher3D.cl +95 -0
  51. fast/kernels/Algorithms/ImageResampler/ImageResampler2D.cl +40 -0
  52. fast/kernels/Algorithms/ImageResampler/ImageResampler3D.cl +32 -0
  53. fast/kernels/Algorithms/ImageResizer/ImageResizer.cl +134 -0
  54. fast/kernels/Algorithms/ImageSharpening/ImageSharpening.cl +47 -0
  55. fast/kernels/Algorithms/ImageSlicer/ImageSlicer.cl +77 -0
  56. fast/kernels/Algorithms/ImageTransposer/ImageTransposer2D.cl +16 -0
  57. fast/kernels/Algorithms/ImageTransposer/ImageTransposer3D.cl +45 -0
  58. fast/kernels/Algorithms/IntensityClipping/IntensityClipping2D.cl +19 -0
  59. fast/kernels/Algorithms/IntensityClipping/IntensityClipping3D.cl +20 -0
  60. fast/kernels/Algorithms/IntensityNormalization/IntensityNormalization.cl +85 -0
  61. fast/kernels/Algorithms/IntensityNormalization/ZeroMeanUnitVariance.cl +76 -0
  62. fast/kernels/Algorithms/KalmanFilterModelSegmentation/AppearanceModels/RidgeEdge/RidgeEdgeModel.cl +81 -0
  63. fast/kernels/Algorithms/LabelModifier/LabelModifier.cl +20 -0
  64. fast/kernels/Algorithms/LaplacianOfGaussian/LaplacianOfGaussian2D.cl +27 -0
  65. fast/kernels/Algorithms/LevelSet/LevelSetSegmentation.cl +132 -0
  66. fast/kernels/Algorithms/LungSegmentation/LungSegmentation.cl +22 -0
  67. fast/kernels/Algorithms/MeshToSegmentation/MeshToSegmentation.cl +184 -0
  68. fast/kernels/Algorithms/Morphology/Dilation.cl +56 -0
  69. fast/kernels/Algorithms/Morphology/Erosion.cl +64 -0
  70. fast/kernels/Algorithms/NeuralNetwork/NeuralNetwork.cl +122 -0
  71. fast/kernels/Algorithms/NeuralNetwork/VertexTensorToSegmentation.cl +13 -0
  72. fast/kernels/Algorithms/NonLocalMeans/NonLocalMeans2D.cl +94 -0
  73. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing2D.cl +57 -0
  74. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing3D.cl +58 -0
  75. fast/kernels/Algorithms/Skeletonization/Skeletonization2D.cl +77 -0
  76. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction.cl +519 -0
  77. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction_no_3d_write.cl +739 -0
  78. fast/kernels/Algorithms/TemporalSmoothing/ImageMovingAverage.cl +66 -0
  79. fast/kernels/Algorithms/TemporalSmoothing/ImageWeightedMovingAverage.cl +74 -0
  80. fast/kernels/Algorithms/TissueSegmentation/TissueSegmentation.cl +18 -0
  81. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/InverseGradientSegmentation.cl +203 -0
  82. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/TubeSegmentationAndCenterlineExtraction.cl +566 -0
  83. fast/kernels/Algorithms/Ultrasound/EnvelopeAndLogCompressor.cl +45 -0
  84. fast/kernels/Algorithms/Ultrasound/ScanConverter.cl +76 -0
  85. fast/kernels/Algorithms/UltrasoundImageCropper/UltrasoundImageCropper.cl +31 -0
  86. fast/kernels/Algorithms/UltrasoundImageEnhancement/UltrasoundImageEnhancement.cl +27 -0
  87. fast/kernels/Algorithms/VectorMedianFilter/VectorMedianFilter.cl +31 -0
  88. fast/kernels/ImageFill.cl +30 -0
  89. fast/kernels/ImageMinMax.cl +196 -0
  90. fast/kernels/ImageSum.cl +170 -0
  91. fast/kernels/Tests/Algorithms/DoubleFilter.cl +7 -0
  92. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.frag +8 -0
  93. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.geom +69 -0
  94. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.vert +17 -0
  95. fast/kernels/Visualization/HeatmapRenderer/HeatmapRenderer.cl +51 -0
  96. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.frag +11 -0
  97. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.vert +15 -0
  98. fast/kernels/Visualization/ImageRenderer/ImageRenderer.vert +15 -0
  99. fast/kernels/Visualization/ImageRenderer/ImageRendererFLOAT.frag +18 -0
  100. fast/kernels/Visualization/ImageRenderer/ImageRendererINT.frag +18 -0
  101. fast/kernels/Visualization/ImageRenderer/ImageRendererUINT.frag +18 -0
  102. fast/kernels/Visualization/LineRenderer/LineRenderer.frag +8 -0
  103. fast/kernels/Visualization/LineRenderer/LineRenderer.geom +35 -0
  104. fast/kernels/Visualization/LineRenderer/LineRenderer.vert +20 -0
  105. fast/kernels/Visualization/LineRenderer/LineRenderer3D.frag +8 -0
  106. fast/kernels/Visualization/LineRenderer/LineRenderer3D.vert +20 -0
  107. fast/kernels/Visualization/LineRenderer/LineRendererJoints.frag +15 -0
  108. fast/kernels/Visualization/LineRenderer/LineRendererJoints.vert +24 -0
  109. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.frag +11 -0
  110. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.vert +16 -0
  111. fast/kernels/Visualization/SegmentationRenderer/SegmentationPyramidRenderer.frag +53 -0
  112. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.frag +52 -0
  113. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.vert +15 -0
  114. fast/kernels/Visualization/TextRenderer/TextRenderer.frag +11 -0
  115. fast/kernels/Visualization/TextRenderer/TextRenderer.vert +20 -0
  116. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.frag +49 -0
  117. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.vert +35 -0
  118. fast/kernels/Visualization/VectorFieldRenderer/VectorFieldColorRenderer.cl +30 -0
  119. fast/kernels/Visualization/VertexRenderer/VertexRenderer.frag +14 -0
  120. fast/kernels/Visualization/VertexRenderer/VertexRenderer.vert +23 -0
  121. fast/kernels/Visualization/View.cl +10 -0
  122. fast/kernels/Visualization/VolumeRenderer/AlphaBlendingVolumeRenderer.cl +211 -0
  123. fast/kernels/Visualization/VolumeRenderer/MaximumIntensityProjection.cl +139 -0
  124. fast/kernels/Visualization/VolumeRenderer/ThresholdVolumeRenderer.cl +178 -0
  125. fast/lib/_fast.abi3.so +0 -0
  126. fast/lib/libFAST.4.dylib +0 -0
  127. fast/lib/libInferenceEngineONNXRuntime.dylib +0 -0
  128. fast/lib/libInferenceEngineOpenVINO.dylib +0 -0
  129. fast/lib/libInferenceEngineTensorFlow.dylib +0 -0
  130. fast/lib/libJKQTCommonSharedLib_Release.4.0.0.dylib +0 -0
  131. fast/lib/libJKQTFastPlotterSharedLib_Release.4.0.0.dylib +0 -0
  132. fast/lib/libJKQTMathTextSharedLib_Release.4.0.0.dylib +0 -0
  133. fast/lib/libJKQTPlotterSharedLib_Release.4.0.0.dylib +0 -0
  134. fast/lib/libOpenIGTLink.3.dylib +0 -0
  135. fast/lib/libQt5Core.5.dylib +0 -0
  136. fast/lib/libQt5DBus.5.dylib +0 -0
  137. fast/lib/libQt5Gui.5.dylib +0 -0
  138. fast/lib/libQt5Multimedia.5.dylib +0 -0
  139. fast/lib/libQt5MultimediaWidgets.5.dylib +0 -0
  140. fast/lib/libQt5Network.5.dylib +0 -0
  141. fast/lib/libQt5OpenGL.5.dylib +0 -0
  142. fast/lib/libQt5PrintSupport.5.dylib +0 -0
  143. fast/lib/libQt5SerialPort.5.dylib +0 -0
  144. fast/lib/libQt5Svg.5.dylib +0 -0
  145. fast/lib/libQt5Widgets.5.dylib +0 -0
  146. fast/lib/libQt5Xml.5.dylib +0 -0
  147. fast/lib/libbrotlicommon.1.dylib +0 -0
  148. fast/lib/libbrotlidec.1.dylib +0 -0
  149. fast/lib/libbrotlienc.1.dylib +0 -0
  150. fast/lib/libdcmdata.17.dylib +0 -0
  151. fast/lib/libdcmimage.17.dylib +0 -0
  152. fast/lib/libdcmimgle.17.dylib +0 -0
  153. fast/lib/libdcmjpeg.17.dylib +0 -0
  154. fast/lib/libijg12.17.dylib +0 -0
  155. fast/lib/libijg12.dylib +0 -0
  156. fast/lib/libijg16.17.dylib +0 -0
  157. fast/lib/libijg16.dylib +0 -0
  158. fast/lib/libijg8.17.dylib +0 -0
  159. fast/lib/libijg8.dylib +0 -0
  160. fast/lib/libjxl.0.11.dylib +0 -0
  161. fast/lib/libjxl_cms.0.11.dylib +0 -0
  162. fast/lib/libjxl_threads.0.11.dylib +0 -0
  163. fast/lib/liboflog.17.dylib +0 -0
  164. fast/lib/libofstd.17.dylib +0 -0
  165. fast/lib/libonnxruntime.1.14.0.dylib +0 -0
  166. fast/lib/libonnxruntime.dylib +0 -0
  167. fast/lib/libopenslide.1.dylib +0 -0
  168. fast/lib/libopenvino.2230.dylib +0 -0
  169. fast/lib/libopenvino_auto_batch_plugin.so +0 -0
  170. fast/lib/libopenvino_auto_plugin.so +0 -0
  171. fast/lib/libopenvino_gapi_preproc.so +0 -0
  172. fast/lib/libopenvino_hetero_plugin.so +0 -0
  173. fast/lib/libopenvino_intel_cpu_plugin.so +0 -0
  174. fast/lib/libopenvino_ir_frontend.2230.dylib +0 -0
  175. fast/lib/libopenvino_onnx_frontend.2230.dylib +0 -0
  176. fast/lib/libopenvino_paddle_frontend.2230.dylib +0 -0
  177. fast/lib/libopenvino_tensorflow_frontend.2230.dylib +0 -0
  178. fast/lib/libtbb.dylib +0 -0
  179. fast/lib/libz.1.dylib +0 -0
  180. fast/lib/plugins.xml +16 -0
  181. fast/licenses/OpenIGTLink/LICENSE.txt +30 -0
  182. fast/licenses/OpenJPEG/LICENSE +39 -0
  183. fast/licenses/OpenSlide/COPYING.LESSER +504 -0
  184. fast/licenses/PCRE2/LICENCE.md +103 -0
  185. fast/licenses/cairo/COPYING +33 -0
  186. fast/licenses/cairo/COPYING-LGPL-2.1 +510 -0
  187. fast/licenses/cairo/COPYING-MPL-1.1 +470 -0
  188. fast/licenses/clarius/LICENSE +29 -0
  189. fast/licenses/dcmtk/COPYRIGHT +1034 -0
  190. fast/licenses/eigen/COPYING.APACHE +203 -0
  191. fast/licenses/eigen/COPYING.BSD +26 -0
  192. fast/licenses/eigen/COPYING.GPL +674 -0
  193. fast/licenses/eigen/COPYING.LGPL +502 -0
  194. fast/licenses/eigen/COPYING.MINPACK +51 -0
  195. fast/licenses/eigen/COPYING.MPL2 +373 -0
  196. fast/licenses/eigen/COPYING.README +18 -0
  197. fast/licenses/fast/LICENSE +25 -0
  198. fast/licenses/gdk-pixbuf/COPYING +502 -0
  199. fast/licenses/glib/COPYING +175 -0
  200. fast/licenses/hdf5/COPYING +106 -0
  201. fast/licenses/jkqtplotter/LICENSE +505 -0
  202. fast/licenses/jpegxl/LICENSE.brotli +19 -0
  203. fast/licenses/jpegxl/LICENSE.highway +201 -0
  204. fast/licenses/jpegxl/LICENSE.jpeg-xl +27 -0
  205. fast/licenses/jpegxl/LICENSE.skcms +29 -0
  206. fast/licenses/jpegxl/PATENTS +22 -0
  207. fast/licenses/libdicom/LICENSE +21 -0
  208. fast/licenses/libjpeg-turbo/LICENSE.md +135 -0
  209. fast/licenses/libjpeg-turbo/README.ijg +260 -0
  210. fast/licenses/libpng/LICENSE +134 -0
  211. fast/licenses/libtiff/LICENSE.md +23 -0
  212. fast/licenses/onnxruntime/LICENSE +21 -0
  213. fast/licenses/onnxruntime/Privacy.md +21 -0
  214. fast/licenses/onnxruntime/ThirdPartyNotices.txt +5786 -0
  215. fast/licenses/opencl/LICENSE +201 -0
  216. fast/licenses/openvino/Apache_license.txt +201 -0
  217. fast/licenses/openvino/EULA.htm +43 -0
  218. fast/licenses/openvino/EULA.rtf +61 -0
  219. fast/licenses/openvino/EULA.txt +163 -0
  220. fast/licenses/openvino/GNA SOFTWARE LICENSE AGREEMENT.txt +1 -0
  221. fast/licenses/openvino/Intel_Software_Development_Products.rtf +1217 -0
  222. fast/licenses/openvino/Intel_Software_Development_Products.txt +707 -0
  223. fast/licenses/openvino/LICENSE +201 -0
  224. fast/licenses/openvino/OpenVINOsupport.txt +12 -0
  225. fast/licenses/openvino/onednn_third-party-programs.txt +557 -0
  226. fast/licenses/openvino/readme.txt +60 -0
  227. fast/licenses/openvino/redist.txt +42 -0
  228. fast/licenses/openvino/runtime-third-party-programs.txt +1400 -0
  229. fast/licenses/openvino/tbb_third-party-programs.txt +230 -0
  230. fast/licenses/pixman/COPYING +42 -0
  231. fast/licenses/proxy-libintl/COPYING +482 -0
  232. fast/licenses/qt5/LICENSE.FDL +450 -0
  233. fast/licenses/qt5/LICENSE.GPL3-EXCEPT +704 -0
  234. fast/licenses/qt5/LICENSE.GPLv2 +292 -0
  235. fast/licenses/qt5/LICENSE.GPLv3 +686 -0
  236. fast/licenses/qt5/LICENSE.LGPLv21 +514 -0
  237. fast/licenses/qt5/LICENSE.LGPLv3 +175 -0
  238. fast/licenses/qt5/LICENSE.QT-LICENSE-AGREEMENT +1331 -0
  239. fast/licenses/semaphore/Semaphore_LICENSE.txt +17 -0
  240. fast/licenses/tensorflow/LICENSE +203 -0
  241. fast/licenses/tensorflow/THIRD_PARTY_TF_C_LICENSES +8963 -0
  242. fast/licenses/uthash/LICENSE +21 -0
  243. fast/licenses/zip/UNLICENSE +26 -0
  244. fast/licenses/zlib/README +115 -0
  245. fast/licenses/zlib-ng/LICENSE.md +19 -0
  246. fast/pipelines/uff_viewer/colormap_and_reject.fpl +26 -0
  247. fast/pipelines/uff_viewer/default.fpl +9 -0
  248. fast/pipelines/uff_viewer/non_local_means.fpl +34 -0
  249. fast/plugins/audio/libqtaudio_coreaudio.dylib +0 -0
  250. fast/plugins/bearer/libqgenericbearer.dylib +0 -0
  251. fast/plugins/generic/libqtuiotouchplugin.dylib +0 -0
  252. fast/plugins/iconengines/libqsvgicon.dylib +0 -0
  253. fast/plugins/imageformats/libqgif.dylib +0 -0
  254. fast/plugins/imageformats/libqicns.dylib +0 -0
  255. fast/plugins/imageformats/libqico.dylib +0 -0
  256. fast/plugins/imageformats/libqjpeg.dylib +0 -0
  257. fast/plugins/imageformats/libqmacheif.dylib +0 -0
  258. fast/plugins/imageformats/libqmacjp2.dylib +0 -0
  259. fast/plugins/imageformats/libqsvg.dylib +0 -0
  260. fast/plugins/imageformats/libqtga.dylib +0 -0
  261. fast/plugins/imageformats/libqtiff.dylib +0 -0
  262. fast/plugins/imageformats/libqwbmp.dylib +0 -0
  263. fast/plugins/imageformats/libqwebp.dylib +0 -0
  264. fast/plugins/mediaservice/libqavfcamera.dylib +0 -0
  265. fast/plugins/mediaservice/libqavfmediaplayer.dylib +0 -0
  266. fast/plugins/mediaservice/libqtmedia_audioengine.dylib +0 -0
  267. fast/plugins/platforms/libqcocoa.dylib +0 -0
  268. fast/plugins/platforms/libqminimal.dylib +0 -0
  269. fast/plugins/platforms/libqoffscreen.dylib +0 -0
  270. fast/plugins/platformthemes/libqxdgdesktopportal.dylib +0 -0
  271. fast/plugins/playlistformats/libqtmultimedia_m3u.dylib +0 -0
  272. fast/plugins/printsupport/libcocoaprintersupport.dylib +0 -0
  273. fast/plugins/sqldrivers/libqsqlite.dylib +0 -0
  274. fast/plugins/styles/libqmacstyle.dylib +0 -0
  275. pyfast-4.12.0.dist-info/METADATA +81 -0
  276. pyfast-4.12.0.dist-info/RECORD +279 -0
  277. pyfast-4.12.0.dist-info/WHEEL +5 -0
  278. pyfast-4.12.0.dist-info/entry_points.txt +5 -0
  279. pyfast-4.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,153 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
2
+
3
+ #define LPOS(pos) pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)
4
+
5
+ __kernel void initialize(
6
+ __read_only image3d_t input,
7
+ #ifdef fast_3d_image_writes
8
+ __write_only image3d_t distance
9
+ #else
10
+ __global short* distance
11
+ #endif
12
+ ) {
13
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
14
+
15
+ uint value = read_imageui(input, sampler, pos).x;
16
+ if(value == 0) {
17
+ // Outside
18
+ #ifdef fast_3d_image_writes
19
+ write_imagei(distance, pos, 0);
20
+ #else
21
+ distance[LPOS(pos)] = 0;
22
+ #endif
23
+ } else {
24
+ // Inside
25
+ bool atBorder = false;
26
+ for(int a = -1; a <= 1; ++a) {
27
+ for(int b = -1; b <= 1; ++b) {
28
+ for(int c = -1; c <= 1; ++c) {
29
+ int4 nPos = (int4)(a,b,c,0) + pos;
30
+ uint value2 = read_imageui(input, sampler, nPos).x;
31
+ if(value2 == 0) {
32
+ atBorder = true;
33
+ }
34
+ }}}
35
+ if(atBorder) {
36
+ #ifdef fast_3d_image_writes
37
+ write_imagei(distance, pos, -1);
38
+ #else
39
+ distance[LPOS(pos)] = -1;
40
+ #endif
41
+ } else {
42
+ #ifdef fast_3d_image_writes
43
+ write_imagei(distance, pos, -1);
44
+ #else
45
+ distance[LPOS(pos)] = -1;
46
+ #endif
47
+ }
48
+ }
49
+ }
50
+
51
+ __constant int4 neighbors[] = {
52
+ {1, 0, 0, 0},
53
+ {-1, 0, 0, 0},
54
+ {0, 1, 0, 0},
55
+ {0, -1, 0, 0},
56
+ {0, 0, 1, 0},
57
+ {0, 0, -1, 0}
58
+ };
59
+
60
+ __kernel void calculateDistance(
61
+ #ifdef fast_3d_image_writes
62
+ __read_only image3d_t input,
63
+ __write_only image3d_t output,
64
+ #else
65
+ __global short* input,
66
+ __global short* output,
67
+ #endif
68
+ __global char* changed
69
+ ) {
70
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
71
+ #ifdef fast_3d_image_writes
72
+ int value = read_imagei(input, sampler, pos).x;
73
+ #else
74
+ int value = input[LPOS(pos)];
75
+ #endif
76
+ if(value == -1) { // -1 means no distance calculated yet
77
+ int minNeighborDistance = 999999;
78
+ for(int i = 0; i < 6; ++i) {
79
+ int4 nPos = neighbors[i] + pos;
80
+ #ifdef fast_3d_image_writes
81
+ int value2 = read_imagei(input, sampler, nPos).x;
82
+ #else
83
+ int value2 = input[LPOS(nPos)];
84
+ #endif
85
+ if(value2 < minNeighborDistance && value2 >= 0) {
86
+ minNeighborDistance = value2;
87
+ }
88
+ }
89
+
90
+ if(minNeighborDistance < 999999) {
91
+ // Valid neighbor found
92
+ #ifdef fast_3d_image_writes
93
+ write_imagei(output, pos, minNeighborDistance+1);
94
+ #else
95
+ output[LPOS(pos)] = minNeighborDistance+1;
96
+ #endif
97
+ changed[0] = 1;
98
+ }
99
+ } else {
100
+ #ifdef fast_3d_image_writes
101
+ write_imagei(output, pos, value);
102
+ #else
103
+ output[LPOS(pos)] = value;
104
+ #endif
105
+ }
106
+ }
107
+
108
+ __kernel void findCandidateCenterpoints(
109
+ __read_only image3d_t segmentation,
110
+ __read_only image3d_t distanceImage,
111
+ #ifdef fast_3d_image_writes
112
+ __write_only image3d_t output
113
+ #else
114
+ __global uchar* output
115
+ #endif
116
+ ) {
117
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
118
+ if(read_imageui(segmentation, sampler, pos).x == 1) {
119
+ // Inside object
120
+ short distance = read_imagei(distanceImage, sampler, pos).x;
121
+
122
+ // Check if voxel is candidate centerline
123
+ int N = 4;
124
+ bool invalid = false;
125
+ for(int a = -N; a <= N; ++a) {
126
+ for(int b = -N; b <= N; ++b) {
127
+ for(int c = -N; c <= N; ++c) {
128
+ short distance2 = read_imagei(distanceImage, sampler, pos + (int4)(a,b,c,0)).x;
129
+ if(distance2 > distance) {
130
+ invalid = true;
131
+ }
132
+ }}}
133
+
134
+ #ifdef fast_3d_image_writes
135
+ if(!invalid) {
136
+ write_imageui(output, pos, 1);
137
+ } else {
138
+ write_imageui(output, pos, 0);
139
+ }
140
+ } else {
141
+ write_imageui(output, pos, 0);
142
+ }
143
+ #else
144
+ if(!invalid) {
145
+ output[LPOS(pos)] = 1;
146
+ } else {
147
+ output[LPOS(pos)] = 0;
148
+ }
149
+ } else {
150
+ output[LPOS(pos)] = 0;
151
+ }
152
+ #endif
153
+ }
@@ -0,0 +1,22 @@
1
+ __const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_FILTER_NEAREST | CLK_ADDRESS_NONE;
2
+
3
+ __kernel void convert(
4
+ __read_only image2d_t input,
5
+ __write_only image2d_t output
6
+ ) {
7
+ const int2 pos = {get_global_id(0), get_global_id(1)};
8
+ int dataType = get_image_channel_data_type(input);
9
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
10
+ uint4 value = read_imageui(input, sampler, pos);
11
+ uint average = round(((float)(value.x + value.y + value.z))/3.0f);
12
+ write_imageui(output, pos, average);
13
+ } else if(dataType == CLK_FLOAT) {
14
+ float4 value = read_imagef(input, sampler, pos);
15
+ float average = value.x + value.y + value.z;
16
+ write_imagef(output, pos, average);
17
+ } else {
18
+ int4 value = read_imagei(input, sampler, pos);
19
+ int average = round(((float)(value.x + value.y + value.z))/3.0f);
20
+ write_imagei(output, pos, average);
21
+ }
22
+ }
@@ -0,0 +1,19 @@
1
+ __const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_FILTER_NEAREST | CLK_ADDRESS_NONE;
2
+
3
+ __kernel void convert(
4
+ __read_only image2d_t input,
5
+ __write_only image2d_t output
6
+ ) {
7
+ const int2 pos = {get_global_id(0), get_global_id(1)};
8
+ int dataType = get_image_channel_data_type(input);
9
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
10
+ uint value = read_imageui(input, sampler, pos).x;
11
+ write_imageui(output, pos, (uint4)(value, value, value, 255));
12
+ } else if(dataType == CLK_FLOAT) {
13
+ float value = read_imagef(input, sampler, pos).x;
14
+ write_imagef(output, pos, (float4)(value, value, value, 1.0f));
15
+ } else {
16
+ int value = read_imagei(input, sampler, pos).x;
17
+ write_imagei(output, pos, (int4)(value, value, value, 1));
18
+ }
19
+ }
@@ -0,0 +1,35 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
2
+
3
+ __kernel void gaussianSmoothing(
4
+ __read_only image2d_t input,
5
+ __constant float * mask,
6
+ __write_only image2d_t output,
7
+ __private unsigned char maskSize
8
+ ) {
9
+
10
+ const int2 pos = {get_global_id(0), get_global_id(1)};
11
+ const unsigned char halfSize = (maskSize-1)/2;
12
+
13
+ float sum = 0.0f;
14
+ int dataType = get_image_channel_data_type(input);
15
+ for(int x = -halfSize; x <= halfSize; x++) {
16
+ for(int y = -halfSize; y <= halfSize; y++) {
17
+ const int2 offset = {x,y};
18
+ if(dataType == CLK_FLOAT) {
19
+ sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imagef(input, sampler, pos+offset).x;
20
+ } else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
21
+ sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imageui(input, sampler, pos+offset).x;
22
+ } else {
23
+ sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imagei(input, sampler, pos+offset).x;
24
+ }
25
+ }}
26
+
27
+ int outputDataType = get_image_channel_data_type(output);
28
+ if(outputDataType == CLK_FLOAT) {
29
+ write_imagef(output, pos, sum);
30
+ } else if(outputDataType == CLK_UNSIGNED_INT8 || outputDataType == CLK_UNSIGNED_INT16 || outputDataType == CLK_UNSIGNED_INT32) {
31
+ write_imageui(output, pos, round(sum));
32
+ } else {
33
+ write_imagei(output, pos, round(sum));
34
+ }
35
+ }
@@ -0,0 +1,75 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
2
+
3
+ #ifdef fast_3d_image_writes
4
+ __kernel void gaussianSmoothing(
5
+ __read_only image3d_t input,
6
+ __constant float * mask,
7
+ __write_only image3d_t output,
8
+ __private unsigned char maskSize,
9
+ __private unsigned char direction
10
+ ) {
11
+
12
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
13
+ const unsigned char halfSize = (maskSize-1)/2;
14
+
15
+ float sum = 0.0f;
16
+ int dataType = get_image_channel_data_type(input);
17
+ for(int i = -halfSize; i <= halfSize; ++i) {
18
+ int4 offset = {0,0,0,0};
19
+ if(direction == 0) {
20
+ offset.x = i;
21
+ } else if(direction == 1) {
22
+ offset.y = i;
23
+ } else {
24
+ offset.z = i;
25
+ }
26
+ const uchar maskOffset = halfSize + i;
27
+ if(dataType == CLK_FLOAT) {
28
+ sum += mask[maskOffset]*read_imagef(input, sampler, pos+offset).x;
29
+ } else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
30
+ sum += mask[maskOffset]*read_imageui(input, sampler, pos+offset).x;
31
+ } else {
32
+ sum += mask[maskOffset]*read_imagei(input, sampler, pos+offset).x;
33
+ }
34
+ }
35
+
36
+ int outputDataType = get_image_channel_data_type(output);
37
+ if(outputDataType == CLK_FLOAT) {
38
+ write_imagef(output, pos, sum);
39
+ } else if(outputDataType == CLK_UNSIGNED_INT8 || outputDataType == CLK_UNSIGNED_INT16 || outputDataType == CLK_UNSIGNED_INT32) {
40
+ write_imageui(output, pos, round(sum));
41
+ } else {
42
+ write_imagei(output, pos, round(sum));
43
+ }
44
+ }
45
+
46
+ #else
47
+ __kernel void gaussianSmoothing(
48
+ __read_only image3d_t input,
49
+ __constant float * mask,
50
+ __global TYPE* output,
51
+ __private unsigned char maskSize
52
+ ) {
53
+
54
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
55
+ const unsigned char halfSize = (maskSize-1)/2;
56
+
57
+ float sum = 0.0f;
58
+ int dataType = get_image_channel_data_type(input);
59
+ for(int x = -halfSize; x <= halfSize; x++) {
60
+ for(int y = -halfSize; y <= halfSize; y++) {
61
+ for(int z = -halfSize; z <= halfSize; z++) {
62
+ const int4 offset = {x,y,z,0};
63
+ const uint maskOffset = x+halfSize+(y+halfSize)*maskSize+(z+halfSize)*maskSize*maskSize;
64
+ if(dataType == CLK_FLOAT) {
65
+ sum += mask[maskOffset]*read_imagef(input, sampler, pos+offset).x;
66
+ } else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
67
+ sum += mask[maskOffset]*read_imageui(input, sampler, pos+offset).x;
68
+ } else {
69
+ sum += mask[maskOffset]*read_imagei(input, sampler, pos+offset).x;
70
+ }
71
+ }}}
72
+
73
+ output[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = sum;
74
+ }
75
+ #endif
@@ -0,0 +1,174 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
2
+
3
+ __kernel void GVF2DCopy(__read_only image2d_t input, __write_only image2d_t output) {
4
+ int2 pos = {get_global_id(0), get_global_id(1)};
5
+ write_imagef(output, pos, read_imagef(input, sampler, pos));
6
+ }
7
+
8
+ __kernel void GVF2DIteration(__read_only image2d_t init_vector_field, __read_only image2d_t read_vector_field, __write_only image2d_t write_vector_field, __private float mu) {
9
+
10
+ int2 writePos = {get_global_id(0), get_global_id(1)};
11
+
12
+ // Enforce mirror boundary conditions
13
+ int2 size = {get_global_size(0), get_global_size(1)};
14
+ int2 pos = writePos;
15
+ pos = select(pos, (int2)(2,2), pos == (int2)(0,0));
16
+ pos = select(pos, size-3, pos >= size-1);
17
+
18
+ float2 f = read_imagef(read_vector_field, sampler, pos).xy;
19
+
20
+ const float2 init_vector = read_imagef(init_vector_field, sampler, pos).xy;
21
+
22
+ const float2 fx1 = read_imagef(read_vector_field, sampler, pos + (int2)(1,0)).xy;
23
+ const float2 fy1 = read_imagef(read_vector_field, sampler, pos + (int2)(0,1)).xy;
24
+ const float2 fx_1 = read_imagef(read_vector_field, sampler, pos - (int2)(1,0)).xy;
25
+ const float2 fy_1 = read_imagef(read_vector_field, sampler, pos - (int2)(0,1)).xy;
26
+
27
+ // Update the vector field: Calculate Laplacian using a 3D central difference scheme
28
+ float2 laplacian = -4*f + fx1 + fx_1 + fy1 + fy_1;
29
+
30
+ f += mu * laplacian - (f - init_vector)*(init_vector.x*init_vector.x + init_vector.y*init_vector.y);
31
+
32
+ write_imagef(write_vector_field, writePos, (float4)(f.x,f.y,0,0));
33
+ }
34
+
35
+
36
+ // If device supports writing to 3D textures
37
+ #ifdef fast_3d_image_writes
38
+
39
+ __kernel void GVF3DCopy(__read_only image3d_t input, __write_only image3d_t output) {
40
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
41
+ write_imagef(output, pos, read_imagef(input, sampler, pos));
42
+ }
43
+
44
+ __kernel void GVF3DIteration(
45
+ __read_only image3d_t init_vector_field,
46
+ __read_only image3d_t read_vector_field,
47
+ __write_only image3d_t write_vector_field,
48
+ __private float mu
49
+ ) {
50
+
51
+ int4 writePos = {
52
+ get_global_id(0),
53
+ get_global_id(1),
54
+ get_global_id(2),
55
+ 0
56
+ };
57
+ // Enforce mirror boundary conditions
58
+ int4 size = {get_image_width(init_vector_field), get_image_height(init_vector_field), get_image_depth(init_vector_field), 0};
59
+ int4 pos = writePos;
60
+ pos = select(pos, (int4)(2,2,2,0), pos == (int4)(0,0,0,0));
61
+ pos = select(pos, size-3, pos >= size-1);
62
+
63
+ // Load data from memory and do calculations
64
+ float3 init_vector = read_imagef(init_vector_field, sampler, pos).xyz;
65
+
66
+ float3 f = read_imagef(read_vector_field, sampler, pos).xyz;
67
+ float3 fx1 = read_imagef(read_vector_field, sampler, pos + (int4)(1,0,0,0)).xyz;
68
+ float3 fx_1 = read_imagef(read_vector_field, sampler, pos - (int4)(1,0,0,0)).xyz;
69
+ float3 fy1 = read_imagef(read_vector_field, sampler, pos + (int4)(0,1,0,0)).xyz;
70
+ float3 fy_1 = read_imagef(read_vector_field, sampler, pos - (int4)(0,1,0,0)).xyz;
71
+ float3 fz1 = read_imagef(read_vector_field, sampler, pos + (int4)(0,0,1,0)).xyz;
72
+ float3 fz_1 = read_imagef(read_vector_field, sampler, pos - (int4)(0,0,1,0)).xyz;
73
+
74
+ // Update the vector field: Calculate Laplacian using a 3D central difference scheme
75
+ float3 laplacian = -6*f.xyz + fx1 + fx_1 + fy1 + fy_1 + fz1 + fz_1;
76
+
77
+ // NOT ANYMORE: The last component of the input vector is stored in f to save memory (f.w)
78
+ f += mu * laplacian - (f - init_vector)*
79
+ (init_vector.x*init_vector.x + init_vector.y*init_vector.y + init_vector.z*init_vector.z);
80
+
81
+ write_imagef(write_vector_field, writePos, f.xyzz);
82
+ }
83
+
84
+ #else
85
+
86
+ #define LPOS(pos) pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)
87
+ #ifdef VECTORS_16BIT
88
+ #define FLOAT_TO_SNORM16_4(vector) convert_short4_sat_rte(vector * 32767.0f)
89
+ #define SNORM16_TO_FLOAT_4(vector) max(-1.0f, convert_float4(vector) / 32767.0f)
90
+ #define FLOAT_TO_SNORM16_3(vector) convert_short3_sat_rte(vector * 32767.0f)
91
+ #define SNORM16_TO_FLOAT_3(vector) max(-1.0f, convert_float3(vector) / 32767.0f)
92
+ #define FLOAT_TO_SNORM16_2(vector) convert_short2_sat_rte(vector * 32767.0f)
93
+ #define SNORM16_TO_FLOAT_2(vector) max(-1.0f, convert_float2(vector) / 32767.0f)
94
+ #define FLOAT_TO_SNORM16(vector) convert_short_sat_rte(vector * 32767.0f)
95
+ #define SNORM16_TO_FLOAT(vector) max(-1.0f, convert_float(vector) / 32767.0f)
96
+ #define VECTOR_FIELD_TYPE short
97
+ #else
98
+ #define FLOAT_TO_SNORM16_4(vector) vector
99
+ #define SNORM16_TO_FLOAT_4(vector) vector
100
+ #define FLOAT_TO_SNORM16_3(vector) vector
101
+ #define SNORM16_TO_FLOAT_3(vector) vector
102
+ #define FLOAT_TO_SNORM16_2(vector) vector
103
+ #define SNORM16_TO_FLOAT_2(vector) vector
104
+ #define FLOAT_TO_SNORM16(vector) vector
105
+ #define SNORM16_TO_FLOAT(vector) vector
106
+ #define VECTOR_FIELD_TYPE float
107
+ #endif
108
+
109
+ __kernel void GVF3DIteration(
110
+ __read_only image3d_t init_vector_field,
111
+ __global VECTOR_FIELD_TYPE const * restrict read_vector_field,
112
+ __global VECTOR_FIELD_TYPE * write_vector_field,
113
+ __private float mu
114
+ ) {
115
+ int4 writePos = {
116
+ get_global_id(0),
117
+ get_global_id(1),
118
+ get_global_id(2),
119
+ 0
120
+ };
121
+ // Enforce mirror boundary conditions
122
+ int4 size = {get_global_size(0), get_global_size(1), get_global_size(2), 0};
123
+ int4 pos = writePos;
124
+ pos = select(pos, (int4)(2,2,2,0), pos == (int4)(0,0,0,0));
125
+ pos = select(pos, size-3, pos >= size-1);
126
+ int offset = pos.x + pos.y*size.x + pos.z*size.x*size.y;
127
+
128
+ // Load data from shared memory and do calculations
129
+ float4 init_vector = read_imagef(init_vector_field, sampler, pos);
130
+
131
+ float3 v = SNORM16_TO_FLOAT_3(vload3(offset, read_vector_field));
132
+ float3 fx1 = SNORM16_TO_FLOAT_3(vload3(offset+1, read_vector_field));
133
+ float3 fx_1 = SNORM16_TO_FLOAT_3(vload3(offset-1, read_vector_field));
134
+ float3 fy1 = SNORM16_TO_FLOAT_3(vload3(offset+size.x, read_vector_field));
135
+ float3 fy_1 = SNORM16_TO_FLOAT_3(vload3(offset-size.x, read_vector_field));
136
+ float3 fz1 = SNORM16_TO_FLOAT_3(vload3(offset+size.x*size.y, read_vector_field));
137
+ float3 fz_1 = SNORM16_TO_FLOAT_3(vload3(offset-size.x*size.y, read_vector_field));
138
+
139
+ // Update the vector field: Calculate Laplacian using a 3D central difference scheme
140
+ float3 v2;
141
+ v2.x = -6*v.x;
142
+ v2.y = -6*v.y;
143
+ v2.z = -6*v.z;
144
+ float3 laplacian = v2 + fx1 + fx_1 + fy1 + fy_1 + fz1 + fz_1;
145
+
146
+ v += mu*laplacian - (v - init_vector.xyz)*(init_vector.x*init_vector.x + init_vector.y*init_vector.y + init_vector.z*init_vector.z);
147
+
148
+ vstore3(FLOAT_TO_SNORM16_3(v), writePos.x + writePos.y*size.x + writePos.z*size.x*size.y, write_vector_field);
149
+ }
150
+
151
+
152
+ __kernel void GVF3DInit(
153
+ __read_only image3d_t vectorFieldImage,
154
+ __global VECTOR_FIELD_TYPE * vectorField
155
+ ) {
156
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
157
+ vstore3(FLOAT_TO_SNORM16_3(read_imagef(vectorFieldImage, sampler, pos).xyz), LPOS(pos), vectorField);
158
+ }
159
+
160
+ __kernel void GVF3DFinish(
161
+ __global VECTOR_FIELD_TYPE * vectorField,
162
+ //__global VECTOR_FIELD_TYPE * vectorField2
163
+ __global float * vectorField2
164
+ ) {
165
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
166
+ float4 v;
167
+ v.xyz = SNORM16_TO_FLOAT_3(vload3(LPOS(pos), vectorField));
168
+ v.w = 0;
169
+ v.w = length(v) > 0.0f ? length(v) : 1.0f;
170
+ //vstore4(FLOAT_TO_SNORM16_4(v), LPOS(pos), vectorField2);
171
+ vstore4(v, LPOS(pos), vectorField2);
172
+ }
173
+
174
+ #endif