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,566 @@
1
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
2
+ __constant sampler_t interpolationSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
3
+ __constant sampler_t hpSampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
4
+
5
+ #define LPOS(pos) pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)
6
+
7
+ #ifdef VECTORS_16BIT
8
+ //#define UNORM16_TO_FLOAT(v) (float)v / 65535.0f
9
+ //#define TDF_TYPE ushort
10
+ //#define FLOAT_TO_UNORM16(v) convert_ushort_sat_rte(v * 65535.0f)
11
+ #define UNORM16_TO_FLOAT(v) v
12
+ #define FLOAT_TO_UNORM16(v) v
13
+ #define TDF_TYPE float
14
+
15
+ #define VECTOR_FIELD_TYPE short
16
+ #define FLOAT_TO_SNORM16_3(vector) convert_short3_sat_rte(vector * 32767.0f)
17
+
18
+ #else
19
+ #define UNORM16_TO_FLOAT(v) v
20
+ #define FLOAT_TO_UNORM16(v) v
21
+ #define TDF_TYPE float
22
+
23
+ #define VECTOR_FIELD_TYPE float
24
+ #define FLOAT_TO_SNORM16_3(vector) vector
25
+ #endif
26
+
27
+ float4 readImageToFloat(
28
+ __read_only image3d_t volume,
29
+ int4 position
30
+ ) {
31
+ int dataType = get_image_channel_data_type(volume);
32
+ float4 value;
33
+ if(dataType == CLK_FLOAT) {
34
+ value = read_imagef(volume, sampler, position).x;
35
+ } else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
36
+ value = convert_float4(read_imagei(volume, sampler, position));
37
+ } else {
38
+ value = convert_float4(read_imageui(volume, sampler, position));
39
+ }
40
+ return value;
41
+ }
42
+
43
+ float3 gradient(
44
+ __read_only image3d_t volume, // Volume to perform gradient on
45
+ int4 pos, // Position to perform gradient on
46
+ int volumeComponent, // The volume component to perform gradient on: 0, 1 or 2
47
+ int dimensions, // The number of dimensions to perform gradient in: 1, 2 or 3
48
+ float3 spacing // Image spacing
49
+ ) {
50
+ float f100, f_100, f010 = 0, f0_10 = 0, f001 = 0, f00_1 = 0;
51
+ switch(volumeComponent) {
52
+ case 0:
53
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).x;
54
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).x;
55
+ if(dimensions > 1) {
56
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).x;
57
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).x;
58
+ }
59
+ if(dimensions > 2) {
60
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).x;
61
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).x;
62
+ }
63
+ break;
64
+ case 1:
65
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).y;
66
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).y;
67
+ if(dimensions > 1) {
68
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).y;
69
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).y;
70
+ }
71
+ if(dimensions > 2) {
72
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).y;
73
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).y;
74
+ }
75
+ break;
76
+ case 2:
77
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).z;
78
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).z;
79
+ if(dimensions > 1) {
80
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).z;
81
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).z;
82
+ }
83
+ if(dimensions > 2) {
84
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).z;
85
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).z;
86
+ }
87
+ break;
88
+ }
89
+
90
+ float3 gradient = {
91
+ (f100-f_100)/(2.0f),
92
+ (f010-f0_10)/(2.0f),
93
+ (f001-f00_1)/(2.0f)
94
+ };
95
+
96
+ // Keep original length
97
+ float gradientLength = length(gradient);
98
+ gradient /= spacing;
99
+ gradient = gradientLength*normalize(gradient);
100
+
101
+
102
+ return gradient;
103
+ }
104
+
105
+ float3 gradientNormalized(
106
+ __read_only image3d_t volume, // Volume to perform gradient on, this volume is vector field
107
+ int4 pos, // Position to perform gradient on
108
+ int volumeComponent, // The volume component to perform gradient on: 0, 1 or 2
109
+ int dimensions, // The number of dimensions to perform gradient in: 1, 2 or 3
110
+ float3 spacing // Image spacing
111
+ ) {
112
+ float f100, f_100, f010 = 0, f0_10 = 0, f001 = 0, f00_1 = 0;
113
+ switch(volumeComponent) {
114
+ case 0:
115
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).x;
116
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).x;
117
+ if(dimensions > 1) {
118
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).x;
119
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).x;
120
+ }
121
+ if(dimensions > 2) {
122
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).x;
123
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).x;
124
+ }
125
+ break;
126
+ case 1:
127
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).y;
128
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).y;
129
+ if(dimensions > 1) {
130
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).y;
131
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).y;
132
+ }
133
+ if(dimensions > 2) {
134
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).y;
135
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).y;
136
+ }
137
+ break;
138
+ case 2:
139
+ f100 = read_imagef(volume, pos + (int4)(1,0,0,0)).z;
140
+ f_100 = read_imagef(volume, pos - (int4)(1,0,0,0)).z;
141
+ if(dimensions > 1) {
142
+ f010 = read_imagef(volume, pos + (int4)(0,1,0,0)).z;
143
+ f0_10 = read_imagef(volume, pos - (int4)(0,1,0,0)).z;
144
+ }
145
+ if(dimensions > 2) {
146
+ f001 = read_imagef(volume, pos + (int4)(0,0,1,0)).z;
147
+ f00_1 = read_imagef(volume, pos - (int4)(0,0,1,0)).z;
148
+ }
149
+ break;
150
+ }
151
+
152
+ // Normalization
153
+ f100 /= length(read_imagef(volume, sampler, pos + (int4)(1,0,0,0)).xyz);
154
+ f_100 /= length(read_imagef(volume, sampler, pos - (int4)(1,0,0,0)).xyz);
155
+ f010 /= length(read_imagef(volume, sampler, pos + (int4)(0,1,0,0)).xyz);
156
+ f0_10 /= length(read_imagef(volume, sampler, pos - (int4)(0,1,0,0)).xyz);
157
+ f001 /= length(read_imagef(volume, sampler, pos + (int4)(0,0,1,0)).xyz);
158
+ f00_1 /= length(read_imagef(volume, sampler, pos - (int4)(0,0,1,0)).xyz);
159
+
160
+ float3 gradient = {
161
+ (f100 - f_100)/(2.0f),
162
+ (f010 - f0_10)/(2.0f),
163
+ (f001 - f00_1)/(2.0f)
164
+ };
165
+
166
+
167
+ // Keep original length
168
+ /*
169
+ float gradientLength = length(gradient);
170
+ gradient /= spacing;
171
+ gradient = gradientLength*normalize(gradient);
172
+ */
173
+
174
+
175
+ return gradient;
176
+ }
177
+
178
+ __kernel void toFloat(
179
+ __read_only image3d_t volume,
180
+ #ifdef fast_3d_image_writes
181
+ __write_only image3d_t processedVolume,
182
+ #else
183
+ __global float* processedVolume,
184
+ #endif
185
+ __private float minimum,
186
+ __private float maximum
187
+ ) {
188
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
189
+
190
+ float v = readImageToFloat(volume, pos).x;
191
+
192
+ v = v > maximum ? maximum : v;
193
+ v = v < minimum ? minimum : v;
194
+
195
+ // Convert to floating point representation 0 to 1
196
+ float value = (v - minimum) / (maximum - minimum);
197
+
198
+ // Store value
199
+ #ifdef fast_3d_image_writes
200
+ write_imagef(processedVolume, pos, value);
201
+ #else
202
+ processedVolume[LPOS(pos)] = value;
203
+ #endif
204
+ }
205
+
206
+ __kernel void createVectorField(
207
+ __read_only image3d_t volume,
208
+ #ifdef fast_3d_image_writes
209
+ __write_only image3d_t vectorField,
210
+ #else
211
+ __global VECTOR_FIELD_TYPE* vectorField,
212
+ #endif
213
+ __private float Fmax,
214
+ __private float vsign,
215
+ __private float spacing_x,
216
+ __private float spacing_y,
217
+ __private float spacing_z
218
+ ) {
219
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
220
+
221
+ // Gradient of volume
222
+ float4 F;
223
+ F.xyz = vsign*gradient(volume, pos, 0, 3, (float3)(spacing_x, spacing_y, spacing_z)); // The sign here is important
224
+ F.w = 0.0f;
225
+
226
+ // Fmax normalization
227
+ const float l = length(F);
228
+ F = l < Fmax ? F/(Fmax) : F / (l);
229
+ F.w = 1.0f;
230
+
231
+ // Store vector field
232
+ #ifdef fast_3d_image_writes
233
+ write_imagef(vectorField, pos, F);
234
+ #else
235
+ vstore3(FLOAT_TO_SNORM16_3(F.xyz), LPOS(pos), vectorField);
236
+ #endif
237
+ }
238
+
239
+ // Forward declaration of eigen_decomp function
240
+ void eigen_decomposition(float M[3][3], float V[3][3], float e[3]);
241
+
242
+ __constant float cosValues[32] = {1.0f, 0.540302f, -0.416147f, -0.989992f, -0.653644f, 0.283662f, 0.96017f, 0.753902f, -0.1455f, -0.91113f, -0.839072f, 0.0044257f, 0.843854f, 0.907447f, 0.136737f, -0.759688f, -0.957659f, -0.275163f, 0.660317f, 0.988705f, 0.408082f, -0.547729f, -0.999961f, -0.532833f, 0.424179f, 0.991203f, 0.646919f, -0.292139f, -0.962606f, -0.748058f, 0.154251f, 0.914742f};
243
+ __constant float sinValues[32] = {0.0f, 0.841471f, 0.909297f, 0.14112f, -0.756802f, -0.958924f, -0.279415f, 0.656987f, 0.989358f, 0.412118f, -0.544021f, -0.99999f, -0.536573f, 0.420167f, 0.990607f, 0.650288f, -0.287903f, -0.961397f, -0.750987f, 0.149877f, 0.912945f, 0.836656f, -0.00885131f, -0.84622f, -0.905578f, -0.132352f, 0.762558f, 0.956376f, 0.270906f, -0.663634f, -0.988032f, -0.404038f};
244
+
245
+ __kernel void circleFittingTDF(
246
+ __read_only image3d_t vectorField,
247
+ __global TDF_TYPE * T,
248
+ __private float rMin,
249
+ __private float rMax,
250
+ __private float rStep,
251
+ __global float* Radius,
252
+ __private float spacing_x,
253
+ __private float spacing_y,
254
+ __private float spacing_z
255
+ ) {
256
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
257
+ const float3 spacing = {spacing_x, spacing_y, spacing_z};
258
+
259
+
260
+ // Find Hessian Matrix
261
+ float3 Fx, Fy, Fz;
262
+ if(rMax < 4) {
263
+ Fx = gradient(vectorField, pos, 0, 1, spacing);
264
+ Fy = gradient(vectorField, pos, 1, 2, spacing);
265
+ Fz = gradient(vectorField, pos, 2, 3, spacing);
266
+ } else {
267
+ Fx = gradientNormalized(vectorField, pos, 0, 1, spacing);
268
+ Fy = gradientNormalized(vectorField, pos, 1, 2, spacing);
269
+ Fz = gradientNormalized(vectorField, pos, 2, 3, spacing);
270
+ }
271
+
272
+
273
+ float Hessian[3][3] = {
274
+ {Fx.x, Fy.x, Fz.x},
275
+ {Fy.x, Fy.y, Fz.y},
276
+ {Fz.x, Fz.y, Fz.z}
277
+ };
278
+
279
+ // Eigen decomposition
280
+ float eigenValues[3];
281
+ float eigenVectors[3][3];
282
+ eigen_decomposition(Hessian, eigenVectors, eigenValues);
283
+ //const float3 lambda = {eigenValues[0], eigenValues[1], eigenValues[2]};
284
+ //const float3 e1 = {eigenVectors[0][0], eigenVectors[1][0], eigenVectors[2][0]};
285
+ const float3 e2 = {eigenVectors[0][1], eigenVectors[1][1], eigenVectors[2][1]};
286
+ const float3 e3 = {eigenVectors[0][2], eigenVectors[1][2], eigenVectors[2][2]};
287
+
288
+ // Circle Fitting
289
+ float maxSum = 0.0f;
290
+ float maxRadius = 0.0f;
291
+ const float4 floatPos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
292
+ for(float radius = rMin; radius <= rMax; radius += rStep) {
293
+ float radiusSum = 0.0f;
294
+ char samples = 32;
295
+ char stride = 1;
296
+
297
+ for(char j = 0; j < samples; ++j) {
298
+ float3 V_alpha = cosValues[j*stride]*e3 + sinValues[j*stride]*e2;
299
+ float4 position = floatPos + radius*V_alpha.xyzz;
300
+ float3 V = -read_imagef(vectorField, interpolationSampler, position).xyz;
301
+ radiusSum += dot(V, V_alpha);
302
+ }
303
+ radiusSum /= samples;
304
+ if(radiusSum > maxSum) {
305
+ maxSum = radiusSum;
306
+ maxRadius = radius;
307
+ } else {
308
+ break;
309
+ }
310
+ }
311
+
312
+ // Store result
313
+ T[LPOS(pos)] = FLOAT_TO_UNORM16(maxSum);
314
+ Radius[LPOS(pos)] = maxRadius;
315
+ }
316
+
317
+ __kernel void nonCircularTDF(
318
+ __read_only image3d_t vectorField,
319
+ __global TDF_TYPE * T,
320
+ __private float rMin,
321
+ __private float rMax,
322
+ __private float rStep,
323
+ __private const int arms,
324
+ __private const float minAverageMag,
325
+ __global float * R,
326
+ __private float spacing_x,
327
+ __private float spacing_y,
328
+ __private float spacing_z
329
+ ) {
330
+ const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
331
+ const float3 spacing = {spacing_x, spacing_y, spacing_z};
332
+ char invalid = 0;
333
+
334
+ // Find Hessian Matrix
335
+ const float3 Fx = gradientNormalized(vectorField, pos, 0, 1, spacing);
336
+ const float3 Fy = gradientNormalized(vectorField, pos, 1, 2, spacing);
337
+ const float3 Fz = gradientNormalized(vectorField, pos, 2, 3, spacing);
338
+
339
+ float Hessian[3][3] = {
340
+ {Fx.x, Fy.x, Fz.x},
341
+ {Fy.x, Fy.y, Fz.y},
342
+ {Fz.x, Fz.y, Fz.z}
343
+ };
344
+
345
+ // Eigen decomposition
346
+ float eigenValues[3];
347
+ float eigenVectors[3][3];
348
+ eigen_decomposition(Hessian, eigenVectors, eigenValues);
349
+ const float3 e1 = {eigenVectors[0][0], eigenVectors[1][0], eigenVectors[2][0]};
350
+ const float3 e2 = {eigenVectors[0][1], eigenVectors[1][1], eigenVectors[2][1]};
351
+ const float3 e3 = {eigenVectors[0][2], eigenVectors[1][2], eigenVectors[2][2]};
352
+
353
+ float currentVoxelMagnitude = length(read_imagef(vectorField, sampler, pos).xyz);
354
+
355
+ float maxRadius[12]; // 12 is maximum nr of arms atm.
356
+ float sum = 0.0f;
357
+ //float minAverageMag = 0.01f; // 0.01
358
+ float largestRadius = 0;
359
+ for(char j = 0; j < arms; ++j) {
360
+ maxRadius[j] = 999;
361
+ float alpha = 2 * M_PI_F * j / arms;
362
+ float4 V_alpha = cos(alpha)*e3.xyzz + sin(alpha)*e2.xyzz;
363
+ float prevMagnitude2 = currentVoxelMagnitude;
364
+ float4 position = convert_float4(pos) + rMin*V_alpha;
365
+ float prevMagnitude = length(read_imagef(vectorField, interpolationSampler, position).xyz);
366
+ char up = prevMagnitude2 > prevMagnitude ? 0 : 1;
367
+
368
+ // Perform the actual line search
369
+ for(float radius = rMin+rStep; radius <= rMax; radius += rStep) {
370
+ position = convert_float4(pos) + radius*V_alpha;
371
+ float4 vec = read_imagef(vectorField, interpolationSampler, position);
372
+ vec.w = 0.0f;
373
+ float magnitude = length(vec.xyz);
374
+
375
+ // Is a border point found?
376
+ if(up == 1 && magnitude < prevMagnitude && (prevMagnitude+magnitude)/2.0f - currentVoxelMagnitude > minAverageMag) { // Dot produt here is test
377
+ maxRadius[j] = radius;
378
+ if(radius > largestRadius)
379
+ largestRadius = radius;
380
+ if(dot(normalize(vec.xyz), -normalize(V_alpha.xyz)) < 0.0f) {
381
+ invalid = 1;
382
+ sum = 0.0f;
383
+ //break;
384
+ }
385
+ sum += 1.0f-fabs(dot(normalize(vec.xyz), e1));
386
+ break;
387
+ } // End found border point
388
+
389
+ if(magnitude > prevMagnitude) {
390
+ up = 1;
391
+ }
392
+ prevMagnitude = magnitude;
393
+ } // End for each radius
394
+
395
+ if(maxRadius[j] == 999 || invalid == 1) {
396
+ invalid = 1;
397
+ break;
398
+ }
399
+ } // End for arms
400
+
401
+ if(invalid != 1) {
402
+ float avgSymmetry = 0.0f;
403
+ for(char j = 0; j < arms/2; ++j) {
404
+ avgSymmetry += min(maxRadius[j], maxRadius[arms/2 + j]) /
405
+ max(maxRadius[j], maxRadius[arms/2+j]);
406
+ }
407
+ avgSymmetry /= arms/2;
408
+ R[LPOS(pos)] = largestRadius;
409
+ T[LPOS(pos)] = FLOAT_TO_UNORM16(min(1.0f, (sum / (arms))*avgSymmetry+0.2f));
410
+ } else {
411
+ R[LPOS(pos)] = 0;
412
+ T[LPOS(pos)] = 0;
413
+ }
414
+ }
415
+ int dsyevj3(float A[3][3], float Q[3][3], float w[3])
416
+ // ----------------------------------------------------------------------------
417
+ // Calculates the eigenvalues and normalized eigenvectors of a symmetric 3x3
418
+ // matrix A using the Jacobi algorithm.
419
+ // The upper triangular part of A is destroyed during the calculation,
420
+ // the diagonal elements are read but not destroyed, and the lower
421
+ // triangular elements are not referenced at all.
422
+ // ----------------------------------------------------------------------------
423
+ // Parameters:
424
+ // A: The symmetric input matrix
425
+ // Q: Storage buffer for eigenvectors
426
+ // w: Storage buffer for eigenvalues
427
+ // ----------------------------------------------------------------------------
428
+ // Return value:
429
+ // 0: Success
430
+ // -1: Error (no convergence)
431
+ // ----------------------------------------------------------------------------
432
+ {
433
+ const int n = 3;
434
+ float sd, so; // Sums of diagonal resp. off-diagonal elements
435
+ float s, c, t; // sin(phi), cos(phi), tan(phi) and temporary storage
436
+ float g, h, z, theta; // More temporary storage
437
+ float thresh;
438
+
439
+ // Initialize Q to the identitity matrix
440
+ for (int i=0; i < n; i++)
441
+ {
442
+ Q[i][i] = 1.0;
443
+ for (int j=0; j < i; j++)
444
+ Q[i][j] = Q[j][i] = 0.0;
445
+ }
446
+
447
+ // Initialize w to diag(A)
448
+ for (int i=0; i < n; i++)
449
+ w[i] = A[i][i];
450
+
451
+ // Calculate SQR(tr(A))
452
+ sd = 0.0;
453
+ for (int i=0; i < n; i++)
454
+ sd += fabs(w[i]);
455
+ sd = sd*sd;
456
+
457
+ // Main iteration loop
458
+ for (int nIter=0; nIter < 50; nIter++)
459
+ {
460
+ // Test for convergence
461
+ so = 0.0;
462
+ for (int p=0; p < n; p++)
463
+ for (int q=p+1; q < n; q++)
464
+ so += fabs(A[p][q]);
465
+ if (so == 0.0)
466
+ return 0;
467
+
468
+ if (nIter < 4) {
469
+ thresh = 0.2 * so / (n*n);
470
+ } else {
471
+ thresh = 0.0;
472
+ }
473
+
474
+ // Do sweep
475
+ for (int p=0; p < n; p++)
476
+ for (int q=p+1; q < n; q++)
477
+ {
478
+ g = 100.0 * fabs(A[p][q]);
479
+ if (nIter > 4 && fabs(w[p]) + g == fabs(w[p])
480
+ && fabs(w[q]) + g == fabs(w[q]))
481
+ {
482
+ A[p][q] = 0.0;
483
+ }
484
+ else if (fabs(A[p][q]) > thresh)
485
+ {
486
+ // Calculate Jacobi transformation
487
+ h = w[q] - w[p];
488
+ if (fabs(h) + g == fabs(h))
489
+ {
490
+ t = A[p][q] / h;
491
+ }
492
+ else
493
+ {
494
+ theta = 0.5 * h / A[p][q];
495
+ if (theta < 0.0)
496
+ t = -1.0 / (sqrt(1.0 + theta*theta) - theta);
497
+ else
498
+ t = 1.0 / (sqrt(1.0 + theta*theta) + theta);
499
+ }
500
+ c = 1.0/sqrt(1.0 + t*t);
501
+ s = t * c;
502
+ z = t * A[p][q];
503
+
504
+ // Apply Jacobi transformation
505
+ A[p][q] = 0.0;
506
+ w[p] -= z;
507
+ w[q] += z;
508
+ for (int r=0; r < p; r++)
509
+ {
510
+ t = A[r][p];
511
+ A[r][p] = c*t - s*A[r][q];
512
+ A[r][q] = s*t + c*A[r][q];
513
+ }
514
+ for (int r=p+1; r < q; r++)
515
+ {
516
+ t = A[p][r];
517
+ A[p][r] = c*t - s*A[r][q];
518
+ A[r][q] = s*t + c*A[r][q];
519
+ }
520
+ for (int r=q+1; r < n; r++)
521
+ {
522
+ t = A[p][r];
523
+ A[p][r] = c*t - s*A[q][r];
524
+ A[q][r] = s*t + c*A[q][r];
525
+ }
526
+
527
+ // Update eigenvectors
528
+ for (int r=0; r < n; r++)
529
+ {
530
+ t = Q[r][p];
531
+ Q[r][p] = c*t - s*Q[r][q];
532
+ Q[r][q] = s*t + c*Q[r][q];
533
+ }
534
+ }
535
+ }
536
+ }
537
+
538
+
539
+
540
+ return -1;
541
+ }
542
+
543
+ void eigen_decomposition(float A[3][3], float V[3][3], float d[3]) {
544
+ dsyevj3(A, V, d);
545
+
546
+ // Sort eigenvalues and corresponding vectors.
547
+ for (char i = 0; i < 3; ++i) {
548
+ char k = i;
549
+ float p = d[i];
550
+ for (char j = i+1; j < 3; ++j) {
551
+ if (fabs(d[j]) < fabs(p)) {
552
+ k = j;
553
+ p = d[j];
554
+ }
555
+ }
556
+ if (k != i) {
557
+ d[k] = d[i];
558
+ d[i] = p;
559
+ for (char j = 0; j < 3; ++j) {
560
+ p = V[j][i];
561
+ V[j][i] = V[j][k];
562
+ V[j][k] = p;
563
+ }
564
+ }
565
+ }
566
+ }
@@ -0,0 +1,45 @@
1
+ const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
2
+
3
+ inline float2 complexDivision(float2 a, float2 b){
4
+ return (float2)(
5
+ (a.x*b.x + a.y*b.y)/(b.x*b.x + b.y*b.y),
6
+ (a.y*b.x - a.x*b.y)/(b.x*b.x + b.y*b.y)
7
+ );
8
+ }
9
+
10
+ __kernel void envelopeAndLogCompress(
11
+ __read_only image2d_t input,
12
+ __write_only image2d_t output
13
+ ) {
14
+ const int2 pos = {get_global_id(0), get_global_id(1)};
15
+
16
+ float2 iq = read_imagef(input, sampler, pos).xy;
17
+ write_imagef(output, pos, 20.0f * log10(length(iq))); // Length is abs for complex
18
+ }
19
+
20
+ __kernel void normalizeEnvelope(
21
+ __read_only image2d_t input,
22
+ __write_only image2d_t output,
23
+ __private float maxdB
24
+ ) {
25
+ const int2 pos = {get_global_id(0), get_global_id(1)};
26
+
27
+ write_imagef(output, pos, read_imagef(input, sampler, pos).x - maxdB);
28
+ }
29
+
30
+ __kernel void normalizeEnvelopeToGrayscale(
31
+ __read_only image2d_t input,
32
+ __write_only image2d_t output,
33
+ __private float maxdB,
34
+ __private float gain,
35
+ __private float dynamicRange
36
+ ) {
37
+ const int2 pos = {get_global_id(0), get_global_id(1)};
38
+
39
+ float dBPixel = read_imagef(input, sampler, pos).x - maxdB;
40
+ float img_sc_reject = dBPixel + gain;
41
+ img_sc_reject = (img_sc_reject < -dynamicRange) ? -dynamicRange : img_sc_reject; //Reject everything below dynamic range
42
+ img_sc_reject = (img_sc_reject > 0) ? 0 : img_sc_reject; // Everything above 0 dB should be saturated
43
+ uchar img_gray_scale = round(255*(img_sc_reject+dynamicRange)/dynamicRange);
44
+ write_imageui(output, pos, img_gray_scale);
45
+ }
@@ -0,0 +1,76 @@
1
+ const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_MIRRORED_REPEAT | CLK_FILTER_LINEAR;
2
+
3
+ void cart2pol(float x, float y, float *r, float *th) {
4
+ }
5
+
6
+
7
+ __kernel void scanConvert(
8
+ __read_only image2d_t input,
9
+ __write_only image2d_t output,
10
+ __private float gain,
11
+ __private float dynamicRange,
12
+ __private float newXSpacing,
13
+ __private float newYSpacing,
14
+ __private float startX,
15
+ __private float startY,
16
+ __private float startDepth,
17
+ __private float startAzimuth,
18
+ __private float depthSpacing,
19
+ __private float azimuthSpacing,
20
+ __private int isPolar
21
+ ) {
22
+ int2 pos = {get_global_id(0), get_global_id(1)};
23
+ float x = pos.x*newXSpacing + startX;
24
+ float y = pos.y*newYSpacing + startY;
25
+ // Cart 2 polar
26
+ float r = isPolar == 1 ? sqrt(x*x + y*y) : y;
27
+ float th = isPolar == 1 ? atan2(x, y) : x;
28
+
29
+ // Normalize
30
+ r = ((r - startDepth)/depthSpacing)/get_image_height(input);
31
+ th = ((th - startAzimuth)/azimuthSpacing)/get_image_width(input);
32
+
33
+ if(r < 0.0f || r > 1.0f || th < 0.0f || th > 1.0f) {
34
+ // Out of bounds
35
+ write_imageui(output, pos, 0);
36
+ } else {
37
+ float dBPixel = read_imagef(input, sampler, (float2)(th, r)).x;
38
+ float img_sc_reject = dBPixel + gain;
39
+ img_sc_reject = (img_sc_reject < -dynamicRange) ? -dynamicRange : img_sc_reject; //Reject everything below dynamic range
40
+ img_sc_reject = (img_sc_reject > 0) ? 0 : img_sc_reject; // Everything above 0 dB should be saturated
41
+ uchar img_gray_scale = round(255*(img_sc_reject+dynamicRange)/dynamicRange);
42
+ write_imageui(output, pos, img_gray_scale);
43
+ }
44
+ }
45
+
46
+ __kernel void scanConvertGrayscale(
47
+ __read_only image2d_t input,
48
+ __write_only image2d_t output,
49
+ __private float newXSpacing,
50
+ __private float newYSpacing,
51
+ __private float startX,
52
+ __private float startY,
53
+ __private float startDepth,
54
+ __private float startAzimuth,
55
+ __private float depthSpacing,
56
+ __private float azimuthSpacing,
57
+ __private int isPolar
58
+ ) {
59
+ int2 pos = {get_global_id(0), get_global_id(1)};
60
+ float x = pos.x*newXSpacing + startX;
61
+ float y = pos.y*newYSpacing + startY;
62
+ // Cart 2 polar
63
+ float r = isPolar == 1 ? sqrt(x*x + y*y) : y;
64
+ float th = isPolar == 1 ? atan2(x, y) : x;
65
+
66
+ // Normalize
67
+ r = ((r - startDepth)/depthSpacing)/get_image_height(input);
68
+ th = ((th - startAzimuth)/azimuthSpacing)/get_image_width(input);
69
+
70
+ if(r < 0.0f || r > 1.0f || th < 0.0f || th > 1.0f) {
71
+ // Out of bounds
72
+ write_imageui(output, pos, 0);
73
+ } else {
74
+ write_imageui(output, pos, read_imageui(input, sampler, (float2)(th, r)));
75
+ }
76
+ }