pyfast 4.12.0__cp36-abi3-macosx_11_0_arm64.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 (248) 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 +19833 -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/libJKQTCommonSharedLib_Release.4.0.0.dylib +0 -0
  129. fast/lib/libJKQTFastPlotterSharedLib_Release.4.0.0.dylib +0 -0
  130. fast/lib/libJKQTMathTextSharedLib_Release.4.0.0.dylib +0 -0
  131. fast/lib/libJKQTPlotterSharedLib_Release.4.0.0.dylib +0 -0
  132. fast/lib/libOpenIGTLink.3.dylib +0 -0
  133. fast/lib/libQt5Core.5.dylib +0 -0
  134. fast/lib/libQt5DBus.5.dylib +0 -0
  135. fast/lib/libQt5Gui.5.dylib +0 -0
  136. fast/lib/libQt5Multimedia.5.dylib +0 -0
  137. fast/lib/libQt5MultimediaWidgets.5.dylib +0 -0
  138. fast/lib/libQt5Network.5.dylib +0 -0
  139. fast/lib/libQt5OpenGL.5.dylib +0 -0
  140. fast/lib/libQt5PrintSupport.5.dylib +0 -0
  141. fast/lib/libQt5SerialPort.5.dylib +0 -0
  142. fast/lib/libQt5Svg.5.dylib +0 -0
  143. fast/lib/libQt5Widgets.5.dylib +0 -0
  144. fast/lib/libQt5Xml.5.dylib +0 -0
  145. fast/lib/libbrotlicommon.1.dylib +0 -0
  146. fast/lib/libbrotlidec.1.dylib +0 -0
  147. fast/lib/libbrotlienc.1.dylib +0 -0
  148. fast/lib/libdcmdata.17.dylib +0 -0
  149. fast/lib/libdcmimage.17.dylib +0 -0
  150. fast/lib/libdcmimgle.17.dylib +0 -0
  151. fast/lib/libdcmjpeg.17.dylib +0 -0
  152. fast/lib/libijg12.17.dylib +0 -0
  153. fast/lib/libijg12.dylib +0 -0
  154. fast/lib/libijg16.17.dylib +0 -0
  155. fast/lib/libijg16.dylib +0 -0
  156. fast/lib/libijg8.17.dylib +0 -0
  157. fast/lib/libijg8.dylib +0 -0
  158. fast/lib/libjxl.0.11.dylib +0 -0
  159. fast/lib/libjxl_cms.0.11.dylib +0 -0
  160. fast/lib/libjxl_threads.0.11.dylib +0 -0
  161. fast/lib/liboflog.17.dylib +0 -0
  162. fast/lib/libofstd.17.dylib +0 -0
  163. fast/lib/libonnxruntime.1.22.0.dylib +0 -0
  164. fast/lib/libonnxruntime.dylib +0 -0
  165. fast/lib/libopenslide.1.dylib +0 -0
  166. fast/lib/libz.1.dylib +0 -0
  167. fast/licenses/OpenIGTLink/LICENSE.txt +30 -0
  168. fast/licenses/OpenJPEG/LICENSE +39 -0
  169. fast/licenses/OpenSlide/COPYING.LESSER +504 -0
  170. fast/licenses/PCRE2/LICENCE.md +103 -0
  171. fast/licenses/cairo/COPYING +33 -0
  172. fast/licenses/cairo/COPYING-LGPL-2.1 +510 -0
  173. fast/licenses/cairo/COPYING-MPL-1.1 +470 -0
  174. fast/licenses/dcmtk/COPYRIGHT +1034 -0
  175. fast/licenses/eigen/COPYING.APACHE +203 -0
  176. fast/licenses/eigen/COPYING.BSD +26 -0
  177. fast/licenses/eigen/COPYING.GPL +674 -0
  178. fast/licenses/eigen/COPYING.LGPL +502 -0
  179. fast/licenses/eigen/COPYING.MINPACK +51 -0
  180. fast/licenses/eigen/COPYING.MPL2 +373 -0
  181. fast/licenses/eigen/COPYING.README +18 -0
  182. fast/licenses/fast/LICENSE +25 -0
  183. fast/licenses/gdk-pixbuf/COPYING +502 -0
  184. fast/licenses/glib/COPYING +175 -0
  185. fast/licenses/hdf5/COPYING +106 -0
  186. fast/licenses/jkqtplotter/LICENSE +505 -0
  187. fast/licenses/jpegxl/LICENSE.brotli +19 -0
  188. fast/licenses/jpegxl/LICENSE.highway +201 -0
  189. fast/licenses/jpegxl/LICENSE.jpeg-xl +27 -0
  190. fast/licenses/jpegxl/LICENSE.skcms +29 -0
  191. fast/licenses/jpegxl/PATENTS +22 -0
  192. fast/licenses/libdicom/LICENSE +21 -0
  193. fast/licenses/libjpeg-turbo/LICENSE.md +135 -0
  194. fast/licenses/libjpeg-turbo/README.ijg +260 -0
  195. fast/licenses/libpng/LICENSE +134 -0
  196. fast/licenses/libtiff/LICENSE.md +23 -0
  197. fast/licenses/onnxruntime/LICENSE +21 -0
  198. fast/licenses/onnxruntime/Privacy.md +21 -0
  199. fast/licenses/onnxruntime/ThirdPartyNotices.txt +6156 -0
  200. fast/licenses/opencl/LICENSE +201 -0
  201. fast/licenses/pixman/COPYING +42 -0
  202. fast/licenses/proxy-libintl/COPYING +482 -0
  203. fast/licenses/qt5/LICENSE.FDL +450 -0
  204. fast/licenses/qt5/LICENSE.GPL3-EXCEPT +704 -0
  205. fast/licenses/qt5/LICENSE.GPLv2 +292 -0
  206. fast/licenses/qt5/LICENSE.GPLv3 +686 -0
  207. fast/licenses/qt5/LICENSE.LGPLv21 +514 -0
  208. fast/licenses/qt5/LICENSE.LGPLv3 +175 -0
  209. fast/licenses/qt5/LICENSE.QT-LICENSE-AGREEMENT +1315 -0
  210. fast/licenses/semaphore/Semaphore_LICENSE.txt +17 -0
  211. fast/licenses/uthash/LICENSE +21 -0
  212. fast/licenses/zip/UNLICENSE +26 -0
  213. fast/licenses/zlib/README +115 -0
  214. fast/licenses/zlib-ng/LICENSE.md +19 -0
  215. fast/pipelines/uff_viewer/colormap_and_reject.fpl +26 -0
  216. fast/pipelines/uff_viewer/default.fpl +9 -0
  217. fast/pipelines/uff_viewer/non_local_means.fpl +34 -0
  218. fast/plugins/audio/libqtaudio_coreaudio.dylib +0 -0
  219. fast/plugins/bearer/libqgenericbearer.dylib +0 -0
  220. fast/plugins/generic/libqtuiotouchplugin.dylib +0 -0
  221. fast/plugins/iconengines/libqsvgicon.dylib +0 -0
  222. fast/plugins/imageformats/libqgif.dylib +0 -0
  223. fast/plugins/imageformats/libqicns.dylib +0 -0
  224. fast/plugins/imageformats/libqico.dylib +0 -0
  225. fast/plugins/imageformats/libqjpeg.dylib +0 -0
  226. fast/plugins/imageformats/libqmacheif.dylib +0 -0
  227. fast/plugins/imageformats/libqmacjp2.dylib +0 -0
  228. fast/plugins/imageformats/libqsvg.dylib +0 -0
  229. fast/plugins/imageformats/libqtga.dylib +0 -0
  230. fast/plugins/imageformats/libqtiff.dylib +0 -0
  231. fast/plugins/imageformats/libqwbmp.dylib +0 -0
  232. fast/plugins/imageformats/libqwebp.dylib +0 -0
  233. fast/plugins/mediaservice/libqavfcamera.dylib +0 -0
  234. fast/plugins/mediaservice/libqavfmediaplayer.dylib +0 -0
  235. fast/plugins/mediaservice/libqtmedia_audioengine.dylib +0 -0
  236. fast/plugins/platforms/libqcocoa.dylib +0 -0
  237. fast/plugins/platforms/libqminimal.dylib +0 -0
  238. fast/plugins/platforms/libqoffscreen.dylib +0 -0
  239. fast/plugins/platformthemes/libqxdgdesktopportal.dylib +0 -0
  240. fast/plugins/playlistformats/libqtmultimedia_m3u.dylib +0 -0
  241. fast/plugins/printsupport/libcocoaprintersupport.dylib +0 -0
  242. fast/plugins/sqldrivers/libqsqlite.dylib +0 -0
  243. fast/plugins/styles/libqmacstyle.dylib +0 -0
  244. pyfast-4.12.0.dist-info/METADATA +81 -0
  245. pyfast-4.12.0.dist-info/RECORD +248 -0
  246. pyfast-4.12.0.dist-info/WHEEL +5 -0
  247. pyfast-4.12.0.dist-info/entry_points.txt +5 -0
  248. pyfast-4.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,66 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
