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,77 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void orthogonalSlicing(
|
|
4
|
+
__read_only image3d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private int slice,
|
|
7
|
+
__private int slicePlane
|
|
8
|
+
) {
|
|
9
|
+
const int x = get_global_id(0);
|
|
10
|
+
const int y = get_global_id(1);
|
|
11
|
+
|
|
12
|
+
int4 pos;
|
|
13
|
+
if(slicePlane == 0) {
|
|
14
|
+
pos = (int4)(slice,x,y,0);
|
|
15
|
+
} else if(slicePlane == 1) {
|
|
16
|
+
pos = (int4)(x,slice,y,0);
|
|
17
|
+
} else {
|
|
18
|
+
pos = (int4)(x,y,slice,0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
int dataType = get_image_channel_data_type(input);
|
|
22
|
+
if(dataType == CLK_FLOAT) {
|
|
23
|
+
float4 value = read_imagef(input, sampler, pos);
|
|
24
|
+
write_imagef(output, (int2)(x,y), value);
|
|
25
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
26
|
+
uint4 value = read_imageui(input, sampler, pos);
|
|
27
|
+
write_imageui(output, (int2)(x,y), value);
|
|
28
|
+
} else {
|
|
29
|
+
int4 value = read_imagei(input, sampler, pos);
|
|
30
|
+
write_imagei(output, (int2)(x,y), value);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
float4 transformPosition(__constant float* transform, int2 PBOposition) {
|
|
35
|
+
float4 position = {PBOposition.x, PBOposition.y, 0, 1};
|
|
36
|
+
float transformedPosition[4];
|
|
37
|
+
//printf("PBO pos: %d %d\n", PBOposition.x, PBOposition.y);
|
|
38
|
+
|
|
39
|
+
// Multiply with transform
|
|
40
|
+
// transform is column major
|
|
41
|
+
for(int i = 0; i < 4; i++) {
|
|
42
|
+
float sum = 0;
|
|
43
|
+
sum += transform[i + 0*4]*position.x;
|
|
44
|
+
sum += transform[i + 1*4]*position.y;
|
|
45
|
+
sum += transform[i + 2*4]*position.z;
|
|
46
|
+
sum += transform[i + 3*4]*position.w;
|
|
47
|
+
transformedPosition[i] = sum;
|
|
48
|
+
}
|
|
49
|
+
//printf("Transformed pos: %f %f %f\n", transformedPosition[0], transformedPosition[1], transformedPosition[2]);
|
|
50
|
+
|
|
51
|
+
float4 result = {transformedPosition[0], transformedPosition[1], transformedPosition[2], transformedPosition[3]};
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
__kernel void arbitrarySlicing(
|
|
56
|
+
__read_only image3d_t input,
|
|
57
|
+
__write_only image2d_t output,
|
|
58
|
+
__constant float* transform
|
|
59
|
+
) {
|
|
60
|
+
|
|
61
|
+
const int2 position = {get_global_id(0), get_global_id(1)};
|
|
62
|
+
|
|
63
|
+
float4 imagePosition = transformPosition(transform, position);
|
|
64
|
+
imagePosition.w = 1;
|
|
65
|
+
|
|
66
|
+
int dataType = get_image_channel_data_type(input);
|
|
67
|
+
if(dataType == CLK_FLOAT) {
|
|
68
|
+
float4 value = read_imagef(input, sampler, imagePosition);
|
|
69
|
+
write_imagef(output, position, value);
|
|
70
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
71
|
+
uint4 value = read_imageui(input, sampler, imagePosition);
|
|
72
|
+
write_imageui(output, position, value);
|
|
73
|
+
} else {
|
|
74
|
+
int4 value = read_imagei(input, sampler, imagePosition);
|
|
75
|
+
write_imagei(output, position, value);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_FILTER_NEAREST | CLK_ADDRESS_NONE;
|
|
2
|
+
|
|
3
|
+
__kernel void transpose2D(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output
|
|
6
|
+
) {
|
|
7
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
8
|
+
int dataType = get_image_channel_data_type(input);
|
|
9
|
+
if(dataType == CLK_FLOAT) {
|
|
10
|
+
write_imagef(output, pos.yx, read_imagef(input, sampler, pos));
|
|
11
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
12
|
+
write_imageui(output, pos.yx, read_imageui(input, sampler, pos));
|
|
13
|
+
} else {
|
|
14
|
+
write_imagei(output, pos.yx, read_imagei(input, sampler, pos));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_FILTER_NEAREST | CLK_ADDRESS_NONE;
|
|
2
|
+
|
|
3
|
+
__kernel void transpose3D(
|
|
4
|
+
__read_only image3d_t input,
|
|
5
|
+
__global TYPE* output,
|
|
6
|
+
__private int axes1,
|
|
7
|
+
__private int axes2,
|
|
8
|
+
__private int axes3,
|
|
9
|
+
__private int channels
|
|
10
|
+
) {
|
|
11
|
+
|
|
12
|
+
int pos[3] = {get_global_id(0), get_global_id(1), get_global_id(2)};
|
|
13
|
+
int4 posInput = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
14
|
+
int size[3] = {get_image_width(input), get_image_height(input), get_image_depth(input)};
|
|
15
|
+
|
|
16
|
+
int dataType = get_image_channel_data_type(input);
|
|
17
|
+
if(dataType == CLK_FLOAT) {
|
|
18
|
+
float4 value = read_imagef(input, sampler, posInput);
|
|
19
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels] = value.x;
|
|
20
|
+
if(channels > 1)
|
|
21
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 1] = value.y;
|
|
22
|
+
if(channels > 2)
|
|
23
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 2] = value.z;
|
|
24
|
+
if(channels > 3)
|
|
25
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 3] = value.w;
|
|
26
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
27
|
+
uint4 value = read_imageui(input, sampler, posInput);
|
|
28
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels] = value.x;
|
|
29
|
+
if(channels > 1)
|
|
30
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 1] = value.y;
|
|
31
|
+
if(channels > 2)
|
|
32
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 2] = value.z;
|
|
33
|
+
if(channels > 3)
|
|
34
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 3] = value.w;
|
|
35
|
+
} else {
|
|
36
|
+
int4 value = read_imagei(input, sampler, posInput);
|
|
37
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels] = value.x;
|
|
38
|
+
if(channels > 1)
|
|
39
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 1] = value.y;
|
|
40
|
+
if(channels > 2)
|
|
41
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 2] = value.z;
|
|
42
|
+
if(channels > 3)
|
|
43
|
+
output[(pos[axes1] + pos[axes2]*size[axes1] + pos[axes3]*size[axes1]*size[axes2])*channels + 3] = value.w;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void clip2D(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private float min,
|
|
7
|
+
__private float max
|
|
8
|
+
) {
|
|
9
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
10
|
+
const int dataType = get_image_channel_data_type(input);
|
|
11
|
+
|
|
12
|
+
if(dataType == CLK_FLOAT) {
|
|
13
|
+
write_imagef(output, pos, clamp(read_imagef(input, sampler, pos), min, max));
|
|
14
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
15
|
+
write_imageui(output, pos, clamp(read_imageui(input, sampler, pos), (uint)min, (uint)max));
|
|
16
|
+
} else {
|
|
17
|
+
write_imagei(output, pos, clamp(read_imagei(input, sampler, pos), (int)min, (int)max));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void clip3D(
|
|
4
|
+
__read_only image3d_t input,
|
|
5
|
+
__global TYPE* output,
|
|
6
|
+
__private float min,
|
|
7
|
+
__private float max
|
|
8
|
+
) {
|
|
9
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
10
|
+
const int4 size = {get_global_size(0), get_global_size(1), get_global_size(2), 0};
|
|
11
|
+
const int dataType = get_image_channel_data_type(input);
|
|
12
|
+
|
|
13
|
+
if(dataType == CLK_FLOAT) {
|
|
14
|
+
output[pos.x + pos.y*size.x + pos.z*size.x*size.y] = clamp(read_imagef(input, sampler, pos).x, min, max);
|
|
15
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
16
|
+
output[pos.x + pos.y*size.x + pos.z*size.x*size.y] = clamp(read_imageui(input, sampler, pos).x, (uint)min, (uint)max);
|
|
17
|
+
} else {
|
|
18
|
+
output[pos.x + pos.y*size.x + pos.z*size.x*size.y] = clamp(read_imagei(input, sampler, pos).x, (int)min, (int)max);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void scaleImage2D(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private float min,
|
|
7
|
+
__private float max,
|
|
8
|
+
__private float low,
|
|
9
|
+
__private float high
|
|
10
|
+
) {
|
|
11
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
12
|
+
int dataType = get_image_channel_data_type(input);
|
|
13
|
+
|
|
14
|
+
float4 value;
|
|
15
|
+
if(dataType == CLK_FLOAT) {
|
|
16
|
+
value = read_imagef(input, sampler, pos);
|
|
17
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
18
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
19
|
+
} else {
|
|
20
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
21
|
+
}
|
|
22
|
+
value = (value - min) / (max - min);
|
|
23
|
+
value = value*(high - low) + low;
|
|
24
|
+
|
|
25
|
+
write_imagef(output, pos, value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#ifdef fast_3d_image_writes
|
|
29
|
+
__kernel void scaleImage3D(
|
|
30
|
+
__read_only image3d_t input,
|
|
31
|
+
__write_only image3d_t output,
|
|
32
|
+
__private float min,
|
|
33
|
+
__private float max,
|
|
34
|
+
__private float low,
|
|
35
|
+
__private float high
|
|
36
|
+
) {
|
|
37
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
38
|
+
int dataType = get_image_channel_data_type(input);
|
|
39
|
+
|
|
40
|
+
float4 value;
|
|
41
|
+
if(dataType == CLK_FLOAT) {
|
|
42
|
+
value = read_imagef(input, sampler, pos);
|
|
43
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
44
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
45
|
+
} else {
|
|
46
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
47
|
+
}
|
|
48
|
+
value = (value - min) / (max - min);
|
|
49
|
+
value = value*(high - low) + low;
|
|
50
|
+
|
|
51
|
+
write_imagef(output, pos, value);
|
|
52
|
+
}
|
|
53
|
+
#else
|
|
54
|
+
__kernel void scaleImage3D(
|
|
55
|
+
__read_only image3d_t input,
|
|
56
|
+
__global float* output,
|
|
57
|
+
__private float min,
|
|
58
|
+
__private float max,
|
|
59
|
+
__private float low,
|
|
60
|
+
__private float high,
|
|
61
|
+
__private uint outputChannels
|
|
62
|
+
) {
|
|
63
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
64
|
+
int dataType = get_image_channel_data_type(input);
|
|
65
|
+
|
|
66
|
+
float4 value;
|
|
67
|
+
if(dataType == CLK_FLOAT) {
|
|
68
|
+
value = read_imagef(input, sampler, pos);
|
|
69
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
70
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
71
|
+
} else {
|
|
72
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
73
|
+
}
|
|
74
|
+
value = (value - min) / (max - min);
|
|
75
|
+
value = value*(high - low) + low;
|
|
76
|
+
|
|
77
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels] = value.x;
|
|
78
|
+
if(outputChannels > 1)
|
|
79
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 1] = value.y;
|
|
80
|
+
if(outputChannels > 2)
|
|
81
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 2] = value.z;
|
|
82
|
+
if(outputChannels > 3)
|
|
83
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 3] = value.w;
|
|
84
|
+
}
|
|
85
|
+
#endif
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void normalize2D(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__private float average,
|
|
7
|
+
__private float std
|
|
8
|
+
) {
|
|
9
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
10
|
+
int dataType = get_image_channel_data_type(input);
|
|
11
|
+
|
|
12
|
+
float4 value;
|
|
13
|
+
if(dataType == CLK_FLOAT) {
|
|
14
|
+
value = read_imagef(input, sampler, pos);
|
|
15
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
16
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
17
|
+
} else {
|
|
18
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
19
|
+
}
|
|
20
|
+
value = (value - average) / std;
|
|
21
|
+
|
|
22
|
+
write_imagef(output, pos, value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#ifdef fast_3d_image_writes
|
|
26
|
+
__kernel void normalize3D(
|
|
27
|
+
__read_only image3d_t input,
|
|
28
|
+
__write_only image3d_t output,
|
|
29
|
+
__private float average,
|
|
30
|
+
__private float std
|
|
31
|
+
) {
|
|
32
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
33
|
+
int dataType = get_image_channel_data_type(input);
|
|
34
|
+
|
|
35
|
+
float4 value;
|
|
36
|
+
if(dataType == CLK_FLOAT) {
|
|
37
|
+
value = read_imagef(input, sampler, pos);
|
|
38
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
39
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
40
|
+
} else {
|
|
41
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
42
|
+
}
|
|
43
|
+
value = (value - average) / std;
|
|
44
|
+
|
|
45
|
+
write_imagef(output, pos, value);
|
|
46
|
+
}
|
|
47
|
+
#else
|
|
48
|
+
__kernel void normalize3D(
|
|
49
|
+
__read_only image3d_t input,
|
|
50
|
+
__global float* output,
|
|
51
|
+
__private float average,
|
|
52
|
+
__private float std,
|
|
53
|
+
__private uint outputChannels
|
|
54
|
+
) {
|
|
55
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
56
|
+
int dataType = get_image_channel_data_type(input);
|
|
57
|
+
|
|
58
|
+
float4 value;
|
|
59
|
+
if(dataType == CLK_FLOAT) {
|
|
60
|
+
value = read_imagef(input, sampler, pos);
|
|
61
|
+
} else if(dataType == CLK_UNSIGNED_INT8 || dataType == CLK_UNSIGNED_INT16 || dataType == CLK_UNSIGNED_INT32) {
|
|
62
|
+
value = convert_float4(read_imageui(input, sampler, pos));
|
|
63
|
+
} else {
|
|
64
|
+
value = convert_float4(read_imagei(input, sampler, pos));
|
|
65
|
+
}
|
|
66
|
+
value = (value - average) / std;
|
|
67
|
+
|
|
68
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels] = value.x;
|
|
69
|
+
if(outputChannels > 1)
|
|
70
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 1] = value.y;
|
|
71
|
+
if(outputChannels > 2)
|
|
72
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 2] = value.z;
|
|
73
|
+
if(outputChannels > 3)
|
|
74
|
+
output[(pos.x + pos.y*get_image_width(input) + pos.z*get_image_width(input)*get_image_height(input))*outputChannels + 3] = value.w;
|
|
75
|
+
}
|
|
76
|
+
#endif
|
fast/kernels/Algorithms/KalmanFilterModelSegmentation/AppearanceModels/RidgeEdge/RidgeEdgeModel.cl
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
float3 transform(const float3 position, __constant float* transformationMatrix) {
|
|
4
|
+
float3 result;
|
|
5
|
+
result.x = position.x*transformationMatrix[0] + position.y*transformationMatrix[1] + position.z*transformationMatrix[2] + transformationMatrix[3];
|
|
6
|
+
result.y = position.x*transformationMatrix[4] + position.y*transformationMatrix[5] + position.z*transformationMatrix[6] + transformationMatrix[7];
|
|
7
|
+
result.z = position.x*transformationMatrix[8] + position.y*transformationMatrix[9] + position.z*transformationMatrix[10] + transformationMatrix[11];
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
__kernel void edgeDetection2D(
|
|
13
|
+
__read_only image2d_t image,
|
|
14
|
+
__global float* points,
|
|
15
|
+
__private float lineSearchDistance,
|
|
16
|
+
__private float sampleSpacing,
|
|
17
|
+
__local float* intensityProfile,
|
|
18
|
+
__global float* results,
|
|
19
|
+
__private float spacingX,
|
|
20
|
+
__private float spacingY,
|
|
21
|
+
__private int size
|
|
22
|
+
) {
|
|
23
|
+
const int sampleNr = get_global_id(0);
|
|
24
|
+
const int pointNr = get_global_id(1);
|
|
25
|
+
const int nrOfSamples = get_global_size(0);
|
|
26
|
+
const float2 position = vload2(pointNr*2, points);
|
|
27
|
+
const float2 normal = vload2(pointNr*2+1, points);
|
|
28
|
+
const float distance = -lineSearchDistance/2.0f + sampleNr*sampleSpacing;
|
|
29
|
+
//printf("s: %d, d: %f \n", sampleNr, distance);
|
|
30
|
+
float2 samplePosition = position + distance*normal;
|
|
31
|
+
samplePosition.x /= spacingX;
|
|
32
|
+
samplePosition.y /= spacingY;
|
|
33
|
+
//printf("p: %f %f, sp: %f %f, n: %f %f\n", position.x, position.y, samplePosition.x, samplePosition.y, normal.x, normal.y);
|
|
34
|
+
|
|
35
|
+
// All read intensity profile into local memory
|
|
36
|
+
// TODO support for other types of images
|
|
37
|
+
intensityProfile[sampleNr] = (float)read_imageui(image, sampler, samplePosition).x;
|
|
38
|
+
|
|
39
|
+
// TODO how do we deal with out of image/mask here?
|
|
40
|
+
|
|
41
|
+
// Synchronize
|
|
42
|
+
barrier(CLK_LOCAL_MEM_FENCE);
|
|
43
|
+
|
|
44
|
+
float sumBeforeRidge = 0.0f;
|
|
45
|
+
float sumInRidge = 0.0f;
|
|
46
|
+
float sumAfterRidge = 0.0f;
|
|
47
|
+
int startPos = -1;
|
|
48
|
+
int endPos = -1;
|
|
49
|
+
for(int i = 0; i < nrOfSamples; i++) {
|
|
50
|
+
if(startPos == -1 && intensityProfile[i] > 0)
|
|
51
|
+
startPos = i;
|
|
52
|
+
if(startPos >= 0 && intensityProfile[i] == 0) {
|
|
53
|
+
endPos = i;
|
|
54
|
+
}
|
|
55
|
+
if(startPos >= 0 && endPos == -1) {
|
|
56
|
+
if(i <= sampleNr) {
|
|
57
|
+
sumBeforeRidge += intensityProfile[i];
|
|
58
|
+
} else if(i <= sampleNr + size) {
|
|
59
|
+
sumInRidge += intensityProfile[i];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if(endPos < 0)
|
|
64
|
+
endPos = nrOfSamples - 1;
|
|
65
|
+
|
|
66
|
+
// Calculate intensity diffs
|
|
67
|
+
const float averageBeforeRidge = sumBeforeRidge / (sampleNr+1 - startPos);
|
|
68
|
+
const float averageInRidge = sumInRidge / size;
|
|
69
|
+
|
|
70
|
+
const float intensityDifference = averageInRidge - averageBeforeRidge;
|
|
71
|
+
|
|
72
|
+
results[sampleNr + pointNr*nrOfSamples] = intensityDifference;
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
// TODO
|
|
76
|
+
|
|
77
|
+
// Store score and uncertainty in local memory
|
|
78
|
+
// Use first thread to calculate best score of all samples
|
|
79
|
+
// Store sampleNr and uncertainty in global memory
|
|
80
|
+
|
|
81
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void modifyLabels(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__write_only image2d_t output,
|
|
6
|
+
__global uchar* labelChanges,
|
|
7
|
+
__private int count
|
|
8
|
+
) {
|
|
9
|
+
|
|
10
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
11
|
+
uchar value = read_imageui(input, sampler, pos).x;
|
|
12
|
+
uchar newValue = value;
|
|
13
|
+
for(int i = 0; i < count-1; ++i) {
|
|
14
|
+
if(value == labelChanges[i*2]) {
|
|
15
|
+
newValue = labelChanges[i*2+1];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
write_imageui(output, pos, newValue);
|
|
20
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
__kernel void laplacianOfGaussian(
|
|
4
|
+
__read_only image2d_t input,
|
|
5
|
+
__constant float * mask,
|
|
6
|
+
__write_only image2d_t output,
|
|
7
|
+
__private unsigned char maskSize
|
|
8
|
+
) {
|
|
9
|
+
|
|
10
|
+
const int2 pos = {get_global_id(0), get_global_id(1)};
|
|
11
|
+
const unsigned char halfSize = (maskSize-1)/2;
|
|
12
|
+
|
|
13
|
+
float sum = 0.0f;
|
|
14
|
+
for(int x = -halfSize; x <= halfSize; x++) {
|
|
15
|
+
for(int y = -halfSize; y <= halfSize; y++) {
|
|
16
|
+
const int2 offset = {x,y};
|
|
17
|
+
#ifdef TYPE_FLOAT
|
|
18
|
+
sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imagef(input, sampler, pos+offset).x;
|
|
19
|
+
#elif TYPE_UINT
|
|
20
|
+
sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imageui(input, sampler, pos+offset).x;
|
|
21
|
+
#else
|
|
22
|
+
sum += mask[x+halfSize+(y+halfSize)*maskSize]*read_imagei(input, sampler, pos+offset).x;
|
|
23
|
+
#endif
|
|
24
|
+
}}
|
|
25
|
+
|
|
26
|
+
write_imagef(output, pos, sum);
|
|
27
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#ifdef fast_3d_image_writes
|
|
2
|
+
#define PHI_WRITE_TYPE __write_only image3d_t
|
|
3
|
+
#define WRITE_RESULT(storage, pos, value) write_imagef(storage, pos, value)
|
|
4
|
+
#else
|
|
5
|
+
#define PHI_WRITE_TYPE __global float *
|
|
6
|
+
#define WRITE_RESULT(storage, pos, value) storage[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = value;
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
|
|
10
|
+
|
|
11
|
+
__kernel void updateLevelSetFunction(
|
|
12
|
+
__read_only image3d_t input,
|
|
13
|
+
__read_only image3d_t phi_read,
|
|
14
|
+
PHI_WRITE_TYPE phi_write,
|
|
15
|
+
__private float threshold,
|
|
16
|
+
__private float epsilon,
|
|
17
|
+
__private float alpha,
|
|
18
|
+
PHI_WRITE_TYPE speedStorage,
|
|
19
|
+
__private float deltaT
|
|
20
|
+
) {
|
|
21
|
+
int x = get_global_id(0);
|
|
22
|
+
int y = get_global_id(1);
|
|
23
|
+
int z = get_global_id(2);
|
|
24
|
+
const int4 pos = {x,y,z,0};
|
|
25
|
+
|
|
26
|
+
// Calculate all first order derivatives
|
|
27
|
+
float3 D = {
|
|
28
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y,z,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y,z,0)).x),
|
|
29
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y+1,z,0)).x-read_imagef(phi_read,sampler,(int4)(x,y-1,z,0)).x),
|
|
30
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x,y,z-1,0)).x)
|
|
31
|
+
};
|
|
32
|
+
float3 Dminus = {
|
|
33
|
+
read_imagef(phi_read,sampler,pos).x-read_imagef(phi_read,sampler,(int4)(x-1,y,z,0)).x,
|
|
34
|
+
read_imagef(phi_read,sampler,pos).x-read_imagef(phi_read,sampler,(int4)(x,y-1,z,0)).x,
|
|
35
|
+
read_imagef(phi_read,sampler,pos).x-read_imagef(phi_read,sampler,(int4)(x,y,z-1,0)).x
|
|
36
|
+
};
|
|
37
|
+
float3 Dplus = {
|
|
38
|
+
read_imagef(phi_read,sampler,(int4)(x+1,y,z,0)).x-read_imagef(phi_read,sampler,pos).x,
|
|
39
|
+
read_imagef(phi_read,sampler,(int4)(x,y+1,z,0)).x-read_imagef(phi_read,sampler,pos).x,
|
|
40
|
+
read_imagef(phi_read,sampler,(int4)(x,y,z+1,0)).x-read_imagef(phi_read,sampler,pos).x
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Calculate gradient
|
|
44
|
+
float3 gradientMin = {
|
|
45
|
+
sqrt(pow(min(Dplus.x, 0.0f), 2.0f) + pow(min(-Dminus.x, 0.0f), 2.0f)),
|
|
46
|
+
sqrt(pow(min(Dplus.y, 0.0f), 2.0f) + pow(min(-Dminus.y, 0.0f), 2.0f)),
|
|
47
|
+
sqrt(pow(min(Dplus.z, 0.0f), 2.0f) + pow(min(-Dminus.z, 0.0f), 2.0f))
|
|
48
|
+
};
|
|
49
|
+
float3 gradientMax = {
|
|
50
|
+
sqrt(pow(max(Dplus.x, 0.0f), 2.0f) + pow(max(-Dminus.x, 0.0f), 2.0f)),
|
|
51
|
+
sqrt(pow(max(Dplus.y, 0.0f), 2.0f) + pow(max(-Dminus.y, 0.0f), 2.0f)),
|
|
52
|
+
sqrt(pow(max(Dplus.z, 0.0f), 2.0f) + pow(max(-Dminus.z, 0.0f), 2.0f))
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Calculate all second order derivatives
|
|
56
|
+
float3 DxMinus = {
|
|
57
|
+
0.0f,
|
|
58
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y-1,z,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y-1,z,0)).x),
|
|
59
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y,z-1,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y,z-1,0)).x)
|
|
60
|
+
};
|
|
61
|
+
float3 DxPlus = {
|
|
62
|
+
0.0f,
|
|
63
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y+1,z,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y+1,z,0)).x),
|
|
64
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y,z+1,0)).x)
|
|
65
|
+
};
|
|
66
|
+
float3 DyMinus = {
|
|
67
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x-1,y+1,z,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y-1,z,0)).x),
|
|
68
|
+
0.0f,
|
|
69
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y+1,z-1,0)).x-read_imagef(phi_read,sampler,(int4)(x,y-1,z-1,0)).x)
|
|
70
|
+
};
|
|
71
|
+
float3 DyPlus = {
|
|
72
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y+1,z,0)).x-read_imagef(phi_read,sampler,(int4)(x+1,y-1,z,0)).x),
|
|
73
|
+
0.0f,
|
|
74
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y+1,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x,y-1,z+1,0)).x)
|
|
75
|
+
};
|
|
76
|
+
float3 DzMinus = {
|
|
77
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x-1,y,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x-1,y,z-1,0)).x),
|
|
78
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y-1,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x,y-1,z-1,0)).x),
|
|
79
|
+
0.0f
|
|
80
|
+
};
|
|
81
|
+
float3 DzPlus = {
|
|
82
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x+1,y,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x+1,y,z-1,0)).x),
|
|
83
|
+
0.5f*(read_imagef(phi_read,sampler,(int4)(x,y+1,z+1,0)).x-read_imagef(phi_read,sampler,(int4)(x,y+1,z-1,0)).x),
|
|
84
|
+
0.0f
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Calculate curvature
|
|
88
|
+
float3 nMinus = {
|
|
89
|
+
Dminus.x / sqrt(FLT_EPSILON+Dminus.x*Dminus.x+pow(0.5f*(DyMinus.x+D.y),2.0f)+pow(0.5f*(DzMinus.x+D.z),2.0f)),
|
|
90
|
+
Dminus.y / sqrt(FLT_EPSILON+Dminus.y*Dminus.y+pow(0.5f*(DxMinus.y+D.x),2.0f)+pow(0.5f*(DzMinus.y+D.z),2.0f)),
|
|
91
|
+
Dminus.z / sqrt(FLT_EPSILON+Dminus.z*Dminus.z+pow(0.5f*(DxMinus.z+D.x),2.0f)+pow(0.5f*(DyMinus.z+D.y),2.0f))
|
|
92
|
+
};
|
|
93
|
+
float3 nPlus = {
|
|
94
|
+
Dplus.x / sqrt(FLT_EPSILON+Dplus.x*Dplus.x+pow(0.5f*(DyPlus.x+D.y),2.0f)+pow(0.5f*(DzPlus.x+D.z),2.0f)),
|
|
95
|
+
Dplus.y / sqrt(FLT_EPSILON+Dplus.y*Dplus.y+pow(0.5f*(DxPlus.y+D.x),2.0f)+pow(0.5f*(DzPlus.y+D.z),2.0f)),
|
|
96
|
+
Dplus.z / sqrt(FLT_EPSILON+Dplus.z*Dplus.z+pow(0.5f*(DxPlus.z+D.x),2.0f)+pow(0.5f*(DyPlus.z+D.y),2.0f))
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
float curvature = ((nPlus.x-nMinus.x)+(nPlus.y-nMinus.y)+(nPlus.z-nMinus.z))*0.5f;
|
|
100
|
+
|
|
101
|
+
// Calculate speed term
|
|
102
|
+
float speed = -(1.0f-alpha)*max(-epsilon, (epsilon-fabs(threshold-read_imagei(input,sampler,pos).x)))/epsilon + alpha*curvature;
|
|
103
|
+
|
|
104
|
+
// Determine gradient based on speed direction
|
|
105
|
+
float3 gradient;
|
|
106
|
+
if(speed < 0) {
|
|
107
|
+
gradient = gradientMin;
|
|
108
|
+
} else {
|
|
109
|
+
gradient = gradientMax;
|
|
110
|
+
}
|
|
111
|
+
if(length(gradient) > 1.0f)
|
|
112
|
+
gradient = normalize(gradient);
|
|
113
|
+
|
|
114
|
+
// Stability CFL
|
|
115
|
+
// max(fabs(speed*gradient.length()))
|
|
116
|
+
WRITE_RESULT(speedStorage, pos, fabs(speed*length(gradient)));
|
|
117
|
+
|
|
118
|
+
// Update the level set function phi
|
|
119
|
+
WRITE_RESULT(phi_write, pos, read_imagef(phi_read,sampler,pos).x + deltaT*speed*length(gradient));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
__kernel void initializeLevelSetFunction(
|
|
123
|
+
PHI_WRITE_TYPE phi,
|
|
124
|
+
__private int seedX,
|
|
125
|
+
__private int seedY,
|
|
126
|
+
__private int seedZ,
|
|
127
|
+
__private float radius
|
|
128
|
+
) {
|
|
129
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
130
|
+
|
|
131
|
+
WRITE_RESULT(phi, pos, distance((float3)(seedX,seedY,seedZ), convert_float3(pos.xyz)) - radius);
|
|
132
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
|
|
2
|
+
|
|
3
|
+
#define LPOS(pos) pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)
|
|
4
|
+
|
|
5
|
+
__kernel void convertToHU(
|
|
6
|
+
__read_only image3d_t input,
|
|
7
|
+
#ifdef fast_3d_image_writes
|
|
8
|
+
__write_only image3d_t output
|
|
9
|
+
#else
|
|
10
|
+
__global short* output
|
|
11
|
+
#endif
|
|
12
|
+
) {
|
|
13
|
+
const int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
|
|
14
|
+
|
|
15
|
+
int value = read_imageui(input, sampler, pos).x;
|
|
16
|
+
value -= 1024;
|
|
17
|
+
#ifdef fast_3d_image_writes
|
|
18
|
+
write_imagei(output, pos, value);
|
|
19
|
+
#else
|
|
20
|
+
output[LPOS(pos)] = value;
|
|
21
|
+
#endif
|
|
22
|
+
}
|