Skip to content

Commit 73c5d7f

Browse files
committed
Improved CommandLineParser with setting OpenCL
1 parent c3ccb0a commit 73c5d7f

3 files changed

Lines changed: 20 additions & 4 deletions

File tree

source/FAST/Algorithms/ImageComparison/SSIM.hpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ namespace fast {
1414
* Multi-channel images and 3D images are supported. In this case an SSIM value is calculated per channel, and the
1515
* final SSIM value is the average of all channel SSIM values.
1616
*
17-
* No image cropping is performed when calculating SSIM, out of bounds pixels are handled using mirrored repeat.
18-
* Note that other SSIM implementations may crop the image which can result in different SSIM values.
17+
* No image cropping is performed when calculating SSIM, out of bounds pixels in the Gaussian window are handled using mirrored repeat.
1918
*
2019
* Inputs:
2120
* - 0: Image
@@ -36,8 +35,8 @@ class FAST_EXPORT StructuralSimilarityIndexMeasure : public ProcessObject {
3635
* @brief Create instance
3736
* @param maxValue Maximum possible intensity value
3837
* @param minValue Minimum possible intensity value
39-
* @param windowSize Size of Gaussian window
40-
* @param stdDev Standard deviation of Gaussian window
38+
* @param windowSize Size of Gaussian window (in pixels) for each dimension
39+
* @param stdDev Standard deviation of Gaussian window (in pixels) for each dimension
4140
* @param k1 Algorithm constant
4241
* @param k2 Algorithm constant
4342
* @return instance
@@ -55,7 +54,15 @@ class FAST_EXPORT StructuralSimilarityIndexMeasure : public ProcessObject {
5554
* @return
5655
*/
5756
float get() const;
57+
/**
58+
* @brief Set standard deviation of Gaussian window
59+
* @param stdDev Standard deviation for each dimension
60+
*/
5861
void setStandardDeviation(Vector3f stdDev);
62+
/**
63+
* @brief Set size (in pixels) of Gaussian window
64+
* @param size Size for each dimension
65+
*/
5966
void setWindowSize(Vector3i size);
6067
private:
6168
StructuralSimilarityIndexMeasure() {};

source/FAST/DeviceManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,11 @@ bool DeviceManager::deviceHasOpenGLInteropCapability(const cl::Device &device, c
275275
// Get the cl_device_id of the device
276276
cl_device_id deviceID = device();
277277
// Get the platform of device
278+
#if CL_HPP_TARGET_OPENCL_VERSION >= 300
279+
cl_platform_id platformId = device.getInfo<CL_DEVICE_PLATFORM>()();
280+
#else
278281
cl_platform_id platformId = device.getInfo<CL_DEVICE_PLATFORM>();
282+
#endif
279283
// Get all devices that are capable of OpenGL interop with this platform
280284
// Create properties for CL-GL context
281285
#ifdef FAST_MODULE_VISUALIZATION

source/FAST/Tools/CommandLineParser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ void CommandLineParser::parse(const int argc, char ** const argv) {
3434

3535
std::string value = argv[i + 1];
3636
trim(value);
37+
value = stringToLower(value);
3738
if(value == "intel") {
3839
DeviceManager::setDefaultPlatform(DEVICE_PLATFORM_INTEL);
3940
} else if(value == "nvidia") {
@@ -42,6 +43,10 @@ void CommandLineParser::parse(const int argc, char ** const argv) {
4243
DeviceManager::setDefaultPlatform(DEVICE_PLATFORM_AMD);
4344
} else if(value == "pocl") {
4445
DeviceManager::setDefaultPlatform(DEVICE_PLATFORM_POCL);
46+
} else if(value == "mesa") {
47+
DeviceManager::setDefaultPlatform(DEVICE_PLATFORM_MESA);
48+
} else if(value == "openclon12") {
49+
DeviceManager::setDefaultPlatform(DEVICE_PLATFORM_OPENCL_ON_12);
4550
}
4651
++i;
4752
++currentPosition;

0 commit comments

Comments
 (0)