2
+
3
+ float getPixelAsFloat(__read_only image2d_t image, int2 pos) {
4
+ float value;
5
+ int dataType = get_image_channel_data_type(image);
6
+ if(dataType == CLK_FLOAT) {
7
+ value = read_imagef(image, sampler, pos).x;
8
+ } else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
9
+ value = read_imageui(image, sampler, pos).x;
10
+ } else {
11
+ value = read_imagei(image, sampler, pos).x;
12
+ }
13
+ return value;
14
+ }
15
+
16
+ __kernel void MAinitialize(
17
+ __read_only image2d_t input,
18
+ __write_only image2d_t output,
19
+ __write_only image2d_t memoryOut,
20
+ __private int frameCount
21
+ ) {
22
+ const int2 pos = {get_global_id(0), get_global_id(1)};
23
+
24
+ float value = getPixelAsFloat(input, pos);
25
+ write_imagef(memoryOut, pos, value);
26
+ int dataType = get_image_channel_data_type(output);
27
+ if(dataType == CLK_FLOAT) {
28
+ write_imagef(output, pos, value);
29
+ } else {
30
+ // output image is of integer type, have to apply rounding
31
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
32
+ write_imageui(output, pos, (uint)value);
33
+ } else {
34
+ write_imagei(output, pos, (int)value);
35
+ }
36
+ }
37
+ }
38
+
39
+ __kernel void MAiteration(
40
+ __read_only image2d_t input,
41
+ __read_only image2d_t memoryIn,
42
+ __read_only image2d_t last,
43
+ __write_only image2d_t output,
44
+ __write_only image2d_t memoryOut,
45
+ __private int frameCount
46
+ ) {
47
+ const int2 pos = {get_global_id(0), get_global_id(1)};
48
+
49
+ float newValue = getPixelAsFloat(input, pos);
50
+ float oldMemory = read_imagef(memoryIn, sampler, pos).x;
51
+ float lastValue = getPixelAsFloat(last, pos);
52
+ float result = oldMemory + 1.0f/(float)frameCount * (newValue - lastValue);
53
+ write_imagef(memoryOut, pos, result);
54
+
55
+ int dataType = get_image_channel_data_type(output);
56
+ if(dataType == CLK_FLOAT) {
57
+ write_imagef(output, pos, result);
58
+ } else {
59
+ // output image is of integer type, have to apply rounding
60
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
61
+ write_imageui(output, pos, (uint)round(result));
62
+ } else {
63
+ write_imagei(output, pos, (int)round(result));
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,74 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
2
+
3
+ float getPixelAsFloat(__read_only image2d_t image, int2 pos) {
4
+ float value;
5
+ int dataType = get_image_channel_data_type(image);
6
+ if(dataType == CLK_FLOAT) {
7
+ value = read_imagef(image, sampler, pos).x;
8
+ } else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
9
+ value = read_imageui(image, sampler, pos).x;
10
+ } else {
11
+ value = read_imagei(image, sampler, pos).x;
12
+ }
13
+ return value;
14
+ }
15
+
16
+ __kernel void WMAinitialize(
17
+ __read_only image2d_t input,
18
+ __write_only image2d_t output,
19
+ __write_only image2d_t memoryOut,
20
+ __private int frameCount
21
+ ) {
22
+ const int2 pos = {get_global_id(0), get_global_id(1)};
23
+
24
+ float value = getPixelAsFloat(input, pos);
25
+ float sum = value*frameCount;
26
+ float numerator = 0.0f;
27
+ for(int i = 0; i < frameCount; ++i) {
28
+ numerator += (i+1)*value;
29
+ }
30
+ float result = numerator / (frameCount*(frameCount + 1.0f)/2.0f);
31
+
32
+ write_imagef(memoryOut, pos, (float4)(sum, numerator, 0, 0));
33
+
34
+ int dataType = get_image_channel_data_type(output);
35
+ if(dataType == CLK_FLOAT) {
36
+ write_imagef(output, pos, result);
37
+ } else {
38
+ // output image is of integer type, have to apply rounding
39
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
40
+ write_imageui(output, pos, (uint)round(result));
41
+ } else {
42
+ write_imagei(output, pos, (int)round(result));
43
+ }
44
+ }
45
+ }
46
+
47
+ __kernel void WMAiteration(
48
+ __read_only image2d_t input,
49
+ __read_only image2d_t memoryIn,
50
+ __read_only image2d_t last,
51
+ __write_only image2d_t output,
52
+ __write_only image2d_t memoryOut,
53
+ __private int frameCount
54
+ ) {
55
+ const int2 pos = {get_global_id(0), get_global_id(1)};
56
+
57
+ float newValue = getPixelAsFloat(input, pos);
58
+ float2 oldMemory = read_imagef(memoryIn, sampler, pos).xy;
59
+ float newTotal = oldMemory.x + newValue - getPixelAsFloat(last, pos);
60
+ float newNumerator = oldMemory.y + frameCount*newValue - oldMemory.x;
61
+ write_imagef(memoryOut, pos, (float4)(newTotal, newNumerator, 0, 0));
62
+
63
+ int dataType = get_image_channel_data_type(output);
64
+ if(dataType == CLK_FLOAT) {
65
+ write_imagef(output, pos, newNumerator / (frameCount*(frameCount + 1.0f)/2.0f));
66
+ } else {
67
+ // output image is of integer type, have to apply rounding
68
+ if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
69
+ write_imageui(output, pos, (uint)round(newNumerator / (frameCount*(frameCount + 1.0f)/2.0f)));
70
+ } else {
71
+ write_imagei(output, pos, (int)round(newNumerator / (frameCount*(frameCount + 1.0f)/2.0f)));
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,18 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
2
+
3
+ __kernel void segment(
4
+ __read_only image2d_t input,
5
+ __write_only image2d_t output,
6
+ __private int m_thresh,
7
+ __private int m_filterZeros
8
+ ) {
9
+ const int2 pos = {get_global_id(0), get_global_id(1)};
10
+ float3 color = convert_float4(read_imageui(input, sampler, pos)).xyz;
11
+
12
+ uchar result = 0;
13
+ if ((!(m_filterZeros && all(color == 0))) && (length(color - (float3)(255, 255, 255)) > m_thresh)) {
14
+ result = 1;
15
+ }
16
+
17
+ write_imageui(output, pos, result);
18
+ }
@@ -0,0 +1,203 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | 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 initGrowing(
6
+ __read_only image3d_t centerline,
7
+ #ifdef fast_3d_image_writes
8
+ __write_only image3d_t initSegmentation
9
+ #else
10
+ __global uchar * initSegmentation
11
+ #endif
12
+ ) {
13
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
14
+ if(read_imageui(centerline, sampler, pos).x > 0) {
15
+ uint radius = read_imageui(centerline, sampler, pos).x;
16
+ int N;
17
+ if(radius > 7) {
18
+ N = min(max(1, (int)(radius)), 5);
19
+ } else {
20
+ N = 1;
21
+ }
22
+
23
+ for(int a = -N; a < N+1; a++) {
24
+ for(int b = -N; b < N+1; b++) {
25
+ for(int c = -N; c < N+1; c++) {
26
+ int4 n;
27
+ n.x = pos.x + a;
28
+ n.y = pos.y + b;
29
+ n.z = pos.z + c;
30
+ if(read_imageui(centerline, sampler, n).x == 0 && length((float3)(a,b,c)) <= N) {
31
+ #ifdef fast_3d_image_writes
32
+ write_imageui(initSegmentation, n, 2);
33
+ #else
34
+ if(n.x >= 0 && n.y >= 0 && n.z >= 0 &&
35
+ n.x < get_global_size(0) && n.y < get_global_size(1) && n.z < get_global_size(2))
36
+ initSegmentation[LPOS(n)] = 2;
37
+ #endif
38
+ }
39
+ }}}
40
+ }
41
+
42
+ }
43
+
44
+ __kernel void grow(
45
+ __read_only image3d_t currentSegmentation,
46
+ __read_only image3d_t gvf,
47
+ #ifdef fast_3d_image_writes
48
+ __write_only image3d_t nextSegmentation,
49
+ #else
50
+ __global uchar* nextSegmentation,
51
+ #endif
52
+ __global int * stop
53
+ ) {
54
+
55
+ int4 X = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
56
+ char value = read_imageui(currentSegmentation, sampler, X).x;
57
+ // value of 2, means to check it, 1 means it is already accepted
58
+ if(value == 1) {
59
+ #ifdef fast_3d_image_writes
60
+ write_imageui(nextSegmentation, X, 1);
61
+ #else
62
+ nextSegmentation[LPOS(X)] = 1;
63
+ #endif
64
+ } else if(value == 2){
65
+ float4 FNX = read_imagef(gvf, sampler, X);
66
+ float FNXw = length(FNX.xyz);
67
+
68
+ bool continueGrowing = false;
69
+ for(int a = -1; a < 2; a++) {
70
+ for(int b = -1; b < 2; b++) {
71
+ for(int c = -1; c < 2; c++) {
72
+ if(a == 0 && b == 0 && c == 0)
73
+ continue;
74
+
75
+ int4 Y;
76
+ Y.x = X.x + a;
77
+ Y.y = X.y + b;
78
+ Y.z = X.z + c;
79
+
80
+ char valueY = read_imageui(currentSegmentation, sampler, Y).x;
81
+ if(valueY != 1) {
82
+ float4 FNY = read_imagef(gvf, sampler, Y);
83
+ FNY.w = length(FNY.xyz);
84
+ FNY.x /= FNY.w;
85
+ FNY.y /= FNY.w;
86
+ FNY.z /= FNY.w;
87
+ if(FNY.w > FNXw /*|| FNXw < 0.1f*/) {
88
+ int4 Z;
89
+ float maxDotProduct = -2.0f;
90
+ for(int a2 = -1; a2 < 2; a2++) {
91
+ for(int b2 = -1; b2 < 2; b2++) {
92
+ for(int c2 = -1; c2 < 2; c2++) {
93
+ if(a2 == 0 && b2 == 0 && c2 == 0)
94
+ continue;
95
+ int4 Zc;
96
+ Zc.x = Y.x+a2;
97
+ Zc.y = Y.y+b2;
98
+ Zc.z = Y.z+c2;
99
+ float3 YZ;
100
+ YZ.x = Zc.x-Y.x;
101
+ YZ.y = Zc.y-Y.y;
102
+ YZ.z = Zc.z-Y.z;
103
+ YZ = normalize(YZ);
104
+ if(dot(FNY.xyz, YZ) > maxDotProduct) {
105
+ maxDotProduct = dot(FNY.xyz, YZ);
106
+ Z = Zc;
107
+ }
108
+ }}}
109
+
110
+ if(Z.x == X.x && Z.y == X.y && Z.z == X.z) {
111
+ #ifdef fast_3d_image_writes
112
+ write_imageui(nextSegmentation, X, 1);
113
+ write_imageui(nextSegmentation, Y, 2);
114
+ #else
115
+ nextSegmentation[LPOS(X)] = 1;
116
+ // Check if in bounds
117
+ if(Y.x >= 0 && Y.y >= 0 && Y.z >= 0 &&
118
+ Y.x < get_global_size(0) && Y.y < get_global_size(1) && Y.z < get_global_size(2)) {
119
+ nextSegmentation[LPOS(Y)] = 2;
120
+ }
121
+ #endif
122
+
123
+ continueGrowing = true;
124
+ }
125
+ }
126
+ }
127
+ }}}
128
+
129
+ if(continueGrowing) {
130
+ // Added new items to list (values of 2)
131
+ stop[0] = 0;
132
+ } else {
133
+ // X was not accepted
134
+ #ifdef fast_3d_image_writes
135
+ write_imageui(nextSegmentation, X, 0);
136
+ #else
137
+ nextSegmentation[LPOS(X)] = 0;
138
+ #endif
139
+ }
140
+ }
141
+ }
142
+
143
+ __kernel void dilate(
144
+ __read_only image3d_t volume,
145
+ #ifdef fast_3d_image_writes
146
+ __write_only image3d_t result
147
+ #else
148
+ __global uchar * result
149
+ #endif
150
+ ) {
151
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
152
+
153
+ if(read_imageui(volume, sampler, pos).x == 1) {
154
+ for(int a = -1; a < 2 ; a++) {
155
+ for(int b = -1; b < 2 ; b++) {
156
+ for(int c = -1; c < 2 ; c++) {
157
+ int4 nPos = pos + (int4)(a,b,c,0);
158
+ #ifdef fast_3d_image_writes
159
+ write_imageui(result, nPos, 1);
160
+ #else
161
+ // Check if in bounds
162
+ if(nPos.x >= 0 && nPos.y >= 0 && nPos.z >= 0 &&
163
+ nPos.x < get_global_size(0) && nPos.y < get_global_size(1) && nPos.z < get_global_size(2))
164
+ result[LPOS(nPos)] = 1;
165
+ #endif
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ __kernel void erode(
173
+ __read_only image3d_t volume,
174
+ #ifdef fast_3d_image_writes
175
+ __write_only image3d_t result
176
+ #else
177
+ __global uchar * result
178
+ #endif
179
+ ) {
180
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
181
+
182
+ int value = read_imageui(volume, sampler, pos).x;
183
+ if(value == 1) {
184
+ bool keep = true;
185
+ for(int a = -1; a < 2 ; a++) {
186
+ for(int b = -1; b < 2 ; b++) {
187
+ for(int c = -1; c < 2 ; c++) {
188
+ keep = (read_imageui(volume, sampler, pos + (int4)(a,b,c,0)).x == 1 && keep);
189
+ }
190
+ }
191
+ }
192
+ #ifdef fast_3d_image_writes
193
+ write_imageui(result, pos, keep ? 1 : 0);
194
+ } else {
195
+ write_imageui(result, pos, 0);
196
+ }
197
+ #else
198
+ result[LPOS(pos)] = keep ? 1 : 0;
199
+ } else {
200
+ result[LPOS(pos)] = 0;
201
+ }
202
+ #endif
203
+ }