pyfast 4.12.0__cp36-abi3-macosx_10_13_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fast/README.md +41 -0
- fast/__init__.py +22 -0
- fast/bin/UFFviewer +0 -0
- fast/bin/fast_configuration.txt +14 -0
- fast/bin/runPipeline +0 -0
- fast/bin/systemCheck +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 +19961 -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/lib/_fast.abi3.so +0 -0
- fast/lib/libFAST.4.dylib +0 -0
- fast/lib/libInferenceEngineONNXRuntime.dylib +0 -0
- fast/lib/libInferenceEngineOpenVINO.dylib +0 -0
- fast/lib/libInferenceEngineTensorFlow.dylib +0 -0
- fast/lib/libJKQTCommonSharedLib_Release.4.0.0.dylib +0 -0
- fast/lib/libJKQTFastPlotterSharedLib_Release.4.0.0.dylib +0 -0
- fast/lib/libJKQTMathTextSharedLib_Release.4.0.0.dylib +0 -0
- fast/lib/libJKQTPlotterSharedLib_Release.4.0.0.dylib +0 -0
- fast/lib/libOpenIGTLink.3.dylib +0 -0
- fast/lib/libQt5Core.5.dylib +0 -0
- fast/lib/libQt5DBus.5.dylib +0 -0
- fast/lib/libQt5Gui.5.dylib +0 -0
- fast/lib/libQt5Multimedia.5.dylib +0 -0
- fast/lib/libQt5MultimediaWidgets.5.dylib +0 -0
- fast/lib/libQt5Network.5.dylib +0 -0
- fast/lib/libQt5OpenGL.5.dylib +0 -0
- fast/lib/libQt5PrintSupport.5.dylib +0 -0
- fast/lib/libQt5SerialPort.5.dylib +0 -0
- fast/lib/libQt5Svg.5.dylib +0 -0
- fast/lib/libQt5Widgets.5.dylib +0 -0
- fast/lib/libQt5Xml.5.dylib +0 -0
- fast/lib/libbrotlicommon.1.dylib +0 -0
- fast/lib/libbrotlidec.1.dylib +0 -0
- fast/lib/libbrotlienc.1.dylib +0 -0
- fast/lib/libdcmdata.17.dylib +0 -0
- fast/lib/libdcmimage.17.dylib +0 -0
- fast/lib/libdcmimgle.17.dylib +0 -0
- fast/lib/libdcmjpeg.17.dylib +0 -0
- fast/lib/libijg12.17.dylib +0 -0
- fast/lib/libijg12.dylib +0 -0
- fast/lib/libijg16.17.dylib +0 -0
- fast/lib/libijg16.dylib +0 -0
- fast/lib/libijg8.17.dylib +0 -0
- fast/lib/libijg8.dylib +0 -0
- fast/lib/libjxl.0.11.dylib +0 -0
- fast/lib/libjxl_cms.0.11.dylib +0 -0
- fast/lib/libjxl_threads.0.11.dylib +0 -0
- fast/lib/liboflog.17.dylib +0 -0
- fast/lib/libofstd.17.dylib +0 -0
- fast/lib/libonnxruntime.1.14.0.dylib +0 -0
- fast/lib/libonnxruntime.dylib +0 -0
- fast/lib/libopenslide.1.dylib +0 -0
- fast/lib/libopenvino.2230.dylib +0 -0
- fast/lib/libopenvino_auto_batch_plugin.so +0 -0
- fast/lib/libopenvino_auto_plugin.so +0 -0
- fast/lib/libopenvino_gapi_preproc.so +0 -0
- fast/lib/libopenvino_hetero_plugin.so +0 -0
- fast/lib/libopenvino_intel_cpu_plugin.so +0 -0
- fast/lib/libopenvino_ir_frontend.2230.dylib +0 -0
- fast/lib/libopenvino_onnx_frontend.2230.dylib +0 -0
- fast/lib/libopenvino_paddle_frontend.2230.dylib +0 -0
- fast/lib/libopenvino_tensorflow_frontend.2230.dylib +0 -0
- fast/lib/libtbb.dylib +0 -0
- fast/lib/libz.1.dylib +0 -0
- fast/lib/plugins.xml +16 -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/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/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/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/onnxruntime/LICENSE +21 -0
- fast/licenses/onnxruntime/Privacy.md +21 -0
- fast/licenses/onnxruntime/ThirdPartyNotices.txt +5786 -0
- fast/licenses/opencl/LICENSE +201 -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/semaphore/Semaphore_LICENSE.txt +17 -0
- fast/licenses/tensorflow/LICENSE +203 -0
- fast/licenses/tensorflow/THIRD_PARTY_TF_C_LICENSES +8963 -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/libqtaudio_coreaudio.dylib +0 -0
- fast/plugins/bearer/libqgenericbearer.dylib +0 -0
- fast/plugins/generic/libqtuiotouchplugin.dylib +0 -0
- fast/plugins/iconengines/libqsvgicon.dylib +0 -0
- fast/plugins/imageformats/libqgif.dylib +0 -0
- fast/plugins/imageformats/libqicns.dylib +0 -0
- fast/plugins/imageformats/libqico.dylib +0 -0
- fast/plugins/imageformats/libqjpeg.dylib +0 -0
- fast/plugins/imageformats/libqmacheif.dylib +0 -0
- fast/plugins/imageformats/libqmacjp2.dylib +0 -0
- fast/plugins/imageformats/libqsvg.dylib +0 -0
- fast/plugins/imageformats/libqtga.dylib +0 -0
- fast/plugins/imageformats/libqtiff.dylib +0 -0
- fast/plugins/imageformats/libqwbmp.dylib +0 -0
- fast/plugins/imageformats/libqwebp.dylib +0 -0
- fast/plugins/mediaservice/libqavfcamera.dylib +0 -0
- fast/plugins/mediaservice/libqavfmediaplayer.dylib +0 -0
- fast/plugins/mediaservice/libqtmedia_audioengine.dylib +0 -0
- fast/plugins/platforms/libqcocoa.dylib +0 -0
- fast/plugins/platforms/libqminimal.dylib +0 -0
- fast/plugins/platforms/libqoffscreen.dylib +0 -0
- fast/plugins/platformthemes/libqxdgdesktopportal.dylib +0 -0
- fast/plugins/playlistformats/libqtmultimedia_m3u.dylib +0 -0
- fast/plugins/printsupport/libcocoaprintersupport.dylib +0 -0
- fast/plugins/sqldrivers/libqsqlite.dylib +0 -0
- fast/plugins/styles/libqmacstyle.dylib +0 -0
- pyfast-4.12.0.dist-info/METADATA +81 -0
- pyfast-4.12.0.dist-info/RECORD +279 -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,31 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
__kernel void lineSearch(
|
|
5
|
+
__read_only image2d_t image,
|
|
6
|
+
__global uint* rays
|
|
7
|
+
) {
|
|
8
|
+
|
|
9
|
+
const int i = get_global_id(0);
|
|
10
|
+
uint result = 0;
|
|
11
|
+
const int width = get_image_width(image);
|
|
12
|
+
const int height = get_image_height(image);
|
|
13
|
+
|
|
14
|
+
if(i < width) {
|
|
15
|
+
for(int y = height/6; y < height*5/6; ++y) {
|
|
16
|
+
int2 position = {i, y};
|
|
17
|
+
if(read_imageui(image, sampler, position).x > 0) {
|
|
18
|
+
result += 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
for(int x = width/6; x < width*5/6; ++x) {
|
|
23
|
+
int2 position = {x, i - width};
|
|
24
|
+
if(read_imageui(image, sampler, position).x > 0) {
|
|
25
|
+
result += 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
rays[i] = result;
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void enhance(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private int reject
|
|
7
|
+
) {
|
|
8
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
9
|
+
|
|
10
|
+
float intensity = (float)read_imageui(input, sampler, pos).x;
|
|
11
|
+
if(intensity < reject)
|
|
12
|
+
intensity = 0.0f;
|
|
13
|
+
// Apply a nonlinear S-curve
|
|
14
|
+
float k = -0.2;
|
|
15
|
+
intensity = (intensity/255.0f)*2.0f-1.0f;
|
|
16
|
+
uchar value = (uchar)round(255*(((intensity - k*intensity)/(k - 2*k*fabs(intensity)+1))+1.0f)/2.0f);
|
|
17
|
+
//uchar value = intensity;
|
|
18
|
+
uint4 color = {value, value, value, 255};
|
|
19
|
+
// Apply a hint of blue
|
|
20
|
+
if(value > 0) {
|
|
21
|
+
color.y -= 1;
|
|
22
|
+
color.z += 4;
|
|
23
|
+
}
|
|
24
|
+
color = clamp(color, (uint)0, (uint)255);
|
|
25
|
+
|
|
26
|
+
write_imageui(output, pos, color);
|
|
27
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void vectorMedianFilter(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private int windowHalf
|
|
7
|
+
) {
|
|
8
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
9
|
+
|
|
10
|
+
float2 bestVector;
|
|
11
|
+
float bestSum = FLT_MAX;
|
|
12
|
+
for(int y = -windowHalf; y <= windowHalf; ++y) {
|
|
13
|
+
for(int x = -windowHalf; x <= windowHalf; ++x) {
|
|
14
|
+
float2 a_m = read_imagef(input, sampler, pos + (int2)(x, y)).xy;
|
|
15
|
+
float sum = 0.0f;
|
|
16
|
+
for(int y2 = -windowHalf; y2 <= windowHalf; ++y2) {
|
|
17
|
+
for(int x2 = -windowHalf; x2 <= windowHalf; ++x2) {
|
|
18
|
+
float2 a_i = read_imagef(input, sampler, pos + (int2)(x2, y2)).xy;
|
|
19
|
+
//sum += dot(fabs(a_m - a_i), (float2)(1,1)); // L1 norm
|
|
20
|
+
sum += length(a_m - a_i); // L2 norm
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if(sum < bestSum) {
|
|
24
|
+
bestVector = a_m;
|
|
25
|
+
bestSum = sum;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
write_imagef(output, pos, bestVector.xyyy);
|
|
31
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
__kernel void fillImage2D(
|
|
2
|
+
__write_only image2d_t image,
|
|
3
|
+
__private float value
|
|
4
|
+
) {
|
|
5
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
6
|
+
int dataType = get_image_channel_data_type(image);
|
|
7
|
+
if(dataType == CLK_FLOAT) {
|
|
8
|
+
write_imagef(image, pos, (float4)(value, value, value, value));
|
|
9
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
10
|
+
write_imagei(image, pos, (int4)(value, value, value, value));
|
|
11
|
+
} else {
|
|
12
|
+
write_imageui(image, pos, (uint4)(value, value, value, value));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
__kernel void fillImage3D(
|
|
18
|
+
__write_only image3d_t image,
|
|
19
|
+
float value) {
|
|
20
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
21
|
+
int dataType = get_image_channel_data_type(image);
|
|
22
|
+
if(dataType == CLK_FLOAT) {
|
|
23
|
+
write_imagef(image, pos, (float4)(value, value, value, value));
|
|
24
|
+
} else if(dataType == CLK_SIGNED_INT8 || dataType == CLK_SIGNED_INT16 || dataType == CLK_SIGNED_INT32) {
|
|
25
|
+
write_imagei(image, pos, (int4)(value, value, value, value));
|
|
26
|
+
} else {
|
|
27
|
+
write_imageui(image, pos, (uint4)(value, value, value, value));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
*/
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
|
|
2
|
+
#ifdef TYPE_FLOAT
|
|
3
|
+
#define TYPE float4
|
|
4
|
+
#define BUFFER_TYPE float
|
|
5
|
+
#define READ_IMAGE read_imagef
|
|
6
|
+
#define WRITE_IMAGE write_imagef
|
|
7
|
+
#define MAX_VALUE FLT_MAX
|
|
8
|
+
#define MIN_VALUE FLT_MIN
|
|
9
|
+
#elif TYPE_UINT8
|
|
10
|
+
#define TYPE uint4
|
|
11
|
+
#define BUFFER_TYPE uchar
|
|
12
|
+
#define READ_IMAGE read_imageui
|
|
13
|
+
#define WRITE_IMAGE write_imageui
|
|
14
|
+
#define MAX_VALUE UCHAR_MAX
|
|
15
|
+
#define MIN_VALUE 0
|
|
16
|
+
#elif TYPE_INT8
|
|
17
|
+
#define TYPE int4
|
|
18
|
+
#define BUFFER_TYPE char
|
|
19
|
+
#define READ_IMAGE read_imagei
|
|
20
|
+
#define WRITE_IMAGE write_imagei
|
|
21
|
+
#define MAX_VALUE CHAR_MAX
|
|
22
|
+
#define MIN_VALUE CHAR_MIN
|
|
23
|
+
#elif TYPE_UINT16
|
|
24
|
+
#define TYPE uint4
|
|
25
|
+
#define BUFFER_TYPE ushort
|
|
26
|
+
#define READ_IMAGE read_imageui
|
|
27
|
+
#define WRITE_IMAGE write_imageui
|
|
28
|
+
#define MAX_VALUE USHRT_MAX
|
|
29
|
+
#define MIN_VALUE 0
|
|
30
|
+
#elif TYPE_INT16
|
|
31
|
+
#define TYPE int4
|
|
32
|
+
#define BUFFER_TYPE short
|
|
33
|
+
#define READ_IMAGE read_imagei
|
|
34
|
+
#define WRITE_IMAGE write_imagei
|
|
35
|
+
#define MAX_VALUE SHRT_MAX
|
|
36
|
+
#define MIN_VALUE SHRT_MIN
|
|
37
|
+
#elif TYPE_UINT32
|
|
38
|
+
#define TYPE uint4
|
|
39
|
+
#define BUFFER_TYPE uint
|
|
40
|
+
#define READ_IMAGE read_imageui
|
|
41
|
+
#define WRITE_IMAGE write_imageui
|
|
42
|
+
#define MAX_VALUE UINT_MAX
|
|
43
|
+
#define MIN_VALUE 0
|
|
44
|
+
#else
|
|
45
|
+
#define TYPE int4
|
|
46
|
+
#define BUFFER_TYPE int
|
|
47
|
+
#define READ_IMAGE read_imagei
|
|
48
|
+
#define WRITE_IMAGE write_imagei
|
|
49
|
+
#define MAX_VALUE INT_MAX
|
|
50
|
+
#define MIN_VALUE INT_MIN
|
|
51
|
+
#endif
|
|
52
|
+
|
|
53
|
+
__constant int2 offset2D[4] = {
|
|
54
|
+
{0,0},
|
|
55
|
+
{0,1},
|
|
56
|
+
{1,0},
|
|
57
|
+
{1,1}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
__constant int4 offset3D[8] = {
|
|
61
|
+
{0,0,0,0},
|
|
62
|
+
{1,0,0,0},
|
|
63
|
+
{0,1,0,0},
|
|
64
|
+
{0,0,1,0},
|
|
65
|
+
{1,0,1,0},
|
|
66
|
+
{1,1,1,0},
|
|
67
|
+
{0,1,1,0},
|
|
68
|
+
{1,1,0,0}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
72
|
+
|
|
73
|
+
__kernel void createFirstMinMaxImage2DLevel(
|
|
74
|
+
__read_only image2d_t image,
|
|
75
|
+
__write_only image2d_t firstLevel
|
|
76
|
+
) {
|
|
77
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
78
|
+
const int2 readPos = pos*2;
|
|
79
|
+
const int2 size = {get_image_width(image), get_image_height(image)};
|
|
80
|
+
|
|
81
|
+
TYPE result = {MAX_VALUE, MIN_VALUE,0,0};
|
|
82
|
+
for(int i = 0; i < 4; i++) {
|
|
83
|
+
TYPE temp;
|
|
84
|
+
temp = READ_IMAGE(image, sampler, select((int2)(0,0), readPos+offset2D[i], readPos+offset2D[i] < size));
|
|
85
|
+
result.x = min(result.x, temp.x);
|
|
86
|
+
result.y = max(result.y, temp.x);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
WRITE_IMAGE(firstLevel, pos, result);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
__kernel void createMinMaxImage2DLevel(
|
|
93
|
+
__read_only image2d_t readLevel,
|
|
94
|
+
__write_only image2d_t writeLevel
|
|
95
|
+
) {
|
|
96
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
97
|
+
const int2 readPos = pos*2;
|
|
98
|
+
|
|
99
|
+
TYPE result = {MAX_VALUE, MIN_VALUE,0,0};
|
|
100
|
+
TYPE temp;
|
|
101
|
+
temp = READ_IMAGE(readLevel, sampler, readPos + offset2D[0]);
|
|
102
|
+
result.x = min(result.x, temp.x);
|
|
103
|
+
result.y = max(result.y, temp.y);
|
|
104
|
+
temp = READ_IMAGE(readLevel, sampler, readPos + offset2D[1]);
|
|
105
|
+
result.x = min(result.x, temp.x);
|
|
106
|
+
result.y = max(result.y, temp.y);
|
|
107
|
+
temp = READ_IMAGE(readLevel, sampler, readPos + offset2D[2]);
|
|
108
|
+
result.x = min(result.x, temp.x);
|
|
109
|
+
result.y = max(result.y, temp.y);
|
|
110
|
+
temp = READ_IMAGE(readLevel, sampler, readPos + offset2D[3]);
|
|
111
|
+
result.x = min(result.x, temp.x);
|
|
112
|
+
result.y = max(result.y, temp.y);
|
|
113
|
+
|
|
114
|
+
WRITE_IMAGE(writeLevel, pos, result);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#ifdef fast_3d_image_writes
|
|
118
|
+
__kernel void createFirstMinMaxImage3DLevel(
|
|
119
|
+
__read_only image3d_t image,
|
|
120
|
+
__write_only image3d_t firstLevel
|
|
121
|
+
) {
|
|
122
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
123
|
+
const int4 readPos = pos*2;
|
|
124
|
+
const int4 size = {get_image_width(image), get_image_height(image), get_image_depth(image), 1};
|
|
125
|
+
|
|
126
|
+
TYPE result = {MAX_VALUE, MIN_VALUE,0,0};
|
|
127
|
+
for(int i = 0; i < 8; i++) {
|
|
128
|
+
TYPE temp;
|
|
129
|
+
temp = READ_IMAGE(image, sampler, select((int4)(0,0,0,0), readPos+offset3D[i], readPos+offset3D[i] < size));
|
|
130
|
+
result.x = min(result.x, temp.x);
|
|
131
|
+
result.y = max(result.y, temp.x);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
WRITE_IMAGE(firstLevel, pos, result);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
__kernel void createMinMaxImage3DLevel(
|
|
138
|
+
__read_only image3d_t readLevel,
|
|
139
|
+
__write_only image3d_t writeLevel
|
|
140
|
+
) {
|
|
141
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
142
|
+
const int4 readPos = pos*2;
|
|
143
|
+
|
|
144
|
+
TYPE result = {MAX_VALUE, MIN_VALUE,0,0};
|
|
145
|
+
for(int i = 0; i < 8; i++) {
|
|
146
|
+
TYPE temp;
|
|
147
|
+
temp = READ_IMAGE(readLevel, sampler, readPos + offset3D[i]);
|
|
148
|
+
result.x = min(result.x, temp.x);
|
|
149
|
+
result.y = max(result.y, temp.y);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
WRITE_IMAGE(writeLevel, pos, result);
|
|
154
|
+
}
|
|
155
|
+
#endif
|
|
156
|
+
|
|
157
|
+
__kernel void reduce(
|
|
158
|
+
__global BUFFER_TYPE* buffer,
|
|
159
|
+
__local BUFFER_TYPE* minScratch,
|
|
160
|
+
__local BUFFER_TYPE* maxScratch,
|
|
161
|
+
__private int length,
|
|
162
|
+
__private int X,
|
|
163
|
+
__global BUFFER_TYPE* result) {
|
|
164
|
+
|
|
165
|
+
int global_index = get_global_id(0)*X;
|
|
166
|
+
BUFFER_TYPE minAccumulator = MAX_VALUE;
|
|
167
|
+
BUFFER_TYPE maxAccumulator = MIN_VALUE;
|
|
168
|
+
// Loop sequentially over chunks of input vector
|
|
169
|
+
for(int i = 0; i < X && global_index < length; i++) {
|
|
170
|
+
float element = buffer[global_index];
|
|
171
|
+
minAccumulator = (minAccumulator < element) ? minAccumulator : element;
|
|
172
|
+
maxAccumulator = (maxAccumulator > element) ? maxAccumulator : element;
|
|
173
|
+
global_index += 1;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Perform parallel reduction
|
|
177
|
+
int local_index = get_local_id(0);
|
|
178
|
+
minScratch[local_index] = minAccumulator;
|
|
179
|
+
maxScratch[local_index] = maxAccumulator;
|
|
180
|
+
barrier(CLK_LOCAL_MEM_FENCE);
|
|
181
|
+
for(int offset = get_local_size(0) / 2; offset > 0; offset = offset / 2) {
|
|
182
|
+
if(local_index < offset) {
|
|
183
|
+
BUFFER_TYPE other = minScratch[local_index + offset];
|
|
184
|
+
BUFFER_TYPE mine = minScratch[local_index];
|
|
185
|
+
minScratch[local_index] = (mine < other) ? mine : other;
|
|
186
|
+
other = maxScratch[local_index + offset];
|
|
187
|
+
mine = maxScratch[local_index];
|
|
188
|
+
maxScratch[local_index] = (mine > other) ? mine : other;
|
|
189
|
+
}
|
|
190
|
+
barrier(CLK_LOCAL_MEM_FENCE);
|
|
191
|
+
}
|
|
192
|
+
if(local_index == 0) {
|
|
193
|
+
result[get_group_id(0)*2] = minScratch[0];
|
|
194
|
+
result[get_group_id(0)*2+1] = maxScratch[0];
|
|
195
|
+
}
|
|
196
|
+
}
|
fast/kernels/ImageSum.cl
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
|
|
2
|
+
#ifdef TYPE_FLOAT
|
|
3
|
+
#define TYPE float4
|
|
4
|
+
#define BUFFER_TYPE float
|
|
5
|
+
#define READ_IMAGE read_imagef
|
|
6
|
+
#define WRITE_IMAGE write_imagef
|
|
7
|
+
#elif TYPE_UINT8
|
|
8
|
+
#define TYPE uint4
|
|
9
|
+
#define BUFFER_TYPE uchar
|
|
10
|
+
#define READ_IMAGE read_imageui
|
|
11
|
+
#define WRITE_IMAGE write_imageui
|
|
12
|
+
#elif TYPE_INT8
|
|
13
|
+
#define TYPE int4
|
|
14
|
+
#define BUFFER_TYPE char
|
|
15
|
+
#define READ_IMAGE read_imagei
|
|
16
|
+
#define WRITE_IMAGE write_imagei
|
|
17
|
+
#elif TYPE_UINT16
|
|
18
|
+
#define TYPE uint4
|
|
19
|
+
#define BUFFER_TYPE ushort
|
|
20
|
+
#define READ_IMAGE read_imageui
|
|
21
|
+
#define WRITE_IMAGE write_imageui
|
|
22
|
+
#elif TYPE_INT16
|
|
23
|
+
#define TYPE int4
|
|
24
|
+
#define BUFFER_TYPE short
|
|
25
|
+
#define READ_IMAGE read_imagei
|
|
26
|
+
#define WRITE_IMAGE write_imagei
|
|
27
|
+
#elif TYPE_UINT32
|
|
28
|
+
#define TYPE uint4
|
|
29
|
+
#define BUFFER_TYPE uint
|
|
30
|
+
#define READ_IMAGE read_imageui
|
|
31
|
+
#define WRITE_IMAGE write_imageui
|
|
32
|
+
#else
|
|
33
|
+
#define TYPE int4
|
|
34
|
+
#define BUFFER_TYPE int
|
|
35
|
+
#define READ_IMAGE read_imagei
|
|
36
|
+
#define WRITE_IMAGE write_imagei
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
__constant int2 offset2D[4] = {
|
|
40
|
+
{0,0},
|
|
41
|
+
{0,1},
|
|
42
|
+
{1,0},
|
|
43
|
+
{1,1}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
__constant int4 offset3D[8] = {
|
|
47
|
+
{0,0,0,0},
|
|
48
|
+
{1,0,0,0},
|
|
49
|
+
{0,1,0,0},
|
|
50
|
+
{0,0,1,0},
|
|
51
|
+
{1,0,1,0},
|
|
52
|
+
{1,1,1,0},
|
|
53
|
+
{0,1,1,0},
|
|
54
|
+
{1,1,0,0}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
58
|
+
|
|
59
|
+
__kernel void createFirstSumImage2DLevel(
|
|
60
|
+
__read_only image2d_t image,
|
|
61
|
+
__write_only image2d_t firstLevel
|
|
62
|
+
) {
|
|
63
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
64
|
+
const int2 readPos = pos*2;
|
|
65
|
+
const int2 size = {get_image_width(image), get_image_height(image)};
|
|
66
|
+
|
|
67
|
+
float sum = 0.0f;
|
|
68
|
+
for(int i = 0; i < 4; i++) {
|
|
69
|
+
int2 nPos = readPos + offset2D[i];
|
|
70
|
+
if(nPos.x < size.x && nPos.y < size.y) {
|
|
71
|
+
sum += READ_IMAGE(image, sampler, nPos).x;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
write_imagef(firstLevel, pos, sum);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
__kernel void createFirstSumImage3DLevel(
|
|
79
|
+
__read_only image3d_t image,
|
|
80
|
+
__global float* firstLevel
|
|
81
|
+
) {
|
|
82
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
83
|
+
const int4 readPos = pos*2;
|
|
84
|
+
const int3 size = {get_image_width(image), get_image_height(image), get_image_depth(image)};
|
|
85
|
+
|
|
86
|
+
float sum = 0.0f;
|
|
87
|
+
for(int i = 0; i < 8; ++i) {
|
|
88
|
+
int4 nPos = readPos + offset3D[i];
|
|
89
|
+
if(nPos.x < size.x && nPos.y < size.y && nPos.z < size.z) {
|
|
90
|
+
sum += READ_IMAGE(image, sampler, nPos).x;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
firstLevel[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = sum;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
__kernel void createSumImage2DLevel(
|
|
98
|
+
__read_only image2d_t readLevel,
|
|
99
|
+
__write_only image2d_t writeLevel
|
|
100
|
+
) {
|
|
101
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
102
|
+
const int2 readPos = pos*2;
|
|
103
|
+
|
|
104
|
+
float sum =
|
|
105
|
+
read_imagef(readLevel, sampler, readPos + offset2D[0]).x +
|
|
106
|
+
read_imagef(readLevel, sampler, readPos + offset2D[1]).x +
|
|
107
|
+
read_imagef(readLevel, sampler, readPos + offset2D[2]).x +
|
|
108
|
+
read_imagef(readLevel, sampler, readPos + offset2D[3]).x;
|
|
109
|
+
|
|
110
|
+
write_imagef(writeLevel, pos, sum);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
__kernel void createSumImage3DLevel(
|
|
114
|
+
__global float* readLevel,
|
|
115
|
+
__global float* writeLevel
|
|
116
|
+
) {
|
|
117
|
+
const int3 pos = {get_global_id(0), get_global_id(1), get_global_id(2)};
|
|
118
|
+
const int3 readPos = pos*2;
|
|
119
|
+
const int3 size = {get_global_size(0), get_global_size(1), get_global_size(2)};
|
|
120
|
+
const int3 readSize = size*2;
|
|
121
|
+
|
|
122
|
+
float sum = 0.0f;
|
|
123
|
+
for(int i = 0; i < 8; i++) {
|
|
124
|
+
int3 nPos = readPos + offset3D[i].xyz;
|
|
125
|
+
sum += readLevel[nPos.x+nPos.y*readSize.x+nPos.z*readSize.x*readSize.y];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
writeLevel[pos.x+pos.y*size.x+pos.z*size.x*size.y] = sum;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
__kernel void createFirstStdDevImage2DLevel(
|
|
133
|
+
__read_only image2d_t image,
|
|
134
|
+
__write_only image2d_t firstLevel,
|
|
135
|
+
__private float average
|
|
136
|
+
) {
|
|
137
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
138
|
+
const int2 readPos = pos*2;
|
|
139
|
+
const int2 size = {get_image_width(image), get_image_height(image)};
|
|
140
|
+
|
|
141
|
+
float sum = 0.0f;
|
|
142
|
+
for(int i = 0; i < 4; i++) {
|
|
143
|
+
int2 nPos = readPos + offset2D[i];
|
|
144
|
+
if(nPos.x < size.x && nPos.y < size.y) {
|
|
145
|
+
sum += pow(READ_IMAGE(image, sampler, nPos).x - average, 2.0f);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
write_imagef(firstLevel, pos, sum);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
__kernel void createFirstStdDevImage3DLevel(
|
|
153
|
+
__read_only image3d_t image,
|
|
154
|
+
__global float* firstLevel,
|
|
155
|
+
__private float average
|
|
156
|
+
) {
|
|
157
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
158
|
+
const int4 readPos = pos*2;
|
|
159
|
+
const int3 size = {get_image_width(image), get_image_height(image), get_image_depth(image)};
|
|
160
|
+
|
|
161
|
+
float sum = 0.0f;
|
|
162
|
+
for(int i = 0; i < 8; i++) {
|
|
163
|
+
int4 nPos = readPos + offset3D[i];
|
|
164
|
+
if(nPos.x < size.x && nPos.y < size.y && nPos.z < size.z) {
|
|
165
|
+
sum += pow(READ_IMAGE(image, sampler, nPos).x - average, 2.0f);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
firstLevel[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = sum;
|
|
170
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
|
|
3
|
+
layout (lines) in;
|
|
4
|
+
layout (triangle_strip, max_vertices=4) out;
|
|
5
|
+
in vec4 vertexColor[];
|
|
6
|
+
out vec4 geomColor;
|
|
7
|
+
|
|
8
|
+
//uniform float size;
|
|
9
|
+
uniform mat4 perspectiveTransform;
|
|
10
|
+
uniform float borderSize;
|
|
11
|
+
|
|
12
|
+
void main() {
|
|
13
|
+
geomColor = vertexColor[0];
|
|
14
|
+
vec4 first = gl_in[0].gl_Position;
|
|
15
|
+
vec4 second = gl_in[1].gl_Position;
|
|
16
|
+
float pixelWidth = perspectiveTransform[0][0];
|
|
17
|
+
float pixelHeight = perspectiveTransform[1][1];
|
|
18
|
+
float sizeX = borderSize*pixelWidth;
|
|
19
|
+
float sizeY = borderSize*pixelHeight;
|
|
20
|
+
|
|
21
|
+
// Draw bounding box with triangle strips
|
|
22
|
+
if(first.x == second.x) {
|
|
23
|
+
// Vertical line
|
|
24
|
+
if(first.y < second.y) {
|
|
25
|
+
gl_Position = first + vec4(sizeX, -sizeY, 0, 0);
|
|
26
|
+
EmitVertex();
|
|
27
|
+
gl_Position = second + vec4(sizeX, sizeY, 0, 0);
|
|
28
|
+
EmitVertex();
|
|
29
|
+
gl_Position = first + vec4(-sizeX, -sizeY, 0, 0);
|
|
30
|
+
EmitVertex();
|
|
31
|
+
gl_Position = second + vec4(-sizeX, sizeY, 0, 0);
|
|
32
|
+
EmitVertex();
|
|
33
|
+
EndPrimitive();
|
|
34
|
+
} else {
|
|
35
|
+
gl_Position = first + vec4(-sizeX, sizeY, 0, 0);
|
|
36
|
+
EmitVertex();
|
|
37
|
+
gl_Position = second + vec4(-sizeX, -sizeY, 0, 0);
|
|
38
|
+
EmitVertex();
|
|
39
|
+
gl_Position = first + vec4(sizeX, sizeY, 0, 0);
|
|
40
|
+
EmitVertex();
|
|
41
|
+
gl_Position = second + vec4(sizeX, -sizeY, 0, 0);
|
|
42
|
+
EmitVertex();
|
|
43
|
+
EndPrimitive();
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
// Horizontal line
|
|
47
|
+
if(first.x < second.x) {
|
|
48
|
+
gl_Position = first + vec4(-sizeX, -sizeY, 0, 0);
|
|
49
|
+
EmitVertex();
|
|
50
|
+
gl_Position = second + vec4(sizeX, -sizeY, 0, 0);
|
|
51
|
+
EmitVertex();
|
|
52
|
+
gl_Position = first + vec4(-sizeX, sizeY, 0, 0);
|
|
53
|
+
EmitVertex();
|
|
54
|
+
gl_Position = second + vec4(sizeX, sizeY, 0, 0);
|
|
55
|
+
EmitVertex();
|
|
56
|
+
EndPrimitive();
|
|
57
|
+
} else {
|
|
58
|
+
gl_Position = second + vec4(sizeX, sizeY, 0, 0);
|
|
59
|
+
EmitVertex();
|
|
60
|
+
gl_Position = first + vec4(-sizeX, sizeY, 0, 0);
|
|
61
|
+
EmitVertex();
|
|
62
|
+
gl_Position = second + vec4(sizeX, -sizeY, 0, 0);
|
|
63
|
+
EmitVertex();
|
|
64
|
+
gl_Position = first + vec4(-sizeX, -sizeY, 0, 0);
|
|
65
|
+
EmitVertex();
|
|
66
|
+
EndPrimitive();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
layout (location = 0) in vec3 in_position;
|
|
3
|
+
layout (location = 1) in uint in_label;
|
|
4
|
+
layout (std140) uniform Colors {
|
|
5
|
+
vec4 color[256];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
out vec4 vertexColor;
|
|
9
|
+
|
|
10
|
+
uniform mat4 transform;
|
|
11
|
+
uniform mat4 viewTransform;
|
|
12
|
+
uniform mat4 perspectiveTransform;
|
|
13
|
+
|
|
14
|
+
void main() {
|
|
15
|
+
gl_Position = perspectiveTransform * viewTransform * transform * vec4(in_position, 1.0);
|
|
16
|
+
vertexColor = in_label < uint(256) ? color[in_label] : vec4(0.0, 0.0, 0.0, 0.0);
|
|
17
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void renderToTexture(
|
|
4
|
+
__global float* inputTensor,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__constant float* colors,
|
|
7
|
+
__private float minConfidence,
|
|
8
|
+
__private float maxOpacity,
|
|
9
|
+
__private int channels
|
|
10
|
+
) {
|
|
11
|
+
const int2 position = {get_global_id(0), get_global_id(1)};
|
|
12
|
+
|
|
13
|
+
float4 color = {0.0f, 0.0f, 0.0f, 0.0f};
|
|
14
|
+
for(int channel = 0; channel < channels; ++channel) {
|
|
15
|
+
float intensity = inputTensor[(position.x + position.y*get_global_size(0))*channels + channel];
|
|
16
|
+
intensity = clamp(intensity, 0.0f, 1.0f);
|
|
17
|
+
|
|
18
|
+
if(intensity >= minConfidence) {
|
|
19
|
+
float4 colorToUse = vload4(channel, colors);
|
|
20
|
+
color += colorToUse*intensity;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
color = clamp(color, 0.0f, 1.0f);
|
|
24
|
+
if(color.w == 0) { // none with intensity >= minConfidence or 0 found
|
|
25
|
+
color = (float4)(0.0f,0.0f,0.0f,0.0f);
|
|
26
|
+
// Look for neighbors instead
|
|
27
|
+
float highestConfidence = minConfidence;
|
|
28
|
+
for(int a = -1; a <= 1; ++a) {
|
|
29
|
+
for(int b = -1; b <= 1; ++b) {
|
|
30
|
+
int2 nPos = {position.x + a, position.y + b};
|
|
31
|
+
// Out of bounds check:
|
|
32
|
+
if(nPos.x < 0 || nPos.y < 0 || nPos.x >= get_global_size(0) || nPos.y >= get_global_size(1))
|
|
33
|
+
continue;
|
|
34
|
+
for(int channel = 0; channel < channels; ++channel) {
|
|
35
|
+
float intensity = inputTensor[(nPos.x + nPos.y*get_global_size(0))*channels + channel];
|
|
36
|
+
|
|
37
|
+
if(intensity >= highestConfidence) {
|
|
38
|
+
float4 colorToUse = vload4(channel, colors);
|
|
39
|
+
color = colorToUse;
|
|
40
|
+
color.w = 0.0f; // Set opacity to zero
|
|
41
|
+
highestConfidence = intensity;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
color.w *= maxOpacity;
|
|
48
|
+
}
|
|
49
|
+
write_imagef(output, position, color);
|
|
50
|
+
}
|
|
51
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
layout (location = 0) in vec3 aPos;
|
|
3
|
+
layout (location = 1) in vec2 aTexCoord;
|
|
4
|
+
|
|
5
|
+
out vec2 TexCoord;
|
|
6
|
+
|
|
7
|
+
uniform mat4 transform;
|
|
8
|
+
uniform mat4 viewTransform;
|
|
9
|
+
uniform mat4 perspectiveTransform;
|
|
10
|
+
|
|
11
|
+
void main()
|
|
12
|
+
{
|
|
13
|
+
gl_Position = perspectiveTransform * viewTransform * transform * vec4(aPos, 1.0);
|
|
14
|
+
TexCoord = aTexCoord;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#version 330 core
|
|
2
|
+
layout (location = 0) in vec3 aPos;
|
|
3
|
+
layout (location = 1) in vec2 aTexCoord;
|
|
4
|
+
|
|
5
|
+
out vec2 TexCoord;
|
|
6
|
+
|
|
7
|
+
uniform mat4 transform;
|
|
8
|
+
uniform mat4 viewTransform;
|
|
9
|
+
uniform mat4 perspectiveTransform;
|
|
10
|
+
|
|
11
|
+
void main()
|
|
12
|
+
{
|
|
13
|
+
gl_Position = perspectiveTransform * viewTransform * transform * vec4(aPos, 1.0);
|
|
14
|
+
TexCoord = aTexCoord;
|
|
15
|
+
}
|