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.
- fast/README.md +41 -0
- fast/__init__.py +22 -0
- fast/bin/DirectML.dll +0 -0
- fast/bin/FAST.dll +0 -0
- fast/bin/InferenceEngineONNXRuntime.dll +0 -0
- fast/bin/InferenceEngineOpenVINO.dll +0 -0
- fast/bin/InferenceEngineTensorFlow.dll +0 -0
- fast/bin/InferenceEngineTensorRT.dll +0 -0
- fast/bin/JKQTCommonSharedLib_Release.dll +0 -0
- fast/bin/JKQTFastPlotterSharedLib_Release.dll +0 -0
- fast/bin/JKQTMathTextSharedLib_Release.dll +0 -0
- fast/bin/JKQTPlotterSharedLib_Release.dll +0 -0
- fast/bin/OpenCL.dll +0 -0
- fast/bin/OpenIGTLink.dll +0 -0
- fast/bin/Qt5Concurrent.dll +0 -0
- fast/bin/Qt5Core.dll +0 -0
- fast/bin/Qt5DBus.dll +0 -0
- fast/bin/Qt5Gui.dll +0 -0
- fast/bin/Qt5Multimedia.dll +0 -0
- fast/bin/Qt5MultimediaWidgets.dll +0 -0
- fast/bin/Qt5Network.dll +0 -0
- fast/bin/Qt5OpenGL.dll +0 -0
- fast/bin/Qt5PrintSupport.dll +0 -0
- fast/bin/Qt5SerialPort.dll +0 -0
- fast/bin/Qt5Sql.dll +0 -0
- fast/bin/Qt5Svg.dll +0 -0
- fast/bin/Qt5Test.dll +0 -0
- fast/bin/Qt5Widgets.dll +0 -0
- fast/bin/Qt5Xml.dll +0 -0
- fast/bin/UFFviewer.exe +0 -0
- fast/bin/_fast.pyd +0 -0
- fast/bin/brotlicommon.dll +0 -0
- fast/bin/brotlidec.dll +0 -0
- fast/bin/brotlienc.dll +0 -0
- fast/bin/cache.json +114134 -0
- fast/bin/dcmdata.dll +0 -0
- fast/bin/dcmimage.dll +0 -0
- fast/bin/dcmimgle.dll +0 -0
- fast/bin/dcmjpeg.dll +0 -0
- fast/bin/fast_configuration.txt +14 -0
- fast/bin/gna.dll +0 -0
- fast/bin/ijg12.dll +0 -0
- fast/bin/ijg16.dll +0 -0
- fast/bin/ijg8.dll +0 -0
- fast/bin/jxl.dll +0 -0
- fast/bin/jxl_cms.dll +0 -0
- fast/bin/jxl_threads.dll +0 -0
- fast/bin/libcrypto-1_1-x64.dll +0 -0
- fast/bin/libjpeg.dll +0 -0
- fast/bin/libopenslide-1.dll +0 -0
- fast/bin/libssl-1_1-x64.dll +0 -0
- fast/bin/oflog.dll +0 -0
- fast/bin/ofstd.dll +0 -0
- fast/bin/onnxruntime.dll +0 -0
- fast/bin/onnxruntime_providers_shared.dll +0 -0
- fast/bin/openvino.dll +0 -0
- fast/bin/openvino_auto_batch_plugin.dll +0 -0
- fast/bin/openvino_auto_plugin.dll +0 -0
- fast/bin/openvino_c.dll +0 -0
- fast/bin/openvino_gapi_preproc.dll +0 -0
- fast/bin/openvino_hetero_plugin.dll +0 -0
- fast/bin/openvino_intel_cpu_plugin.dll +0 -0
- fast/bin/openvino_intel_gna_plugin.dll +0 -0
- fast/bin/openvino_intel_gpu_plugin.dll +0 -0
- fast/bin/openvino_ir_frontend.dll +0 -0
- fast/bin/openvino_onnx_frontend.dll +0 -0
- fast/bin/openvino_paddle_frontend.dll +0 -0
- fast/bin/plugins.xml +24 -0
- fast/bin/realsense2.dll +0 -0
- fast/bin/runPipeline.exe +0 -0
- fast/bin/systemCheck.exe +0 -0
- fast/bin/tbb.dll +0 -0
- fast/bin/tbb_preview.dll +0 -0
- fast/bin/tbbbind.dll +0 -0
- fast/bin/tbbmalloc.dll +0 -0
- fast/bin/tbbmalloc_proxy.dll +0 -0
- fast/bin/tiff.dll +0 -0
- fast/bin/zlib.dll +0 -0
- fast/doc/bright-plotting-style.ini +66 -0
- fast/doc/dark-plotting-style.ini +66 -0
- fast/doc/fonts/UFL.txt +96 -0
- fast/doc/fonts/Ubuntu-Bold.ttf +0 -0
- fast/doc/fonts/Ubuntu-BoldItalic.ttf +0 -0
- fast/doc/fonts/Ubuntu-Italic.ttf +0 -0
- fast/doc/fonts/Ubuntu-Light.ttf +0 -0
- fast/doc/fonts/Ubuntu-LightItalic.ttf +0 -0
- fast/doc/fonts/Ubuntu-Medium.ttf +0 -0
- fast/doc/fonts/Ubuntu-MediumItalic.ttf +0 -0
- fast/doc/fonts/Ubuntu-Regular.ttf +0 -0
- fast/doc/fonts/UbuntuMono-Bold.ttf +0 -0
- fast/doc/fonts/UbuntuMono-BoldItalic.ttf +0 -0
- fast/doc/fonts/UbuntuMono-Italic.ttf +0 -0
- fast/doc/fonts/UbuntuMono-Regular.ttf +0 -0
- fast/doc/images/FAST_logo_square.png +0 -0
- fast/doc/images/fast_icon.ico +0 -0
- fast/doc/images/fast_icon.png +0 -0
- fast/entry_points.py +14 -0
- fast/fast.py +20057 -0
- fast/kernels/Algorithms/AirwaySegmentation/AirwaySegmentation.cl +85 -0
- fast/kernels/Algorithms/ApplyColormap/ApplyColormap.cl +146 -0
- fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding2D.cl +61 -0
- fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding3D.cl +61 -0
- fast/kernels/Algorithms/BlockMatching/BlockMatching.cl +257 -0
- fast/kernels/Algorithms/CenterlineExtraction/CenterlineExtraction.cl +153 -0
- fast/kernels/Algorithms/CoherentPointDrift/CoherentPointDrift.cl +0 -0
- fast/kernels/Algorithms/Color/ColorToGrayscale.cl +22 -0
- fast/kernels/Algorithms/Color/GrayscaleToColor.cl +19 -0
- fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing2D.cl +35 -0
- fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing3D.cl +75 -0
- fast/kernels/Algorithms/GradientVectorFlow/EulerGradientVectorFlow.cl +174 -0
- fast/kernels/Algorithms/GradientVectorFlow/MultigridGradientVectorFlow.cl +407 -0
- fast/kernels/Algorithms/HounsefieldConverter/HounsefieldConverter.cl +22 -0
- fast/kernels/Algorithms/ImageAdd/ImageAdd.cl +79 -0
- fast/kernels/Algorithms/ImageCaster/ImageCaster.cl +38 -0
- fast/kernels/Algorithms/ImageChannelConverter/ImageChannelConverter.cl +121 -0
- fast/kernels/Algorithms/ImageFlipper/ImageFlipper2D.cl +23 -0
- fast/kernels/Algorithms/ImageFlipper/ImageFlipper3D.cl +51 -0
- fast/kernels/Algorithms/ImageGradient/ImageGradient.cl +71 -0
- fast/kernels/Algorithms/ImageInverter/ImageInverter.cl +30 -0
- fast/kernels/Algorithms/ImageMultiply/ImageMultiply.cl +79 -0
- fast/kernels/Algorithms/ImagePatch/PatchStitcher2D.cl +22 -0
- fast/kernels/Algorithms/ImagePatch/PatchStitcher3D.cl +95 -0
- fast/kernels/Algorithms/ImageResampler/ImageResampler2D.cl +40 -0
- fast/kernels/Algorithms/ImageResampler/ImageResampler3D.cl +32 -0
- fast/kernels/Algorithms/ImageResizer/ImageResizer.cl +134 -0
- fast/kernels/Algorithms/ImageSharpening/ImageSharpening.cl +47 -0
- fast/kernels/Algorithms/ImageSlicer/ImageSlicer.cl +77 -0
- fast/kernels/Algorithms/ImageTransposer/ImageTransposer2D.cl +16 -0
- fast/kernels/Algorithms/ImageTransposer/ImageTransposer3D.cl +45 -0
- fast/kernels/Algorithms/IntensityClipping/IntensityClipping2D.cl +19 -0
- fast/kernels/Algorithms/IntensityClipping/IntensityClipping3D.cl +20 -0
- fast/kernels/Algorithms/IntensityNormalization/IntensityNormalization.cl +85 -0
- fast/kernels/Algorithms/IntensityNormalization/ZeroMeanUnitVariance.cl +76 -0
- fast/kernels/Algorithms/KalmanFilterModelSegmentation/AppearanceModels/RidgeEdge/RidgeEdgeModel.cl +81 -0
- fast/kernels/Algorithms/LabelModifier/LabelModifier.cl +20 -0
- fast/kernels/Algorithms/LaplacianOfGaussian/LaplacianOfGaussian2D.cl +27 -0
- fast/kernels/Algorithms/LevelSet/LevelSetSegmentation.cl +132 -0
- fast/kernels/Algorithms/LungSegmentation/LungSegmentation.cl +22 -0
- fast/kernels/Algorithms/MeshToSegmentation/MeshToSegmentation.cl +184 -0
- fast/kernels/Algorithms/Morphology/Dilation.cl +56 -0
- fast/kernels/Algorithms/Morphology/Erosion.cl +64 -0
- fast/kernels/Algorithms/NeuralNetwork/NeuralNetwork.cl +122 -0
- fast/kernels/Algorithms/NeuralNetwork/VertexTensorToSegmentation.cl +13 -0
- fast/kernels/Algorithms/NonLocalMeans/NonLocalMeans2D.cl +94 -0
- fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing2D.cl +57 -0
- fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing3D.cl +58 -0
- fast/kernels/Algorithms/Skeletonization/Skeletonization2D.cl +77 -0
- fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction.cl +519 -0
- fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction_no_3d_write.cl +739 -0
- fast/kernels/Algorithms/TemporalSmoothing/ImageMovingAverage.cl +66 -0
- fast/kernels/Algorithms/TemporalSmoothing/ImageWeightedMovingAverage.cl +74 -0
- fast/kernels/Algorithms/TissueSegmentation/TissueSegmentation.cl +18 -0
- fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/InverseGradientSegmentation.cl +203 -0
- fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/TubeSegmentationAndCenterlineExtraction.cl +566 -0
- fast/kernels/Algorithms/Ultrasound/EnvelopeAndLogCompressor.cl +45 -0
- fast/kernels/Algorithms/Ultrasound/ScanConverter.cl +76 -0
- fast/kernels/Algorithms/UltrasoundImageCropper/UltrasoundImageCropper.cl +31 -0
- fast/kernels/Algorithms/UltrasoundImageEnhancement/UltrasoundImageEnhancement.cl +27 -0
- fast/kernels/Algorithms/VectorMedianFilter/VectorMedianFilter.cl +31 -0
- fast/kernels/ImageFill.cl +30 -0
- fast/kernels/ImageMinMax.cl +196 -0
- fast/kernels/ImageSum.cl +170 -0
- fast/kernels/Tests/Algorithms/DoubleFilter.cl +7 -0
- fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.frag +8 -0
- fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.geom +69 -0
- fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.vert +17 -0
- fast/kernels/Visualization/HeatmapRenderer/HeatmapRenderer.cl +51 -0
- fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.frag +11 -0
- fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.vert +15 -0
- fast/kernels/Visualization/ImageRenderer/ImageRenderer.vert +15 -0
- fast/kernels/Visualization/ImageRenderer/ImageRendererFLOAT.frag +18 -0
- fast/kernels/Visualization/ImageRenderer/ImageRendererINT.frag +18 -0
- fast/kernels/Visualization/ImageRenderer/ImageRendererUINT.frag +18 -0
- fast/kernels/Visualization/LineRenderer/LineRenderer.frag +8 -0
- fast/kernels/Visualization/LineRenderer/LineRenderer.geom +35 -0
- fast/kernels/Visualization/LineRenderer/LineRenderer.vert +20 -0
- fast/kernels/Visualization/LineRenderer/LineRenderer3D.frag +8 -0
- fast/kernels/Visualization/LineRenderer/LineRenderer3D.vert +20 -0
- fast/kernels/Visualization/LineRenderer/LineRendererJoints.frag +15 -0
- fast/kernels/Visualization/LineRenderer/LineRendererJoints.vert +24 -0
- fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.frag +11 -0
- fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.vert +16 -0
- fast/kernels/Visualization/SegmentationRenderer/SegmentationPyramidRenderer.frag +53 -0
- fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.frag +52 -0
- fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.vert +15 -0
- fast/kernels/Visualization/TextRenderer/TextRenderer.frag +11 -0
- fast/kernels/Visualization/TextRenderer/TextRenderer.vert +20 -0
- fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.frag +49 -0
- fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.vert +35 -0
- fast/kernels/Visualization/VectorFieldRenderer/VectorFieldColorRenderer.cl +30 -0
- fast/kernels/Visualization/VertexRenderer/VertexRenderer.frag +14 -0
- fast/kernels/Visualization/VertexRenderer/VertexRenderer.vert +23 -0
- fast/kernels/Visualization/View.cl +10 -0
- fast/kernels/Visualization/VolumeRenderer/AlphaBlendingVolumeRenderer.cl +211 -0
- fast/kernels/Visualization/VolumeRenderer/MaximumIntensityProjection.cl +139 -0
- fast/kernels/Visualization/VolumeRenderer/ThresholdVolumeRenderer.cl +178 -0
- fast/licenses/LICENSE +203 -0
- fast/licenses/MSVC/MSVC_redis_files_license.txt +96 -0
- fast/licenses/OpenIGTLink/LICENSE.txt +30 -0
- fast/licenses/OpenJPEG/LICENSE +39 -0
- fast/licenses/OpenSlide/COPYING.LESSER +504 -0
- fast/licenses/PCRE2/LICENCE.md +103 -0
- fast/licenses/SQLite/PUBLIC-DOMAIN.txt +9 -0
- fast/licenses/THIRD_PARTY_TF_C_LICENSES +7955 -0
- fast/licenses/cairo/COPYING +33 -0
- fast/licenses/cairo/COPYING-LGPL-2.1 +510 -0
- fast/licenses/cairo/COPYING-MPL-1.1 +470 -0
- fast/licenses/clarius/LICENSE +29 -0
- fast/licenses/dcmtk/COPYRIGHT +1034 -0
- fast/licenses/directml/LICENSE-CODE.txt +21 -0
- fast/licenses/directml/LICENSE.txt +48 -0
- fast/licenses/directml/ThirdPartyNotices.txt +103 -0
- fast/licenses/eigen/COPYING.APACHE +203 -0
- fast/licenses/eigen/COPYING.BSD +26 -0
- fast/licenses/eigen/COPYING.GPL +674 -0
- fast/licenses/eigen/COPYING.LGPL +502 -0
- fast/licenses/eigen/COPYING.MINPACK +51 -0
- fast/licenses/eigen/COPYING.MPL2 +373 -0
- fast/licenses/eigen/COPYING.README +18 -0
- fast/licenses/fast/LICENSE +25 -0
- fast/licenses/gdk-pixbuf/COPYING +502 -0
- fast/licenses/glib/COPYING +175 -0
- fast/licenses/hdf5/COPYING +106 -0
- fast/licenses/jkqtplotter/LICENSE +505 -0
- fast/licenses/jpegxl/LICENSE.brotli +19 -0
- fast/licenses/jpegxl/LICENSE.highway +201 -0
- fast/licenses/jpegxl/LICENSE.jpeg-xl +27 -0
- fast/licenses/jpegxl/LICENSE.skcms +29 -0
- fast/licenses/jpegxl/PATENTS +22 -0
- fast/licenses/libdicom/LICENSE +21 -0
- fast/licenses/libffi/LICENSE +21 -0
- fast/licenses/libjpeg-turbo/LICENSE.md +135 -0
- fast/licenses/libjpeg-turbo/README.ijg +260 -0
- fast/licenses/libpng/LICENSE +134 -0
- fast/licenses/libtiff/LICENSE.md +23 -0
- fast/licenses/libxml2/Copyright +24 -0
- fast/licenses/onnxruntime/LICENSE +21 -0
- fast/licenses/onnxruntime/Privacy.md +21 -0
- fast/licenses/onnxruntime/ThirdPartyNotices.txt +6156 -0
- fast/licenses/opencl/LICENSE +201 -0
- fast/licenses/openssl/LICENSE.txt +125 -0
- fast/licenses/openvino/Apache_license.txt +201 -0
- fast/licenses/openvino/EULA.htm +43 -0
- fast/licenses/openvino/EULA.rtf +61 -0
- fast/licenses/openvino/EULA.txt +163 -0
- fast/licenses/openvino/GNA SOFTWARE LICENSE AGREEMENT.txt +1 -0
- fast/licenses/openvino/Intel_Software_Development_Products.rtf +1217 -0
- fast/licenses/openvino/Intel_Software_Development_Products.txt +707 -0
- fast/licenses/openvino/LICENSE +201 -0
- fast/licenses/openvino/OpenVINOsupport.txt +12 -0
- fast/licenses/openvino/onednn_third-party-programs.txt +557 -0
- fast/licenses/openvino/readme.txt +60 -0
- fast/licenses/openvino/redist.txt +42 -0
- fast/licenses/openvino/runtime-third-party-programs.txt +1400 -0
- fast/licenses/openvino/tbb_third-party-programs.txt +230 -0
- fast/licenses/pixman/COPYING +42 -0
- fast/licenses/proxy-libintl/COPYING +482 -0
- fast/licenses/qt5/LICENSE.FDL +450 -0
- fast/licenses/qt5/LICENSE.GPL3-EXCEPT +704 -0
- fast/licenses/qt5/LICENSE.GPLv2 +292 -0
- fast/licenses/qt5/LICENSE.GPLv3 +686 -0
- fast/licenses/qt5/LICENSE.LGPLv21 +514 -0
- fast/licenses/qt5/LICENSE.LGPLv3 +175 -0
- fast/licenses/qt5/LICENSE.QT-LICENSE-AGREEMENT +1331 -0
- fast/licenses/realsense/LICENSE +202 -0
- fast/licenses/realsense/NOTICE +937 -0
- fast/licenses/semaphore/Semaphore_LICENSE.txt +17 -0
- fast/licenses/tiff/COPYRIGHT +21 -0
- fast/licenses/uthash/LICENSE +21 -0
- fast/licenses/zip/UNLICENSE +26 -0
- fast/licenses/zlib/README +115 -0
- fast/licenses/zlib-ng/LICENSE.md +19 -0
- fast/pipelines/uff_viewer/colormap_and_reject.fpl +26 -0
- fast/pipelines/uff_viewer/default.fpl +9 -0
- fast/pipelines/uff_viewer/non_local_means.fpl +34 -0
- fast/plugins/audio/qtaudio_wasapi.dll +0 -0
- fast/plugins/audio/qtaudio_windows.dll +0 -0
- fast/plugins/bearer/qgenericbearer.dll +0 -0
- fast/plugins/generic/qtuiotouchplugin.dll +0 -0
- fast/plugins/iconengines/qsvgicon.dll +0 -0
- fast/plugins/imageformats/qgif.dll +0 -0
- fast/plugins/imageformats/qicns.dll +0 -0
- fast/plugins/imageformats/qico.dll +0 -0
- fast/plugins/imageformats/qjpeg.dll +0 -0
- fast/plugins/imageformats/qsvg.dll +0 -0
- fast/plugins/imageformats/qtga.dll +0 -0
- fast/plugins/imageformats/qtiff.dll +0 -0
- fast/plugins/imageformats/qwbmp.dll +0 -0
- fast/plugins/imageformats/qwebp.dll +0 -0
- fast/plugins/mediaservice/dsengine.dll +0 -0
- fast/plugins/mediaservice/qtmedia_audioengine.dll +0 -0
- fast/plugins/mediaservice/wmfengine.dll +0 -0
- fast/plugins/platforms/qdirect2d.dll +0 -0
- fast/plugins/platforms/qminimal.dll +0 -0
- fast/plugins/platforms/qoffscreen.dll +0 -0
- fast/plugins/platforms/qwindows.dll +0 -0
- fast/plugins/platformthemes/qxdgdesktopportal.dll +0 -0
- fast/plugins/playlistformats/qtmultimedia_m3u.dll +0 -0
- fast/plugins/printsupport/windowsprintersupport.dll +0 -0
- fast/plugins/sqldrivers/qsqlite.dll +0 -0
- fast/plugins/sqldrivers/qsqlodbc.dll +0 -0
- fast/plugins/styles/qwindowsvistastyle.dll +0 -0
- pyfast-4.12.0.dist-info/METADATA +81 -0
- pyfast-4.12.0.dist-info/RECORD +307 -0
- pyfast-4.12.0.dist-info/WHEEL +5 -0
- pyfast-4.12.0.dist-info/entry_points.txt +5 -0
- pyfast-4.12.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_FILTER_NEAREST | CLK_ADDRESS_NONE;
|
|
2
|
+
|
|
3
|
+
__kernel void flip3D(
|
|
4
|
+
__read_only image3d_t input,
|
|
5
|
+
__global TYPE* output,
|
|
6
|
+
__private char flipHorizontal,
|
|
7
|
+
__private char flipVertical,
|
|
8
|
+
__private char flipDepth,
|
|
9
|
+
__private int channels
|
|
10
|
+
) {
|
|
11
|
+
|
|
12
|
+
int4 posInput = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
13
|
+
int3 targetPos = posInput.xyz;
|
|
14
|
+
int3 size = {get_image_width(input), get_image_height(input), get_image_depth(input)};
|
|
15
|
+
if(flipHorizontal == 1)
|
|
16
|
+
targetPos.x = size.x - posInput.x - 1;
|
|
17
|
+
if(flipVertical == 1)
|
|
18
|
+
targetPos.y = size.y - posInput.y - 1;
|
|
19
|
+
if(flipDepth == 1)
|
|
20
|
+
targetPos.z = size.z - posInput.z - 1;
|
|
21
|
+
|
|
22
|
+
int dataType = get_image_channel_data_type(input);
|
|
23
|
+
if(dataType == CLK_FLOAT) {
|
|
24
|
+
float4 value = read_imagef(input, sampler, posInput);
|
|
25
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels] = value.x;
|
|
26
|
+
if(channels > 1)
|
|
27
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+1] = value.y;
|
|
28
|
+
if(channels > 2)
|
|
29
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+2] = value.z;
|
|
30
|
+
if(channels > 3)
|
|
31
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+3] = value.w;
|
|
32
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
33
|
+
uint4 value = read_imageui(input, sampler, posInput);
|
|
34
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels] = value.x;
|
|
35
|
+
if(channels > 1)
|
|
36
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+1] = value.y;
|
|
37
|
+
if(channels > 2)
|
|
38
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+2] = value.z;
|
|
39
|
+
if(channels > 3)
|
|
40
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+3] = value.w;
|
|
41
|
+
} else {
|
|
42
|
+
int4 value = read_imagei(input, sampler, posInput);
|
|
43
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels] = value.x;
|
|
44
|
+
if(channels > 1)
|
|
45
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+1] = value.y;
|
|
46
|
+
if(channels > 2)
|
|
47
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+2] = value.z;
|
|
48
|
+
if(channels > 3)
|
|
49
|
+
output[(targetPos.x + targetPos.y*size.x + targetPos.z*size.x*size.y)*channels+3] = value.w;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
float readImageAsFloat2D(__read_only image2d_t image, sampler_t sampler, int2 position) {
|
|
5
|
+
int dataType = get_image_channel_data_type(image);
|
|
6
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
7
|
+
return read_imagef(image, sampler, position).x;
|
|
8
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
9
|
+
return (float)read_imagei(image, sampler, position).x;
|
|
10
|
+
} else {
|
|
11
|
+
return (float)read_imageui(image, sampler, position).x;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
float readImageAsFloat3D(__read_only image3d_t image, sampler_t sampler, int4 position) {
|
|
16
|
+
int dataType = get_image_channel_data_type(image);
|
|
17
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
18
|
+
return read_imagef(image, sampler, position).x;
|
|
19
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
20
|
+
return (float)read_imagei(image, sampler, position).x;
|
|
21
|
+
} else {
|
|
22
|
+
return (float)read_imageui(image, sampler, position).x;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
__kernel void gradient2D(
|
|
27
|
+
__read_only image2d_t input,
|
|
28
|
+
__write_only image2d_t output
|
|
29
|
+
) {
|
|
30
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
31
|
+
|
|
32
|
+
// TODO take pixel spacing into account
|
|
33
|
+
float2 gradient = {
|
|
34
|
+
(readImageAsFloat2D(input, sampler, pos+(int2)(1,0)) - readImageAsFloat2D(input, sampler, pos-(int2)(1,0)))*0.5f,
|
|
35
|
+
(readImageAsFloat2D(input, sampler, pos+(int2)(0,1)) - readImageAsFloat2D(input, sampler, pos-(int2)(0,1)))*0.5f
|
|
36
|
+
};
|
|
37
|
+
write_imagef(output, pos, gradient.xyyy);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
#ifdef VECTORS_16BIT
|
|
42
|
+
#define FLOAT_TO_SNORM16_3(vector) convert_short3_sat_rte(vector * 32767.0f)
|
|
43
|
+
#define VECTOR_FIELD_TYPE short
|
|
44
|
+
#else
|
|
45
|
+
#define FLOAT_TO_SNORM16_3(vector) vector
|
|
46
|
+
#define VECTOR_FIELD_TYPE float
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
__kernel void gradient3D(
|
|
50
|
+
__read_only image3d_t input,
|
|
51
|
+
#ifdef fast_3d_image_writes
|
|
52
|
+
__write_only image3d_t output
|
|
53
|
+
#else
|
|
54
|
+
__global VECTOR_FIELD_TYPE* output
|
|
55
|
+
#endif
|
|
56
|
+
) {
|
|
57
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
58
|
+
|
|
59
|
+
// TODO take pixel spacing into account
|
|
60
|
+
float3 gradient = {
|
|
61
|
+
(readImageAsFloat3D(input, sampler, pos+(int4)(1,0,0,0)) - readImageAsFloat3D(input, sampler, pos-(int4)(1,0,0,0)))*0.5f,
|
|
62
|
+
(readImageAsFloat3D(input, sampler, pos+(int4)(0,1,0,0)) - readImageAsFloat3D(input, sampler, pos-(int4)(0,1,0,0)))*0.5f,
|
|
63
|
+
(readImageAsFloat3D(input, sampler, pos+(int4)(0,0,1,0)) - readImageAsFloat3D(input, sampler, pos-(int4)(0,0,1,0)))*0.5f
|
|
64
|
+
};
|
|
65
|
+
#ifdef fast_3d_image_writes
|
|
66
|
+
write_imagef(output, pos, gradient.xyzz);
|
|
67
|
+
#else
|
|
68
|
+
vstore3(FLOAT_TO_SNORM16_3(gradient), pos.x + pos.y*get_global_size(0) + pos.z*get_global_size(0)*get_global_size(1), output);
|
|
69
|
+
#endif
|
|
70
|
+
}
|
|
71
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void invert3D(
|
|
4
|
+
__read_only image3d_t input,
|
|
5
|
+
__global DATA_TYPE* output,
|
|
6
|
+
__private float min,
|
|
7
|
+
__private float max,
|
|
8
|
+
__private uint outputChannels
|
|
9
|
+
) {
|
|
10
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
11
|
+
int dataType = get_image_channel_data_type(input);
|
|
12
|
+
|
|
13
|
+
float4 value;
|
|
14
|
+
if(dataType == CLK_FLOAT) {
|
|
15
|
+
value = read_imagef(input, sampler, pos);
|
|
16
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
17
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
18
|
+
} else {
|
|
19
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
20
|
+
}
|
|
21
|
+
value = (max - min) - value;
|
|
22
|
+
|
|
23
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels] = value.x;
|
|
24
|
+
if(outputChannels > 1)
|
|
25
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 1] = value.y;
|
|
26
|
+
if(outputChannels > 2)
|
|
27
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 2] = value.z;
|
|
28
|
+
if(outputChannels > 3)
|
|
29
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 3] = value.w;
|
|
30
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
float4 readImageAsFloat2D(__read_only image2d_t image, sampler_t sampler, int2 position) {
|
|
4
|
+
int dataType = get_image_channel_data_type(image);
|
|
5
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
6
|
+
return read_imagef(image, sampler, position);
|
|
7
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
8
|
+
return convert_float4(read_imagei(image, sampler, position));
|
|
9
|
+
} else {
|
|
10
|
+
return convert_float4(read_imageui(image, sampler, position));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
void writeImageAsFloat2D(__write_only image2d_t image, int2 position, float4 value) {
|
|
16
|
+
int dataType = get_image_channel_data_type(image);
|
|
17
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
18
|
+
write_imagef(image, position, value);
|
|
19
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
20
|
+
write_imagei(image, position, convert_int4(round(value)));
|
|
21
|
+
} else {
|
|
22
|
+
write_imageui(image, position, convert_uint4(round(value)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
float4 readImageAsFloat3D(__read_only image3d_t image, sampler_t sampler, int4 position) {
|
|
27
|
+
int dataType = get_image_channel_data_type(image);
|
|
28
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
29
|
+
return read_imagef(image, sampler, position);
|
|
30
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
31
|
+
return convert_float4(read_imagei(image, sampler, position));
|
|
32
|
+
} else {
|
|
33
|
+
return convert_float4(read_imageui(image, sampler, position));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
__kernel void multiply3D(
|
|
38
|
+
__read_only image3d_t input1,
|
|
39
|
+
__read_only image3d_t input2,
|
|
40
|
+
__global DATA_TYPE* output,
|
|
41
|
+
__private uint outputChannels
|
|
42
|
+
) {
|
|
43
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
44
|
+
|
|
45
|
+
float4 value1 = readImageAsFloat3D(input1, sampler, pos);
|
|
46
|
+
float4 value2 = readImageAsFloat3D(input2, sampler, pos);
|
|
47
|
+
float4 value = value1*value2;
|
|
48
|
+
|
|
49
|
+
output[(pos.x + pos.y*get_image_width(input1) + pos.z*get_image_width(input1)*get_image_height(input1))*outputChannels] = value.x;
|
|
50
|
+
if(outputChannels > 1)
|
|
51
|
+
output[(pos.x + pos.y*get_image_width(input1) + pos.z*get_image_width(input1)*get_image_height(input1))*outputChannels + 1] = value.y;
|
|
52
|
+
if(outputChannels > 2)
|
|
53
|
+
output[(pos.x + pos.y*get_image_width(input1) + pos.z*get_image_width(input1)*get_image_height(input1))*outputChannels + 2] = value.z;
|
|
54
|
+
if(outputChannels > 3)
|
|
55
|
+
output[(pos.x + pos.y*get_image_width(input1) + pos.z*get_image_width(input1)*get_image_height(input1))*outputChannels + 3] = value.w;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
__kernel void multiply2D(
|
|
59
|
+
__read_only image2d_t input1,
|
|
60
|
+
__read_only image2d_t input2,
|
|
61
|
+
__write_only image2d_t output,
|
|
62
|
+
__private uint input1Channels,
|
|
63
|
+
__private uint input2Channels,
|
|
64
|
+
__private uint outputChannels
|
|
65
|
+
) {
|
|
66
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
67
|
+
|
|
68
|
+
float4 value1 = readImageAsFloat2D(input1, sampler, pos);
|
|
69
|
+
float4 value2 = readImageAsFloat2D(input2, sampler, pos);
|
|
70
|
+
float4 value;
|
|
71
|
+
if(input1Channels == input2Channels) {
|
|
72
|
+
value = value1*value2;
|
|
73
|
+
} else if(input1Channels == 1) {
|
|
74
|
+
value = value1.x*value2;
|
|
75
|
+
} else if(input2Channels == 1) {
|
|
76
|
+
value = value1*value2.x;
|
|
77
|
+
}
|
|
78
|
+
writeImageAsFloat2D(output, pos, value);
|
|
79
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void applyPatch2D(
|
|
4
|
+
__read_only image2d_t patch,
|
|
5
|
+
__write_only image2d_t image,
|
|
6
|
+
__private int startX,
|
|
7
|
+
__private int startY,
|
|
8
|
+
__private int patchOverlapX,
|
|
9
|
+
__private int patchOverlapY
|
|
10
|
+
) {
|
|
11
|
+
const int2 pos = {get_global_id(0), get_global_id(1)}; // Patch pos
|
|
12
|
+
const int2 globalPos = {get_global_id(0) + startX, get_global_id(1) + startY};
|
|
13
|
+
int dataType = get_image_channel_data_type(image);
|
|
14
|
+
int2 offset = {patchOverlapX, patchOverlapY};
|
|
15
|
+
if(dataType == CLK_FLOAT) {
|
|
16
|
+
write_imagef(image, globalPos, read_imagef(patch, sampler, pos + offset));
|
|
17
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
18
|
+
write_imageui(image, globalPos, read_imageui(patch, sampler, pos + offset));
|
|
19
|
+
} else {
|
|
20
|
+
write_imagei(image, globalPos, read_imagei(patch, sampler, pos + offset));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
#ifdef fast_3d_image_writes
|
|
4
|
+
__kernel void applyPatch2Dto3D(
|
|
5
|
+
__read_only image2d_t patch,
|
|
6
|
+
__write_only image3d_t image,
|
|
7
|
+
__private int startX,
|
|
8
|
+
__private int startY,
|
|
9
|
+
__private int startZ
|
|
10
|
+
) {
|
|
11
|
+
const int4 pos = {get_global_id(0) + startX, get_global_id(1) + startY, get_global_id(2) + startZ, 0};
|
|
12
|
+
int dataType = get_image_channel_data_type(image);
|
|
13
|
+
if(dataType == CLK_FLOAT) {
|
|
14
|
+
write_imagef(image, pos, read_imagef(patch, sampler, pos.xy - (int2)(startX, startY)));
|
|
15
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
16
|
+
write_imageui(image, pos, read_imageui(patch, sampler, pos.xy - (int2)(startX, startY)));
|
|
17
|
+
} else {
|
|
18
|
+
write_imagei(image, pos, read_imagei(patch, sampler, pos.xy - (int2)(startX, startY)));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
__kernel void applyPatch3D(
|
|
22
|
+
__read_only image3d_t patch,
|
|
23
|
+
__write_only image3d_t image,
|
|
24
|
+
__private int startX,
|
|
25
|
+
__private int startY,
|
|
26
|
+
__private int startZ
|
|
27
|
+
) {
|
|
28
|
+
const int4 pos = {get_global_id(0) + startX, get_global_id(1) + startY, get_global_id(2) + startZ, 0};
|
|
29
|
+
int dataType = get_image_channel_data_type(image);
|
|
30
|
+
if(dataType == CLK_FLOAT) {
|
|
31
|
+
write_imagef(image, pos, read_imagef(patch, sampler, pos - (int4)(startX, startY, startZ, 0)));
|
|
32
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
33
|
+
write_imageui(image, pos, read_imageui(patch, sampler, pos - (int4)(startX, startY, startZ, 0)));
|
|
34
|
+
} else {
|
|
35
|
+
write_imagei(image, pos, read_imagei(patch, sampler, pos - (int4)(startX, startY, startZ, 0)));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
#else
|
|
39
|
+
__kernel void applyPatch2Dto3D(
|
|
40
|
+
__read_only image2d_t patch,
|
|
41
|
+
__global TYPE* image,
|
|
42
|
+
__private int startX,
|
|
43
|
+
__private int startY,
|
|
44
|
+
__private int startZ,
|
|
45
|
+
__private int width,
|
|
46
|
+
__private int height,
|
|
47
|
+
__private int channels
|
|
48
|
+
) {
|
|
49
|
+
const int4 pos = {get_global_id(0) + startX, get_global_id(1) + startY, get_global_id(2) + startZ, 0};
|
|
50
|
+
int dataType = get_image_channel_data_type(patch);
|
|
51
|
+
float4 value;
|
|
52
|
+
if(dataType == CLK_FLOAT) {
|
|
53
|
+
value = read_imagef(patch, sampler, pos.xy - (int2)(startX, startY));
|
|
54
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
55
|
+
value = convert_float4(read_imageui(patch, sampler, pos.xy - (int2)(startX, startY)));
|
|
56
|
+
} else {
|
|
57
|
+
value = convert_float4(read_imagei(patch, sampler, pos.xy - (int2)(startX, startY)));
|
|
58
|
+
}
|
|
59
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels] = value.x;
|
|
60
|
+
if(channels > 1)
|
|
61
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 1] = value.y;
|
|
62
|
+
if(channels > 2)
|
|
63
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 2] = value.z;
|
|
64
|
+
if(channels > 3)
|
|
65
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 3] = value.w;
|
|
66
|
+
}
|
|
67
|
+
__kernel void applyPatch3D(
|
|
68
|
+
__read_only image3d_t patch,
|
|
69
|
+
__global TYPE* image,
|
|
70
|
+
__private int startX,
|
|
71
|
+
__private int startY,
|
|
72
|
+
__private int startZ,
|
|
73
|
+
__private int width,
|
|
74
|
+
__private int height,
|
|
75
|
+
__private int channels
|
|
76
|
+
) {
|
|
77
|
+
const int4 pos = {get_global_id(0) + startX, get_global_id(1) + startY, get_global_id(2) + startZ, 0};
|
|
78
|
+
int dataType = get_image_channel_data_type(patch);
|
|
79
|
+
float4 value;
|
|
80
|
+
if(dataType == CLK_FLOAT) {
|
|
81
|
+
value = read_imagef(patch, sampler, pos - (int4)(startX, startY, startZ, 0));
|
|
82
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
83
|
+
value = convert_float4(read_imageui(patch, sampler, pos - (int4)(startX, startY, startZ, 0)));
|
|
84
|
+
} else {
|
|
85
|
+
value = convert_float4(read_imagei(patch, sampler, pos - (int4)(startX, startY, startZ, 0)));
|
|
86
|
+
}
|
|
87
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels] = value.x;
|
|
88
|
+
if(channels > 1)
|
|
89
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 1] = value.y;
|
|
90
|
+
if(channels > 2)
|
|
91
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 2] = value.z;
|
|
92
|
+
if(channels > 3)
|
|
93
|
+
image[(pos.x + pos.y*width + pos.z*width*height)*channels + 3] = value.w;
|
|
94
|
+
}
|
|
95
|
+
#endif
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
__constant sampler_t samplerLinear = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
|
|
2
|
+
__constant sampler_t samplerNearest = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
|
3
|
+
|
|
4
|
+
float4 readImageAsFloat2D(__read_only image2d_t image, sampler_t sampler, float2 position) {
|
|
5
|
+
int dataType = get_image_channel_data_type(image);
|
|
6
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
7
|
+
return read_imagef(image, sampler, position);
|
|
8
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
9
|
+
return convert_float4(read_imagei(image, sampler, position));
|
|
10
|
+
} else {
|
|
11
|
+
return convert_float4(read_imageui(image, sampler, position));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
__kernel void resample2D(
|
|
16
|
+
__read_only image2d_t input,
|
|
17
|
+
__write_only image2d_t output,
|
|
18
|
+
__private float scaleX,
|
|
19
|
+
__private float scaleY,
|
|
20
|
+
__private uchar useInterpolation
|
|
21
|
+
) {
|
|
22
|
+
const int2 outputPosition = {get_global_id(0), get_global_id(1)};
|
|
23
|
+
const int2 size = {get_global_size(0), get_global_size(1)};
|
|
24
|
+
float2 inputPosition = {outputPosition.x*(1.0f/scaleX), outputPosition.y*(1.0f/scaleY)};
|
|
25
|
+
|
|
26
|
+
int dataType = get_image_channel_data_type(output);
|
|
27
|
+
float4 value;
|
|
28
|
+
if(useInterpolation == 1) {
|
|
29
|
+
value = readImageAsFloat2D(input, samplerLinear, inputPosition);
|
|
30
|
+
} else {
|
|
31
|
+
value = readImageAsFloat2D(input, samplerNearest, inputPosition);
|
|
32
|
+
}
|
|
33
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
34
|
+
write_imagef(output, outputPosition, value);
|
|
35
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
36
|
+
write_imagei(output, outputPosition, convert_int4(round(value)));
|
|
37
|
+
} else {
|
|
38
|
+
write_imageui(output, outputPosition, convert_uint4(round(value)));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
__constant sampler_t samplerLinear = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_LINEAR;
|
|
2
|
+
__constant sampler_t samplerNearest = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
3
|
+
|
|
4
|
+
float readImageAsFloat3D(__read_only image3d_t image, sampler_t sampler, float4 position) {
|
|
5
|
+
int dataType = get_image_channel_data_type(image);
|
|
6
|
+
if(dataType == CLK_FLOAT || dataType == CLK_SNORM_INT16 || dataType == CLK_UNORM_INT16) {
|
|
7
|
+
return read_imagef(image, sampler, position).x;
|
|
8
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
9
|
+
return (float)read_imagei(image, sampler, position).x;
|
|
10
|
+
} else {
|
|
11
|
+
return (float)read_imageui(image, sampler, position).x;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
__kernel void resample3D(
|
|
16
|
+
__read_only image3d_t input,
|
|
17
|
+
__global OUTPUT_TYPE* output,
|
|
18
|
+
__private float scaleX,
|
|
19
|
+
__private float scaleY,
|
|
20
|
+
__private float scaleZ,
|
|
21
|
+
__private uchar useInterpolation
|
|
22
|
+
) {
|
|
23
|
+
const int4 outputPosition = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
24
|
+
const int3 size = {get_global_size(0), get_global_size(1), get_global_size(2)};
|
|
25
|
+
float4 inputPosition = {outputPosition.x*(1.0f/scaleX), outputPosition.y*(1.0f/scaleY), outputPosition.z*(1.0f/scaleZ), 0};
|
|
26
|
+
|
|
27
|
+
if(useInterpolation == 1) {
|
|
28
|
+
output[outputPosition.x + outputPosition.y*size.x + outputPosition.z*size.x*size.y] = readImageAsFloat3D(input, samplerLinear, inputPosition);
|
|
29
|
+
} else {
|
|
30
|
+
output[outputPosition.x + outputPosition.y*size.x + outputPosition.z*size.x*size.y] = readImageAsFloat3D(input, samplerNearest, inputPosition);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
__constant sampler_t samplerLinear = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;
|
|
2
|
+
__constant sampler_t samplerNearest = CLK_NORMALIZED_COORDS_TRUE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
|
3
|
+
|
|
4
|
+
void writeToImage(__write_only image2d_t input, int2 position, float4 value) {
|
|
5
|
+
int dataType = get_image_channel_data_type(input);
|
|
6
|
+
if(dataType == CLK_FLOAT) {
|
|
7
|
+
write_imagef(input, position, value);
|
|
8
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
9
|
+
write_imageui(input, position, convert_uint4(value));
|
|
10
|
+
} else {
|
|
11
|
+
write_imagei(input, position, convert_int4(value));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
float4 readFromImage(__read_only image2d_t input, sampler_t sampler, float2 position) {
|
|
16
|
+
int dataType = get_image_channel_data_type(input);
|
|
17
|
+
if(dataType == CLK_FLOAT) {
|
|
18
|
+
return read_imagef(input, sampler, position);
|
|
19
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
20
|
+
return convert_float4(read_imageui(input, sampler, position));
|
|
21
|
+
} else {
|
|
22
|
+
return convert_float4(read_imagei(input, sampler, position));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
__kernel void resize2DpreserveAspect(
|
|
27
|
+
__read_only image2d_t input,
|
|
28
|
+
__write_only image2d_t output,
|
|
29
|
+
__private int newHeight,
|
|
30
|
+
__private char useInterpolation
|
|
31
|
+
) {
|
|
32
|
+
const int2 position = {get_global_id(0), get_global_id(1)};
|
|
33
|
+
const float scale = (float)newHeight / get_image_height(input);
|
|
34
|
+
const float2 readPosition = {((float)position.x + 0.5f) / get_global_size(0), ((float)position.y + 0.5f) / (scale*get_image_height(input))};
|
|
35
|
+
float4 value;
|
|
36
|
+
if(useInterpolation == 1) {
|
|
37
|
+
value = readFromImage(input, samplerLinear, readPosition);
|
|
38
|
+
} else {
|
|
39
|
+
value = readFromImage(input, samplerNearest, readPosition);
|
|
40
|
+
}
|
|
41
|
+
if(position.y >= newHeight) {
|
|
42
|
+
writeToImage(output, position, (float4)(0,0,0,0));
|
|
43
|
+
} else {
|
|
44
|
+
writeToImage(output, position, value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
__kernel void resize2D(
|
|
49
|
+
__read_only image2d_t input,
|
|
50
|
+
__write_only image2d_t output,
|
|
51
|
+
__private char useInterpolation
|
|
52
|
+
) {
|
|
53
|
+
const int2 position = {get_global_id(0), get_global_id(1)};
|
|
54
|
+
const float2 normalizedPosition = {(float)(position.x + 0.5f) / get_global_size(0), (float)(position.y + 0.5f) / get_global_size(1)};
|
|
55
|
+
int dataType = get_image_channel_data_type(input);
|
|
56
|
+
float4 value;
|
|
57
|
+
if(useInterpolation == 1) {
|
|
58
|
+
value = readFromImage(input, samplerLinear, normalizedPosition);
|
|
59
|
+
} else {
|
|
60
|
+
value = readFromImage(input, samplerNearest, normalizedPosition);
|
|
61
|
+
}
|
|
62
|
+
writeToImage(output, position, value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ================ 3D
|
|
66
|
+
#ifdef fast_3d_image_writes
|
|
67
|
+
void writeToImage3D(__write_only image3d_t input, int4 position, float4 value) {
|
|
68
|
+
int dataType = get_image_channel_data_type(input);
|
|
69
|
+
if(dataType == CLK_FLOAT) {
|
|
70
|
+
write_imagef(input, position, value);
|
|
71
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
72
|
+
write_imageui(input, position, convert_uint4(value));
|
|
73
|
+
} else {
|
|
74
|
+
write_imagei(input, position, convert_int4(value));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
float4 readFromImage3D(__read_only image3d_t input, sampler_t sampler, float4 position) {
|
|
80
|
+
int dataType = get_image_channel_data_type(input);
|
|
81
|
+
if(dataType == CLK_FLOAT) {
|
|
82
|
+
return read_imagef(input, sampler, position);
|
|
83
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
84
|
+
return convert_float4(read_imageui(input, sampler, position));
|
|
85
|
+
} else {
|
|
86
|
+
return convert_float4(read_imagei(input, sampler, position));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
__kernel void resize3D(
|
|
91
|
+
__read_only image3d_t input,
|
|
92
|
+
#ifdef fast_3d_image_writes
|
|
93
|
+
__write_only image3d_t output,
|
|
94
|
+
#else
|
|
95
|
+
__global void* output,
|
|
96
|
+
#endif
|
|
97
|
+
__private char useInterpolation
|
|
98
|
+
) {
|
|
99
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
100
|
+
const float4 normalizedPosition = {
|
|
101
|
+
((float)pos.x + 0.5f) / get_global_size(0),
|
|
102
|
+
((float)pos.y + 0.5f) / get_global_size(1),
|
|
103
|
+
((float)pos.z + 0.5f) / get_global_size(2),
|
|
104
|
+
0
|
|
105
|
+
};
|
|
106
|
+
int dataType = get_image_channel_data_type(input);
|
|
107
|
+
float4 value;
|
|
108
|
+
if(useInterpolation == 1) {
|
|
109
|
+
value = readFromImage3D(input, samplerLinear, normalizedPosition);
|
|
110
|
+
} else {
|
|
111
|
+
value = readFromImage3D(input, samplerNearest, normalizedPosition);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#ifdef fast_3d_image_writes
|
|
115
|
+
writeToImage3D(output, pos, value);
|
|
116
|
+
#else
|
|
117
|
+
// TODO only one channel supported atm
|
|
118
|
+
if(dataType == CLK_UNSIGNED_INT8) {
|
|
119
|
+
((__global uchar*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
120
|
+
} else if(dataType == CLK_SIGNED_INT8) {
|
|
121
|
+
((__global char*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
122
|
+
} else if(dataType == CLK_UNSIGNED_INT16) {
|
|
123
|
+
((__global ushort*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
124
|
+
} else if(dataType == CLK_SIGNED_INT16) {
|
|
125
|
+
((__global short*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
126
|
+
} else if(dataType == CLK_UNSIGNED_INT32) {
|
|
127
|
+
((__global uint*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
128
|
+
} else if(dataType == CLK_SIGNED_INT32) {
|
|
129
|
+
((__global int*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
130
|
+
} else if(dataType == CLK_FLOAT) {
|
|
131
|
+
((__global float*)output)[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value.x;
|
|
132
|
+
}
|
|
133
|
+
#endif
|
|
134
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void sharpen(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private float stdDev,
|
|
7
|
+
__private float gain
|
|
8
|
+
) {
|
|
9
|
+
|
|
10
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
11
|
+
|
|
12
|
+
float4 sum = {0.0f, 0.0f, 0.0f, 0.0f};
|
|
13
|
+
float gaussianSum = 0.0f;
|
|
14
|
+
const int dataType = get_image_channel_data_type(input);
|
|
15
|
+
for(int x = -HALF_SIZE; x <= HALF_SIZE; ++x) {
|
|
16
|
+
for(int y = -HALF_SIZE; y <= HALF_SIZE; ++y) {
|
|
17
|
+
const int2 offset = {x,y};
|
|
18
|
+
const float gaussian = exp(-(float)(x*x+y*y)/(2.0f*stdDev*stdDev));
|
|
19
|
+
gaussianSum += gaussian;
|
|
20
|
+
if(dataType == CLK_FLOAT) {
|
|
21
|
+
sum += gaussian*read_imagef(input, sampler, pos+offset);
|
|
22
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
23
|
+
sum += gaussian*convert_float4(read_imageui(input, sampler, pos+offset));
|
|
24
|
+
} else {
|
|
25
|
+
sum += gaussian*convert_float4(read_imagei(input, sampler, pos+offset));
|
|
26
|
+
}
|
|
27
|
+
}}
|
|
28
|
+
float4 pixel;
|
|
29
|
+
if(dataType == CLK_FLOAT) {
|
|
30
|
+
pixel = read_imagef(input, sampler, pos);
|
|
31
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
32
|
+
pixel = convert_float4(read_imageui(input, sampler, pos));
|
|
33
|
+
} else {
|
|
34
|
+
pixel = convert_float4(read_imagei(input, sampler, pos));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
float4 result = pixel + gain*(pixel - sum/gaussianSum);
|
|
38
|
+
|
|
39
|
+
const int outputDataType = get_image_channel_data_type(output);
|
|
40
|
+
if(outputDataType == CLK_FLOAT) {
|
|
41
|
+
write_imagef(output, pos, result);
|
|
42
|
+
} else if(outputDataType == CLK_UNSIGNED_INT8 || outputDataType == CLK_UNSIGNED_INT16 || outputDataType == CLK_UNSIGNED_INT32) {
|
|
43
|
+
write_imageui(output, pos, convert_uint4(round(result)));
|
|
44
|
+
} else {
|
|
45
|
+
write_imagei(output, pos, convert_int4(round(result)));
|
|
46
|
+
}
|
|
47
|
+
}
|