diff --git a/src/MATLAB/+HIP/@Cuda/Closure.m b/src/MATLAB/+HIP/@Cuda/Closure.m index 7b117a0c9acbc5cb1f788536220a367d8629c28b..7c40dbb3824ccf17d1cfd84705c550373b39903d 100644 --- a/src/MATLAB/+HIP/@Cuda/Closure.m +++ b/src/MATLAB/+HIP/@Cuda/Closure.m @@ -1,22 +1,22 @@ -% Closure - This kernel will apply a dilation followed by an erosion. -% [imageOut] = HIP.Cuda.Closure(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -function [imageOut] = Closure(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('Closure',imageIn,kernel,numIterations,device); -end +% Closure - This kernel will apply a dilation followed by an erosion. +% [imageOut] = HIP.Cuda.Closure(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +function [imageOut] = Closure(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('Closure',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Cuda.m b/src/MATLAB/+HIP/@Cuda/Cuda.m index 55d0279658b1fe63fcaf88f99eb4c08d338ee55b..b9b4bf95cb4edeb206f83c0a7284d4c966fae8a3 100644 --- a/src/MATLAB/+HIP/@Cuda/Cuda.m +++ b/src/MATLAB/+HIP/@Cuda/Cuda.m @@ -1,30 +1,30 @@ -classdef (Abstract,Sealed) Cuda -methods (Static) - [imageOut] = Closure(imageIn,kernel,numIterations,device) - [imageOut] = HighPassFilter(imageIn,sigmas,device) - [numCudaDevices,memStats] = DeviceCount() - Help(command) - [minVal,maxVal] = GetMinMax(imageIn,device) - [cmdInfo] = Info() - [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) - [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) - [deviceStatsArray] = DeviceStats() - [imageOut] = ElementWiseDifference(image1In,image2In,device) - [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) - [imageOut] = EntropyFilter(imageIn,kernel,device) - [imageOut] = StdFilter(imageIn,kernel,numIterations,device) - [imageOut] = IdentityFilter(imageIn,device) - [imageOut] = LoG(imageIn,sigmas,device) - [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) - [imageOut] = MinFilter(imageIn,kernel,numIterations,device) - [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) - [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) - [imageOut] = Opener(imageIn,kernel,numIterations,device) - [imageOut] = Sum(imageIn,device) - [imageOut] = VarFilter(imageIn,kernel,numIterations,device) - [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) -end -methods (Static, Access = private) - varargout = Mex(command, varargin) -end -end +classdef (Abstract,Sealed) Cuda +methods (Static) + Help(command) + [cmdInfo] = Info() + [numCudaDevices,memStats] = DeviceCount() + [deviceStatsArray] = DeviceStats() + [imageOut] = ElementWiseDifference(image1In,image2In,device) + [imageOut] = EntropyFilter(imageIn,kernel,device) + [imageOut] = HighPassFilter(imageIn,sigmas,device) + [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) + [imageOut] = Closure(imageIn,kernel,numIterations,device) + [minVal,maxVal] = GetMinMax(imageIn,device) + [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) + [imageOut] = Opener(imageIn,kernel,numIterations,device) + [imageOut] = IdentityFilter(imageIn,device) + [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) + [imageOut] = LoG(imageIn,sigmas,device) + [imageOut] = StdFilter(imageIn,kernel,numIterations,device) + [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) + [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) + [imageOut] = MinFilter(imageIn,kernel,numIterations,device) + [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) + [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) + [imageOut] = Sum(imageIn,device) + [imageOut] = VarFilter(imageIn,kernel,numIterations,device) +end +methods (Static, Access = private) + varargout = Mex(command, varargin) +end +end diff --git a/src/MATLAB/+HIP/@Cuda/DeviceCount.m b/src/MATLAB/+HIP/@Cuda/DeviceCount.m index 9f122b9b42b5ecb67722f5594a5addc5e8abeff2..26b0ace7837047c34f5481e9c96df3bd3bce3234 100644 --- a/src/MATLAB/+HIP/@Cuda/DeviceCount.m +++ b/src/MATLAB/+HIP/@Cuda/DeviceCount.m @@ -1,9 +1,9 @@ -% DeviceCount - This will return the number of Cuda devices available, and their memory. -% [numCudaDevices,memStats] = HIP.Cuda.DeviceCount() -% NumCudaDevices -- this is the number of Cuda devices available. -% MemoryStats -- this is an array of structures where each entry corresponds to a Cuda device. -% The memory structure contains the total memory on the device and the memory available for a Cuda call. -% -function [numCudaDevices,memStats] = DeviceCount() - [numCudaDevices,memStats] = HIP.Cuda.Mex('DeviceCount'); -end +% DeviceCount - This will return the number of Cuda devices available, and their memory. +% [numCudaDevices,memStats] = HIP.Cuda.DeviceCount() +% NumCudaDevices -- this is the number of Cuda devices available. +% MemoryStats -- this is an array of structures where each entry corresponds to a Cuda device. +% The memory structure contains the total memory on the device and the memory available for a Cuda call. +% +function [numCudaDevices,memStats] = DeviceCount() + [numCudaDevices,memStats] = HIP.Cuda.Mex('DeviceCount'); +end diff --git a/src/MATLAB/+HIP/@Cuda/DeviceStats.m b/src/MATLAB/+HIP/@Cuda/DeviceStats.m index cf26589e970c7cc698253a1b2d819ec91de63e9f..62710ca62b0f4e3eb1bf15a57c1fe3bddcd63165 100644 --- a/src/MATLAB/+HIP/@Cuda/DeviceStats.m +++ b/src/MATLAB/+HIP/@Cuda/DeviceStats.m @@ -1,7 +1,7 @@ -% DeviceStats - This will return the statistics of each Cuda capable device installed. -% [deviceStatsArray] = HIP.Cuda.DeviceStats() -% DeviceStatsArray -- this is an array of structs, one struct per device. -% The struct has these fields: name, major, minor, constMem, sharedMem, totalMem, tccDriver, mpCount, threadsPerMP, warpSize, maxThreads. -function [deviceStatsArray] = DeviceStats() - [deviceStatsArray] = HIP.Cuda.Mex('DeviceStats'); -end +% DeviceStats - This will return the statistics of each Cuda capable device installed. +% [deviceStatsArray] = HIP.Cuda.DeviceStats() +% DeviceStatsArray -- this is an array of structs, one struct per device. +% The struct has these fields: name, major, minor, constMem, sharedMem, totalMem, tccDriver, mpCount, threadsPerMP, warpSize, maxThreads. +function [deviceStatsArray] = DeviceStats() + [deviceStatsArray] = HIP.Cuda.Mex('DeviceStats'); +end diff --git a/src/MATLAB/+HIP/@Cuda/ElementWiseDifference.m b/src/MATLAB/+HIP/@Cuda/ElementWiseDifference.m index feb496d98579c825370604530d6f497097a51f30..52bbcb81d84254a7ef20ae488aa147583fe522f2 100644 --- a/src/MATLAB/+HIP/@Cuda/ElementWiseDifference.m +++ b/src/MATLAB/+HIP/@Cuda/ElementWiseDifference.m @@ -1,18 +1,18 @@ -% ElementWiseDifference - This subtracts the second array from the first, element by element (A-B). -% [imageOut] = HIP.Cuda.ElementWiseDifference(image1In,image2In,[device]) -% image1In = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% image2In = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -function [imageOut] = ElementWiseDifference(image1In,image2In,device) - [imageOut] = HIP.Cuda.Mex('ElementWiseDifference',image1In,image2In,device); -end +% ElementWiseDifference - This subtracts the second array from the first, element by element (A-B). +% [imageOut] = HIP.Cuda.ElementWiseDifference(image1In,image2In,[device]) +% image1In = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% image2In = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +function [imageOut] = ElementWiseDifference(image1In,image2In,device) + [imageOut] = HIP.Cuda.Mex('ElementWiseDifference',image1In,image2In,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/EntropyFilter.m b/src/MATLAB/+HIP/@Cuda/EntropyFilter.m index 2163ca6eb832d8599e02ce870fc6a051c1c68ab3..e3d31ecb37f89b2132655ad11a8569557a93ab88 100644 --- a/src/MATLAB/+HIP/@Cuda/EntropyFilter.m +++ b/src/MATLAB/+HIP/@Cuda/EntropyFilter.m @@ -1,19 +1,19 @@ -% EntropyFilter - This calculates the entropy within the neighborhood given by the kernel. -% [imageOut] = HIP.Cuda.EntropyFilter(imageIn,kernel,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = EntropyFilter(imageIn,kernel,device) - [imageOut] = HIP.Cuda.Mex('EntropyFilter',imageIn,kernel,device); -end +% EntropyFilter - This calculates the entropy within the neighborhood given by the kernel. +% [imageOut] = HIP.Cuda.EntropyFilter(imageIn,kernel,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = EntropyFilter(imageIn,kernel,device) + [imageOut] = HIP.Cuda.Mex('EntropyFilter',imageIn,kernel,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Gaussian.m b/src/MATLAB/+HIP/@Cuda/Gaussian.m index 193d5bd0bba78452fb22b5ddeaec33c76ea4e971..92e6fa345fc973e5270531a41ae4c515f638e656 100644 --- a/src/MATLAB/+HIP/@Cuda/Gaussian.m +++ b/src/MATLAB/+HIP/@Cuda/Gaussian.m @@ -1,22 +1,22 @@ -% Gaussian - Gaussian smoothing. -% [imageOut] = HIP.Cuda.Gaussian(imageIn,sigmas,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) - [imageOut] = HIP.Cuda.Mex('Gaussian',imageIn,sigmas,numIterations,device); -end +% Gaussian - Gaussian smoothing. +% [imageOut] = HIP.Cuda.Gaussian(imageIn,sigmas,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) + [imageOut] = HIP.Cuda.Mex('Gaussian',imageIn,sigmas,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/GetMinMax.m b/src/MATLAB/+HIP/@Cuda/GetMinMax.m index 4c991765ca35c86fa9110f3747c6768413c2dacc..b06dd63e9335b523b9de610e630c0496feb844c6 100644 --- a/src/MATLAB/+HIP/@Cuda/GetMinMax.m +++ b/src/MATLAB/+HIP/@Cuda/GetMinMax.m @@ -1,14 +1,14 @@ -% GetMinMax - This function finds the lowest and highest value in the array that is passed in. -% [minVal,maxVal] = HIP.Cuda.GetMinMax(imageIn,[device]) -% imageIn = This is a one to five dimensional array. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% minValue = This is the lowest value found in the array. -% maxValue = This is the highest value found in the array. -% -function [minVal,maxVal] = GetMinMax(imageIn,device) - [minVal,maxVal] = HIP.Cuda.Mex('GetMinMax',imageIn,device); -end +% GetMinMax - This function finds the lowest and highest value in the array that is passed in. +% [minVal,maxVal] = HIP.Cuda.GetMinMax(imageIn,[device]) +% imageIn = This is a one to five dimensional array. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% minValue = This is the lowest value found in the array. +% maxValue = This is the highest value found in the array. +% +function [minVal,maxVal] = GetMinMax(imageIn,device) + [minVal,maxVal] = HIP.Cuda.Mex('GetMinMax',imageIn,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Help.m b/src/MATLAB/+HIP/@Cuda/Help.m index f0cbf1bf8d2b3833dc67aad45756558cb9760e4d..2daacbdbdf7078392a015621393baa66c35b8ad1 100644 --- a/src/MATLAB/+HIP/@Cuda/Help.m +++ b/src/MATLAB/+HIP/@Cuda/Help.m @@ -1,5 +1,5 @@ -% Help - Print detailed usage information for the specified command. -% HIP.Cuda.Help([command]) -function Help(command) - HIP.Cuda.Mex('Help',command); -end +% Help - Print detailed usage information for the specified command. +% HIP.Cuda.Help([command]) +function Help(command) + HIP.Cuda.Mex('Help',command); +end diff --git a/src/MATLAB/+HIP/@Cuda/HighPassFilter.m b/src/MATLAB/+HIP/@Cuda/HighPassFilter.m index 6521ed792e114db1fab632d0e690b482d083339c..e795bae55cf5da9c69650d235e6969ada24e9665 100644 --- a/src/MATLAB/+HIP/@Cuda/HighPassFilter.m +++ b/src/MATLAB/+HIP/@Cuda/HighPassFilter.m @@ -1,18 +1,18 @@ -% HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided. -% [imageOut] = HIP.Cuda.HighPassFilter(imageIn,sigmas,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = HighPassFilter(imageIn,sigmas,device) - [imageOut] = HIP.Cuda.Mex('HighPassFilter',imageIn,sigmas,device); -end +% HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided. +% [imageOut] = HIP.Cuda.HighPassFilter(imageIn,sigmas,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = HighPassFilter(imageIn,sigmas,device) + [imageOut] = HIP.Cuda.Mex('HighPassFilter',imageIn,sigmas,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/IdentityFilter.m b/src/MATLAB/+HIP/@Cuda/IdentityFilter.m index 18a4c0b5daf1fb0292d67e2cadc1840913de78e5..79955722436954c0a0f445429df263dc5be9c858 100644 --- a/src/MATLAB/+HIP/@Cuda/IdentityFilter.m +++ b/src/MATLAB/+HIP/@Cuda/IdentityFilter.m @@ -1,15 +1,15 @@ -% IdentityFilter - Identity Filter for testing. Copies image data to GPU memory and back into output image. -% [imageOut] = HIP.Cuda.IdentityFilter(imageIn,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = IdentityFilter(imageIn,device) - [imageOut] = HIP.Cuda.Mex('IdentityFilter',imageIn,device); -end +% IdentityFilter - Identity Filter for testing. Copies image data to GPU memory and back into output image. +% [imageOut] = HIP.Cuda.IdentityFilter(imageIn,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = IdentityFilter(imageIn,device) + [imageOut] = HIP.Cuda.Mex('IdentityFilter',imageIn,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Info.m b/src/MATLAB/+HIP/@Cuda/Info.m index 78f71b3e197b8a8f2c40f468749a9bcb8979e625..a59edcf51c2f1e0a19c44679bb331fbe3b46d1b2 100644 --- a/src/MATLAB/+HIP/@Cuda/Info.m +++ b/src/MATLAB/+HIP/@Cuda/Info.m @@ -1,11 +1,11 @@ -% Info - Get information on all available mex commands. -% [cmdInfo] = HIP.Cuda.Info() -% Returns commandInfo structure array containing information on all mex commands. -% commandInfo.command - Command string -% commandInfo.outArgs - Comma-delimited string list of output arguments -% commandInfo.inArgs - Comma-delimited string list of input arguments -% commandInfo.helpLines - Help string -% -function [cmdInfo] = Info() - [cmdInfo] = HIP.Cuda.Mex('Info'); -end +% Info - Get information on all available mex commands. +% [cmdInfo] = HIP.Cuda.Info() +% Returns commandInfo structure array containing information on all mex commands. +% commandInfo.command - Command string +% commandInfo.outArgs - Comma-delimited string list of output arguments +% commandInfo.inArgs - Comma-delimited string list of input arguments +% commandInfo.helpLines - Help string +% +function [cmdInfo] = Info() + [cmdInfo] = HIP.Cuda.Mex('Info'); +end diff --git a/src/MATLAB/+HIP/@Cuda/LoG.m b/src/MATLAB/+HIP/@Cuda/LoG.m index ae52f7ea9caf18ba1dcd19e2401392ea427cee42..e0dff78fc6ad990db400b2dd06ae3af6657914f3 100644 --- a/src/MATLAB/+HIP/@Cuda/LoG.m +++ b/src/MATLAB/+HIP/@Cuda/LoG.m @@ -1,18 +1,18 @@ -% LoG - Apply a Lapplacian of Gaussian filter with the given sigmas. -% [imageOut] = HIP.Cuda.LoG(imageIn,sigmas,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = LoG(imageIn,sigmas,device) - [imageOut] = HIP.Cuda.Mex('LoG',imageIn,sigmas,device); -end +% LoG - Apply a Lapplacian of Gaussian filter with the given sigmas. +% [imageOut] = HIP.Cuda.LoG(imageIn,sigmas,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = LoG(imageIn,sigmas,device) + [imageOut] = HIP.Cuda.Mex('LoG',imageIn,sigmas,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/MaxFilter.m b/src/MATLAB/+HIP/@Cuda/MaxFilter.m index f18484e15f9b102ba7f6dd8cd0337c75e3c58fd1..077a6c3b65c89d96d2ec5a39842af7edf7290373 100644 --- a/src/MATLAB/+HIP/@Cuda/MaxFilter.m +++ b/src/MATLAB/+HIP/@Cuda/MaxFilter.m @@ -1,23 +1,23 @@ -% MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. -% [imageOut] = HIP.Cuda.MaxFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('MaxFilter',imageIn,kernel,numIterations,device); -end +% MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. +% [imageOut] = HIP.Cuda.MaxFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('MaxFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/MeanFilter.m b/src/MATLAB/+HIP/@Cuda/MeanFilter.m index a320f60aee203726668fbf9bf7a4fbf3ea6be365..a3a00ee58aaa4d71cb038d869aabcb33cdbea5bb 100644 --- a/src/MATLAB/+HIP/@Cuda/MeanFilter.m +++ b/src/MATLAB/+HIP/@Cuda/MeanFilter.m @@ -1,23 +1,23 @@ -% MeanFilter - This will take the mean of the given neighborhood. -% [imageOut] = HIP.Cuda.MeanFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('MeanFilter',imageIn,kernel,numIterations,device); -end +% MeanFilter - This will take the mean of the given neighborhood. +% [imageOut] = HIP.Cuda.MeanFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('MeanFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/MedianFilter.m b/src/MATLAB/+HIP/@Cuda/MedianFilter.m index 8ab521099e5ff9ef1420fe2ebbce1bca34bb4389..e7436d1762d93f4d95be8cf0598baa5facf536ee 100644 --- a/src/MATLAB/+HIP/@Cuda/MedianFilter.m +++ b/src/MATLAB/+HIP/@Cuda/MedianFilter.m @@ -1,23 +1,23 @@ -% MedianFilter - This will calculate the median for each neighborhood defined by the kernel. -% [imageOut] = HIP.Cuda.MedianFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('MedianFilter',imageIn,kernel,numIterations,device); -end +% MedianFilter - This will calculate the median for each neighborhood defined by the kernel. +% [imageOut] = HIP.Cuda.MedianFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('MedianFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Mex.mexa64 b/src/MATLAB/+HIP/@Cuda/Mex.mexa64 new file mode 100755 index 0000000000000000000000000000000000000000..3def436ab95e30defbeb9c51ddb6dc741df5a108 Binary files /dev/null and b/src/MATLAB/+HIP/@Cuda/Mex.mexa64 differ diff --git a/src/MATLAB/+HIP/@Cuda/MinFilter.m b/src/MATLAB/+HIP/@Cuda/MinFilter.m index 95926fa6d375381f0d1299ad6972b8c3a293b524..5f35fb68b1f2313166ea57baf13672de29defc0a 100644 --- a/src/MATLAB/+HIP/@Cuda/MinFilter.m +++ b/src/MATLAB/+HIP/@Cuda/MinFilter.m @@ -1,23 +1,23 @@ -% MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. -% [imageOut] = HIP.Cuda.MinFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = MinFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('MinFilter',imageIn,kernel,numIterations,device); -end +% MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. +% [imageOut] = HIP.Cuda.MinFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = MinFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('MinFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/MultiplySum.m b/src/MATLAB/+HIP/@Cuda/MultiplySum.m index aee49c1fbd4389ed93e51322338eae9e71ea3771..2d0bc1d07e06ef99ad5516deed8b40d1fcb9f59b 100644 --- a/src/MATLAB/+HIP/@Cuda/MultiplySum.m +++ b/src/MATLAB/+HIP/@Cuda/MultiplySum.m @@ -1,23 +1,23 @@ -% MultiplySum - Multiplies the kernel with the neighboring values and sums these new values. -% [imageOut] = HIP.Cuda.MultiplySum(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('MultiplySum',imageIn,kernel,numIterations,device); -end +% MultiplySum - Multiplies the kernel with the neighboring values and sums these new values. +% [imageOut] = HIP.Cuda.MultiplySum(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('MultiplySum',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/NLMeans.m b/src/MATLAB/+HIP/@Cuda/NLMeans.m index e111bfb162b6c35387f30b901d13c01a4e259a02..f89d7f92b3a938d7e9c10eb039f38be73f2e69f5 100644 --- a/src/MATLAB/+HIP/@Cuda/NLMeans.m +++ b/src/MATLAB/+HIP/@Cuda/NLMeans.m @@ -1,15 +1,15 @@ -% NLMeans - Apply an approximate non-local means filter using patch mean and covariance with Fisher discrminant distance -% [imageOut] = HIP.Cuda.NLMeans(imageIn,h,[searchWindowRadius],[nhoodRadius],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% h = weighting applied to patch difference function. typically e.g. 0.05-0.1. controls the amount of smoothing. -% -% searchWindowRadius = radius of region to locate patches at. -% -% nhoodRadius = radius of patch size (comparison window). -% -function [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) - [imageOut] = HIP.Cuda.Mex('NLMeans',imageIn,h,searchWindowRadius,nhoodRadius,device); -end +% NLMeans - Apply an approximate non-local means filter using patch mean and covariance with Fisher discrminant distance +% [imageOut] = HIP.Cuda.NLMeans(imageIn,h,[searchWindowRadius],[nhoodRadius],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% h = weighting applied to patch difference function. typically e.g. 0.05-0.1. controls the amount of smoothing. +% +% searchWindowRadius = radius of region to locate patches at. +% +% nhoodRadius = radius of patch size (comparison window). +% +function [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) + [imageOut] = HIP.Cuda.Mex('NLMeans',imageIn,h,searchWindowRadius,nhoodRadius,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Opener.m b/src/MATLAB/+HIP/@Cuda/Opener.m index 0ad78e77c99bdba3ba6a05bc0d6363df6f941426..b4baee782100e4dc2f555f8c2a3d821c16659dd3 100644 --- a/src/MATLAB/+HIP/@Cuda/Opener.m +++ b/src/MATLAB/+HIP/@Cuda/Opener.m @@ -1,23 +1,23 @@ -% Opener - This kernel will erode follow by a dilation. -% [imageOut] = HIP.Cuda.Opener(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = Opener(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('Opener',imageIn,kernel,numIterations,device); -end +% Opener - This kernel will erode follow by a dilation. +% [imageOut] = HIP.Cuda.Opener(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = Opener(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('Opener',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/StdFilter.m b/src/MATLAB/+HIP/@Cuda/StdFilter.m index 117601ee19a88ff623da4bd12e88f3f209536f8c..27f358a1716f6529a13ea97b5bb9640d352f8afb 100644 --- a/src/MATLAB/+HIP/@Cuda/StdFilter.m +++ b/src/MATLAB/+HIP/@Cuda/StdFilter.m @@ -1,23 +1,23 @@ -% StdFilter - This will take the standard deviation of the given neighborhood. -% [imageOut] = HIP.Cuda.StdFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = StdFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('StdFilter',imageIn,kernel,numIterations,device); -end +% StdFilter - This will take the standard deviation of the given neighborhood. +% [imageOut] = HIP.Cuda.StdFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = StdFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('StdFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/Sum.m b/src/MATLAB/+HIP/@Cuda/Sum.m index c2b402808bcaf21c4d73a45e42e4feb1e72e3bb4..12a272ce26e37b5f747a6c56c47fa34eea7b14ca 100644 --- a/src/MATLAB/+HIP/@Cuda/Sum.m +++ b/src/MATLAB/+HIP/@Cuda/Sum.m @@ -1,15 +1,15 @@ -% Sum - This sums up the entire array in. -% [imageOut] = HIP.Cuda.Sum(imageIn,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% valueOut = This is the summation of the entire array. -% -function [imageOut] = Sum(imageIn,device) - [imageOut] = HIP.Cuda.Mex('Sum',imageIn,device); -end +% Sum - This sums up the entire array in. +% [imageOut] = HIP.Cuda.Sum(imageIn,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% valueOut = This is the summation of the entire array. +% +function [imageOut] = Sum(imageIn,device) + [imageOut] = HIP.Cuda.Mex('Sum',imageIn,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/VarFilter.m b/src/MATLAB/+HIP/@Cuda/VarFilter.m index baedcee4eeaf012faa7adbd8f43b9c275e45344a..638197b0a6fe8691ba8866cee8bd954cfab89921 100644 --- a/src/MATLAB/+HIP/@Cuda/VarFilter.m +++ b/src/MATLAB/+HIP/@Cuda/VarFilter.m @@ -1,23 +1,23 @@ -% VarFilter - This will take the variance deviation of the given neighborhood. -% [imageOut] = HIP.Cuda.VarFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = VarFilter(imageIn,kernel,numIterations,device) - [imageOut] = HIP.Cuda.Mex('VarFilter',imageIn,kernel,numIterations,device); -end +% VarFilter - This will take the variance deviation of the given neighborhood. +% [imageOut] = HIP.Cuda.VarFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = VarFilter(imageIn,kernel,numIterations,device) + [imageOut] = HIP.Cuda.Mex('VarFilter',imageIn,kernel,numIterations,device); +end diff --git a/src/MATLAB/+HIP/@Cuda/WienerFilter.m b/src/MATLAB/+HIP/@Cuda/WienerFilter.m index 76214ef99480a2c0955947db2d7d42a42545ee04..1a43af9630e9065cbc06a99c368f3a7b2f6ea4f6 100644 --- a/src/MATLAB/+HIP/@Cuda/WienerFilter.m +++ b/src/MATLAB/+HIP/@Cuda/WienerFilter.m @@ -1,23 +1,23 @@ -% WienerFilter - A Wiener filter aims to denoise an image in a linear fashion. -% [imageOut] = HIP.Cuda.WienerFilter(imageIn,kernel,[noiseVariance],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel (optional) = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the neighborhood. -% This can be an empty array [] and which will use a 3x3x3 neighborhood (or equivalent given input dimension). -% -% noiseVariance (optional) = This is the expected variance of the noise. -% This should be a scalar value or an empty array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% -function [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) - [imageOut] = HIP.Cuda.Mex('WienerFilter',imageIn,kernel,noiseVariance,device); -end +% WienerFilter - A Wiener filter aims to denoise an image in a linear fashion. +% [imageOut] = HIP.Cuda.WienerFilter(imageIn,kernel,[noiseVariance],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel (optional) = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the neighborhood. +% This can be an empty array [] and which will use a 3x3x3 neighborhood (or equivalent given input dimension). +% +% noiseVariance (optional) = This is the expected variance of the noise. +% This should be a scalar value or an empty array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% +function [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) + [imageOut] = HIP.Cuda.Mex('WienerFilter',imageIn,kernel,noiseVariance,device); +end diff --git a/src/MATLAB/+HIP/Closure.m b/src/MATLAB/+HIP/Closure.m index 9030db165b16b0a5e4c46762d924a4dd138e4d53..9e1121b75521e8c2d7cfb24391b45898486e12df 100644 --- a/src/MATLAB/+HIP/Closure.m +++ b/src/MATLAB/+HIP/Closure.m @@ -1,28 +1,28 @@ -% Closure - This kernel will apply a dilation followed by an erosion. -% [imageOut] = HIP.Closure(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. - -function [imageOut] = Closure(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.Closure(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.Closure(imageIn,kernel,numIterations,device); - end -end +% Closure - This kernel will apply a dilation followed by an erosion. +% [imageOut] = HIP.Closure(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. + +function [imageOut] = Closure(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.Closure(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.Closure(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/ElementWiseDifference.m b/src/MATLAB/+HIP/ElementWiseDifference.m index 245aa309e5da575c8ce605d2fef32562207ae594..b09b6696d94a90f7dd4673a7d05e769cd32b6d07 100644 --- a/src/MATLAB/+HIP/ElementWiseDifference.m +++ b/src/MATLAB/+HIP/ElementWiseDifference.m @@ -1,24 +1,24 @@ -% ElementWiseDifference - This subtracts the second array from the first, element by element (A-B). -% [imageOut] = HIP.ElementWiseDifference(image1In,image2In,[device]) -% image1In = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% image2In = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. - -function [imageOut] = ElementWiseDifference(image1In,image2In,device) - try - [imageOut] = HIP.Cuda.ElementWiseDifference(image1In,image2In,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.ElementWiseDifference(image1In,image2In,device); - end -end +% ElementWiseDifference - This subtracts the second array from the first, element by element (A-B). +% [imageOut] = HIP.ElementWiseDifference(image1In,image2In,[device]) +% image1In = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% image2In = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. + +function [imageOut] = ElementWiseDifference(image1In,image2In,device) + try + [imageOut] = HIP.Cuda.ElementWiseDifference(image1In,image2In,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.ElementWiseDifference(image1In,image2In,device); + end +end diff --git a/src/MATLAB/+HIP/EntropyFilter.m b/src/MATLAB/+HIP/EntropyFilter.m index e138e057dd00d1a63e2aa5d6c9deee3939b53839..22834ce8008a1ade113dcc92f23d709e61ae2deb 100644 --- a/src/MATLAB/+HIP/EntropyFilter.m +++ b/src/MATLAB/+HIP/EntropyFilter.m @@ -1,25 +1,25 @@ -% EntropyFilter - This calculates the entropy within the neighborhood given by the kernel. -% [imageOut] = HIP.EntropyFilter(imageIn,kernel,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = EntropyFilter(imageIn,kernel,device) - try - [imageOut] = HIP.Cuda.EntropyFilter(imageIn,kernel,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.EntropyFilter(imageIn,kernel,device); - end -end +% EntropyFilter - This calculates the entropy within the neighborhood given by the kernel. +% [imageOut] = HIP.EntropyFilter(imageIn,kernel,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = EntropyFilter(imageIn,kernel,device) + try + [imageOut] = HIP.Cuda.EntropyFilter(imageIn,kernel,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.EntropyFilter(imageIn,kernel,device); + end +end diff --git a/src/MATLAB/+HIP/Gaussian.m b/src/MATLAB/+HIP/Gaussian.m index 86f4ca1cd1d365e71949313c04e2d53114af3497..9bfc841a6c92c88af1ca469bb66726e849e61a03 100644 --- a/src/MATLAB/+HIP/Gaussian.m +++ b/src/MATLAB/+HIP/Gaussian.m @@ -1,28 +1,28 @@ -% Gaussian - Gaussian smoothing. -% [imageOut] = HIP.Gaussian(imageIn,sigmas,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) - try - [imageOut] = HIP.Cuda.Gaussian(imageIn,sigmas,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.Gaussian(imageIn,sigmas,numIterations,device); - end -end +% Gaussian - Gaussian smoothing. +% [imageOut] = HIP.Gaussian(imageIn,sigmas,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = Gaussian(imageIn,sigmas,numIterations,device) + try + [imageOut] = HIP.Cuda.Gaussian(imageIn,sigmas,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.Gaussian(imageIn,sigmas,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/GetMinMax.m b/src/MATLAB/+HIP/GetMinMax.m index 001a0014974c79bab6cf0ac4b8d3455ff40ebb82..3aa37bd53626af32c16b0d9ce3792d98677f35ad 100644 --- a/src/MATLAB/+HIP/GetMinMax.m +++ b/src/MATLAB/+HIP/GetMinMax.m @@ -1,20 +1,20 @@ -% GetMinMax - This function finds the lowest and highest value in the array that is passed in. -% [minVal,maxVal] = HIP.GetMinMax(imageIn,[device]) -% imageIn = This is a one to five dimensional array. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% minValue = This is the lowest value found in the array. -% maxValue = This is the highest value found in the array. -% - -function [minVal,maxVal] = GetMinMax(imageIn,device) - try - [minVal,maxVal] = HIP.Cuda.GetMinMax(imageIn,device); - catch errMsg - warning(errMsg.message); - [minVal,maxVal] = HIP.Local.GetMinMax(imageIn,device); - end -end +% GetMinMax - This function finds the lowest and highest value in the array that is passed in. +% [minVal,maxVal] = HIP.GetMinMax(imageIn,[device]) +% imageIn = This is a one to five dimensional array. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% minValue = This is the lowest value found in the array. +% maxValue = This is the highest value found in the array. +% + +function [minVal,maxVal] = GetMinMax(imageIn,device) + try + [minVal,maxVal] = HIP.Cuda.GetMinMax(imageIn,device); + catch errMsg + warning(errMsg.message); + [minVal,maxVal] = HIP.Local.GetMinMax(imageIn,device); + end +end diff --git a/src/MATLAB/+HIP/Help.m b/src/MATLAB/+HIP/Help.m index 68c0135c35098332aaeba53f6ba6610ce1e76f7f..cf717d33694ffeab3a41e4e67a293153bc30a7ac 100644 --- a/src/MATLAB/+HIP/Help.m +++ b/src/MATLAB/+HIP/Help.m @@ -1,4 +1,4 @@ -% Help - Print detailed usage information for the specified command. -% HIP.Help([command]) -function Help(command) -end +% Help - Print detailed usage information for the specified command. +% HIP.Help([command]) +function Help(command) +end diff --git a/src/MATLAB/+HIP/HighPassFilter.m b/src/MATLAB/+HIP/HighPassFilter.m index e953c24a0452df0516940859f4b096f56b530f87..a90189ed02d51f8b40e6930f2c99595dad825465 100644 --- a/src/MATLAB/+HIP/HighPassFilter.m +++ b/src/MATLAB/+HIP/HighPassFilter.m @@ -1,24 +1,24 @@ -% HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided. -% [imageOut] = HIP.HighPassFilter(imageIn,sigmas,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = HighPassFilter(imageIn,sigmas,device) - try - [imageOut] = HIP.Cuda.HighPassFilter(imageIn,sigmas,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.HighPassFilter(imageIn,sigmas,device); - end -end +% HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided. +% [imageOut] = HIP.HighPassFilter(imageIn,sigmas,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = HighPassFilter(imageIn,sigmas,device) + try + [imageOut] = HIP.Cuda.HighPassFilter(imageIn,sigmas,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.HighPassFilter(imageIn,sigmas,device); + end +end diff --git a/src/MATLAB/+HIP/IdentityFilter.m b/src/MATLAB/+HIP/IdentityFilter.m index f1896ccd333c842034f464eab09a4bf3cc007e9e..12fefae6586fc76467fe115cc484109f778d1ce0 100644 --- a/src/MATLAB/+HIP/IdentityFilter.m +++ b/src/MATLAB/+HIP/IdentityFilter.m @@ -1,21 +1,21 @@ -% IdentityFilter - Identity Filter for testing. Copies image data to GPU memory and back into output image. -% [imageOut] = HIP.IdentityFilter(imageIn,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = IdentityFilter(imageIn,device) - try - [imageOut] = HIP.Cuda.IdentityFilter(imageIn,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.IdentityFilter(imageIn,device); - end -end +% IdentityFilter - Identity Filter for testing. Copies image data to GPU memory and back into output image. +% [imageOut] = HIP.IdentityFilter(imageIn,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = IdentityFilter(imageIn,device) + try + [imageOut] = HIP.Cuda.IdentityFilter(imageIn,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.IdentityFilter(imageIn,device); + end +end diff --git a/src/MATLAB/+HIP/Info.m b/src/MATLAB/+HIP/Info.m index 4f902485f30f98d33f5e616365038408cbfb7640..8c867debca80ad4cf759a6652d8217e58326215f 100644 --- a/src/MATLAB/+HIP/Info.m +++ b/src/MATLAB/+HIP/Info.m @@ -1,17 +1,17 @@ -% Info - Get information on all available mex commands. -% [cmdInfo] = HIP.Info() -% Returns commandInfo structure array containing information on all mex commands. -% commandInfo.command - Command string -% commandInfo.outArgs - Comma-delimited string list of output arguments -% commandInfo.inArgs - Comma-delimited string list of input arguments -% commandInfo.helpLines - Help string -% - -function [cmdInfo] = Info() - try - [cmdInfo] = HIP.Cuda.Info(); - catch errMsg - warning(errMsg.message); - [cmdInfo] = HIP.Local.Info(); - end -end +% Info - Get information on all available mex commands. +% [cmdInfo] = HIP.Info() +% Returns commandInfo structure array containing information on all mex commands. +% commandInfo.command - Command string +% commandInfo.outArgs - Comma-delimited string list of output arguments +% commandInfo.inArgs - Comma-delimited string list of input arguments +% commandInfo.helpLines - Help string +% + +function [cmdInfo] = Info() + try + [cmdInfo] = HIP.Cuda.Info(); + catch errMsg + warning(errMsg.message); + [cmdInfo] = HIP.Local.Info(); + end +end diff --git a/src/MATLAB/+HIP/LoG.m b/src/MATLAB/+HIP/LoG.m index 754ce097a941105f900292cd6afb9bea23470c74..6cb94a63c44bc1793ffffaa7faf00d9708626ad9 100644 --- a/src/MATLAB/+HIP/LoG.m +++ b/src/MATLAB/+HIP/LoG.m @@ -1,24 +1,24 @@ -% LoG - Apply a Lapplacian of Gaussian filter with the given sigmas. -% [imageOut] = HIP.LoG(imageIn,sigmas,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. -% Zeros (0) in this array will not smooth in that direction. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = LoG(imageIn,sigmas,device) - try - [imageOut] = HIP.Cuda.LoG(imageIn,sigmas,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.LoG(imageIn,sigmas,device); - end -end +% LoG - Apply a Lapplacian of Gaussian filter with the given sigmas. +% [imageOut] = HIP.LoG(imageIn,sigmas,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% Sigmas = This should be an array of three positive values that represent the standard deviation of a Gaussian curve. +% Zeros (0) in this array will not smooth in that direction. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = LoG(imageIn,sigmas,device) + try + [imageOut] = HIP.Cuda.LoG(imageIn,sigmas,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.LoG(imageIn,sigmas,device); + end +end diff --git a/src/MATLAB/+HIP/MaxFilter.m b/src/MATLAB/+HIP/MaxFilter.m index 2fb418841787704ce0afa5da0222f62ce2921403..320a3022af3b17e1d3cf2d0c052296e8537ea4e4 100644 --- a/src/MATLAB/+HIP/MaxFilter.m +++ b/src/MATLAB/+HIP/MaxFilter.m @@ -1,29 +1,29 @@ -% MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. -% [imageOut] = HIP.MaxFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.MaxFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.MaxFilter(imageIn,kernel,numIterations,device); - end -end +% MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. +% [imageOut] = HIP.MaxFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = MaxFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.MaxFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.MaxFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/MeanFilter.m b/src/MATLAB/+HIP/MeanFilter.m index 8bb84a61ef48d0afe1a49f791aa023ad15e209e5..8b681294101a19d995bebc7dbde9958a40ce90c9 100644 --- a/src/MATLAB/+HIP/MeanFilter.m +++ b/src/MATLAB/+HIP/MeanFilter.m @@ -1,29 +1,29 @@ -% MeanFilter - This will take the mean of the given neighborhood. -% [imageOut] = HIP.MeanFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.MeanFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.MeanFilter(imageIn,kernel,numIterations,device); - end -end +% MeanFilter - This will take the mean of the given neighborhood. +% [imageOut] = HIP.MeanFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = MeanFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.MeanFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.MeanFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/MedianFilter.m b/src/MATLAB/+HIP/MedianFilter.m index 7adc1a207f2f1eec784bc8f2a972d6b5d8c29d3b..0a12d4c2b0d7ddde73cce6018ef0ebecc7ad370e 100644 --- a/src/MATLAB/+HIP/MedianFilter.m +++ b/src/MATLAB/+HIP/MedianFilter.m @@ -1,29 +1,29 @@ -% MedianFilter - This will calculate the median for each neighborhood defined by the kernel. -% [imageOut] = HIP.MedianFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.MedianFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.MedianFilter(imageIn,kernel,numIterations,device); - end -end +% MedianFilter - This will calculate the median for each neighborhood defined by the kernel. +% [imageOut] = HIP.MedianFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = MedianFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.MedianFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.MedianFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/MinFilter.m b/src/MATLAB/+HIP/MinFilter.m index c59ee2d63536286a1e949ada78b5e00dc878bd13..48b3ffbd8a07ad1b9b6b597f2cf756dae71a2fb3 100644 --- a/src/MATLAB/+HIP/MinFilter.m +++ b/src/MATLAB/+HIP/MinFilter.m @@ -1,29 +1,29 @@ -% MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. -% [imageOut] = HIP.MinFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = MinFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.MinFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.MinFilter(imageIn,kernel,numIterations,device); - end -end +% MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. +% [imageOut] = HIP.MinFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = MinFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.MinFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.MinFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/MultiplySum.m b/src/MATLAB/+HIP/MultiplySum.m index 6840e70e6dd06e7b602186e64771f5932d84c696..ab6f06ea6359bf48f9c6e2a46d2610dd3e7fb8f6 100644 --- a/src/MATLAB/+HIP/MultiplySum.m +++ b/src/MATLAB/+HIP/MultiplySum.m @@ -1,29 +1,29 @@ -% MultiplySum - Multiplies the kernel with the neighboring values and sums these new values. -% [imageOut] = HIP.MultiplySum(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.MultiplySum(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.MultiplySum(imageIn,kernel,numIterations,device); - end -end +% MultiplySum - Multiplies the kernel with the neighboring values and sums these new values. +% [imageOut] = HIP.MultiplySum(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = MultiplySum(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.MultiplySum(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.MultiplySum(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/NLMeans.m b/src/MATLAB/+HIP/NLMeans.m index dceca363b376a530af317a994058bed3070fd096..39cdc87d3012e847d4ee4f5a12ce9a2efc3f53f4 100644 --- a/src/MATLAB/+HIP/NLMeans.m +++ b/src/MATLAB/+HIP/NLMeans.m @@ -1,21 +1,21 @@ -% NLMeans - Apply an approximate non-local means filter using patch mean and covariance with Fisher discrminant distance -% [imageOut] = HIP.NLMeans(imageIn,h,[searchWindowRadius],[nhoodRadius],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% h = weighting applied to patch difference function. typically e.g. 0.05-0.1. controls the amount of smoothing. -% -% searchWindowRadius = radius of region to locate patches at. -% -% nhoodRadius = radius of patch size (comparison window). -% - -function [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) - try - [imageOut] = HIP.Cuda.NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device); - end -end +% NLMeans - Apply an approximate non-local means filter using patch mean and covariance with Fisher discrminant distance +% [imageOut] = HIP.NLMeans(imageIn,h,[searchWindowRadius],[nhoodRadius],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% h = weighting applied to patch difference function. typically e.g. 0.05-0.1. controls the amount of smoothing. +% +% searchWindowRadius = radius of region to locate patches at. +% +% nhoodRadius = radius of patch size (comparison window). +% + +function [imageOut] = NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device) + try + [imageOut] = HIP.Cuda.NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.NLMeans(imageIn,h,searchWindowRadius,nhoodRadius,device); + end +end diff --git a/src/MATLAB/+HIP/Opener.m b/src/MATLAB/+HIP/Opener.m index 1402bc085e7817849d8245078f79c5decd8eaed5..21f6a5bcb2568fd6e6c9f4c4ab8b251bcca7037a 100644 --- a/src/MATLAB/+HIP/Opener.m +++ b/src/MATLAB/+HIP/Opener.m @@ -1,29 +1,29 @@ -% Opener - This kernel will erode follow by a dilation. -% [imageOut] = HIP.Opener(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = Opener(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.Opener(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.Opener(imageIn,kernel,numIterations,device); - end -end +% Opener - This kernel will erode follow by a dilation. +% [imageOut] = HIP.Opener(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = Opener(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.Opener(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.Opener(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/StdFilter.m b/src/MATLAB/+HIP/StdFilter.m index 499d3893c8b2941aa76a3758442bf1dfa5bf4cec..2fe520c1b9993faf20112483f74236291006f5ed 100644 --- a/src/MATLAB/+HIP/StdFilter.m +++ b/src/MATLAB/+HIP/StdFilter.m @@ -1,29 +1,29 @@ -% StdFilter - This will take the standard deviation of the given neighborhood. -% [imageOut] = HIP.StdFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = StdFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.StdFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.StdFilter(imageIn,kernel,numIterations,device); - end -end +% StdFilter - This will take the standard deviation of the given neighborhood. +% [imageOut] = HIP.StdFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = StdFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.StdFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.StdFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/Sum.m b/src/MATLAB/+HIP/Sum.m index ccb1323fb44b3d76b9817f6447dcd8bc3c3f43ea..68eab89b43caf566748e2c8ad82c13fe1dca2e3f 100644 --- a/src/MATLAB/+HIP/Sum.m +++ b/src/MATLAB/+HIP/Sum.m @@ -1,21 +1,21 @@ -% Sum - This sums up the entire array in. -% [imageOut] = HIP.Sum(imageIn,[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% valueOut = This is the summation of the entire array. -% - -function [imageOut] = Sum(imageIn,device) - try - [imageOut] = HIP.Cuda.Sum(imageIn,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.Sum(imageIn,device); - end -end +% Sum - This sums up the entire array in. +% [imageOut] = HIP.Sum(imageIn,[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% valueOut = This is the summation of the entire array. +% + +function [imageOut] = Sum(imageIn,device) + try + [imageOut] = HIP.Cuda.Sum(imageIn,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.Sum(imageIn,device); + end +end diff --git a/src/MATLAB/+HIP/VarFilter.m b/src/MATLAB/+HIP/VarFilter.m index 8a2480e286fa3cf0de158463cec842c33360f086..1e3d642e3495b3363dc293646b1b1231444ee1ef 100644 --- a/src/MATLAB/+HIP/VarFilter.m +++ b/src/MATLAB/+HIP/VarFilter.m @@ -1,29 +1,29 @@ -% VarFilter - This will take the variance deviation of the given neighborhood. -% [imageOut] = HIP.VarFilter(imageIn,kernel,[numIterations],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the max neighborhood. -% -% numIterations (optional) = This is the number of iterations to run the max filter for a given position. -% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. -% Can be empty an array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = VarFilter(imageIn,kernel,numIterations,device) - try - [imageOut] = HIP.Cuda.VarFilter(imageIn,kernel,numIterations,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.VarFilter(imageIn,kernel,numIterations,device); - end -end +% VarFilter - This will take the variance deviation of the given neighborhood. +% [imageOut] = HIP.VarFilter(imageIn,kernel,[numIterations],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the max neighborhood. +% +% numIterations (optional) = This is the number of iterations to run the max filter for a given position. +% This is useful for growing regions by the shape of the structuring element or for very large neighborhoods. +% Can be empty an array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = VarFilter(imageIn,kernel,numIterations,device) + try + [imageOut] = HIP.Cuda.VarFilter(imageIn,kernel,numIterations,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.VarFilter(imageIn,kernel,numIterations,device); + end +end diff --git a/src/MATLAB/+HIP/WienerFilter.m b/src/MATLAB/+HIP/WienerFilter.m index 82a22cba2c7cf1ec14e94631578d0a2ddd9bc3cb..398311f9678fe758d582bdb44b56ffcd99ce6115 100644 --- a/src/MATLAB/+HIP/WienerFilter.m +++ b/src/MATLAB/+HIP/WienerFilter.m @@ -1,29 +1,29 @@ -% WienerFilter - A Wiener filter aims to denoise an image in a linear fashion. -% [imageOut] = HIP.WienerFilter(imageIn,kernel,[noiseVariance],[device]) -% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. -% The spatial dimensions will have the kernel applied. The last two dimensions will determine -% how to stride or jump to the next spatial block. -% -% kernel (optional) = This is a one to three dimensional array that will be used to determine neighborhood operations. -% In this case, the positions in the kernel that do not equal zeros will be evaluated. -% In other words, this can be viewed as a structuring element for the neighborhood. -% This can be an empty array [] and which will use a 3x3x3 neighborhood (or equivalent given input dimension). -% -% noiseVariance (optional) = This is the expected variance of the noise. -% This should be a scalar value or an empty array []. -% -% device (optional) = Use this if you have multiple devices and want to select one explicitly. -% Setting this to [] allows the algorithm to either pick the best device and/or will try to split -% the data across multiple devices. -% -% imageOut = This will be an array of the same type and shape as the input array. -% - -function [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) - try - [imageOut] = HIP.Cuda.WienerFilter(imageIn,kernel,noiseVariance,device); - catch errMsg - warning(errMsg.message); - [imageOut] = HIP.Local.WienerFilter(imageIn,kernel,noiseVariance,device); - end -end +% WienerFilter - A Wiener filter aims to denoise an image in a linear fashion. +% [imageOut] = HIP.WienerFilter(imageIn,kernel,[noiseVariance],[device]) +% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. +% The spatial dimensions will have the kernel applied. The last two dimensions will determine +% how to stride or jump to the next spatial block. +% +% kernel (optional) = This is a one to three dimensional array that will be used to determine neighborhood operations. +% In this case, the positions in the kernel that do not equal zeros will be evaluated. +% In other words, this can be viewed as a structuring element for the neighborhood. +% This can be an empty array [] and which will use a 3x3x3 neighborhood (or equivalent given input dimension). +% +% noiseVariance (optional) = This is the expected variance of the noise. +% This should be a scalar value or an empty array []. +% +% device (optional) = Use this if you have multiple devices and want to select one explicitly. +% Setting this to [] allows the algorithm to either pick the best device and/or will try to split +% the data across multiple devices. +% +% imageOut = This will be an array of the same type and shape as the input array. +% + +function [imageOut] = WienerFilter(imageIn,kernel,noiseVariance,device) + try + [imageOut] = HIP.Cuda.WienerFilter(imageIn,kernel,noiseVariance,device); + catch errMsg + warning(errMsg.message); + [imageOut] = HIP.Local.WienerFilter(imageIn,kernel,noiseVariance,device); + end +end diff --git a/src/c/Cuda/Vec.h b/src/c/Cuda/Vec.h index 81d387c15c9bb14602e3eafd9532d15b06816f3f..647b3b489c1d4be32ad27d0bef3f3a99f3b210bb 100644 --- a/src/c/Cuda/Vec.h +++ b/src/c/Cuda/Vec.h @@ -70,7 +70,7 @@ public: {} #ifdef __CUDACC__ - template<typename V = DIM3_ELEM_TYPE, ENABLE_CHK(NON_NARROWING(T,V))> + template<typename V = DIM3_ELEM_TYPE> MIXED_PREFIX operator dim3() const { return dim3{static_cast<V>(x),static_cast<V>(y),static_cast<V>(z)}; diff --git a/src/c/HIP.so b/src/c/HIP.so new file mode 100755 index 0000000000000000000000000000000000000000..9bdf86723856c8a86b29125d01dcaba438706359 Binary files /dev/null and b/src/c/HIP.so differ diff --git a/src/c/Mex.mexa64 b/src/c/Mex.mexa64 new file mode 100755 index 0000000000000000000000000000000000000000..3def436ab95e30defbeb9c51ddb6dc741df5a108 Binary files /dev/null and b/src/c/Mex.mexa64 differ diff --git a/src/c/ScriptCmds/ScopedProcessMutex.h b/src/c/ScriptCmds/ScopedProcessMutex.h index 8b6df3d5ca71928d0fe1d492e713506435dad2c7..f30d315ec615d6c16da96d479570fbd7e7485f81 100644 --- a/src/c/ScriptCmds/ScopedProcessMutex.h +++ b/src/c/ScriptCmds/ScopedProcessMutex.h @@ -3,6 +3,7 @@ #ifdef USE_PROCESS_MUTEX #define SCOPED_PROCESS_MUTEX(Name) ScopedProcessMutex Name##_mutex(#Name) #else +#pragma message "hi friend: no process mutex" #define SCOPED_PROCESS_MUTEX(Name) #endif diff --git a/src/c/makefile b/src/c/makefile index d8c36bcaf5cffe9f0de243b2ea21ba5233a5825b..db3b80cc54d1e7b550dbf6c4bead1daf6065360b 100755 --- a/src/c/makefile +++ b/src/c/makefile @@ -1,7 +1,7 @@ ######################################### # Set these for MATLAB/Python versions ######################################### -MATALAB_DIR = /usr/local/MATLAB/R2017b +MATALAB_DIR = /usr/local/MATLAB/R2019b # NOTE: Currently only builds against python3 PYTHON_VER = python3.6m PYTHON3_INC = /usr/include/$(PYTHON_VER) @@ -111,19 +111,19 @@ $(OBJ_DIR)/%.o: Cuda/%.cpp ######################################### $(OBJ_DIR)/%.o: Mex/%.cpp @mkdir -p $(@D) - $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD -DUSE_PROCESS_MUTEX $(MEX_INC) -c $< -o $@ + $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD $(MEX_INC) -c $< -o $@ $(OBJ_DIR)/Mx%.o: ScriptCmds/%.cpp @mkdir -p $(@D) - $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD -DUSE_PROCESS_MUTEX $(MEX_INC) -c $< -o $@ + $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD $(MEX_INC) -c $< -o $@ $(OBJ_DIR)/%.o: Python/%.cpp @mkdir -p $(@D) - $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD -DUSE_PROCESS_MUTEX $(PY_INC) -c $< -o $@ + $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD $(PY_INC) -c $< -o $@ $(OBJ_DIR)/Py%.o: ScriptCmds/%.cpp @mkdir -p $(@D) - $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD -DUSE_PROCESS_MUTEX $(PY_INC) -c $< -o $@ + $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD $(PY_INC) -c $< -o $@ ######################################### # files to clean up diff --git a/src/c/makefile.nomutex b/src/c/makefile.nomutex new file mode 100755 index 0000000000000000000000000000000000000000..db3b80cc54d1e7b550dbf6c4bead1daf6065360b --- /dev/null +++ b/src/c/makefile.nomutex @@ -0,0 +1,134 @@ +######################################### +# Set these for MATLAB/Python versions +######################################### +MATALAB_DIR = /usr/local/MATLAB/R2019b +# NOTE: Currently only builds against python3 +PYTHON_VER = python3.6m +PYTHON3_INC = /usr/include/$(PYTHON_VER) +NUMPY3_INC = /usr/include/$(PYTHON_VER) +PYTHON_LIB = /usr/lib/$(PYTHON_VER)/config-3.5m-x86_64-linux-gnu + +######################################### +# Default files and include dirs +######################################### + +OBJ_DIR := Intermediate + +CU_FILES := $(wildcard Cuda/*.cu) +CUPP_FILES := $(wildcard Cuda/*.cpp) +MEX_CPP_FILES := $(filter-out Mex/_TemplateMex.cpp, $(wildcard Mex/*.cpp)) +PY_CPP_FILES := $(wildcard Python/*.cpp) +SCR_CPP_FILES := $(wildcard ScriptCmds/*.cpp) + +CUDA_OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(CU_FILES:.cu=.o))) +CUDA_CPP_OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(CUPP_FILES:.cpp=.o))) +MEX_CPP_OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(MEX_CPP_FILES:.cpp=.o))) +PY_CPP_OBJ = $(addprefix $(OBJ_DIR)/,$(notdir $(PY_CPP_FILES:.cpp=.o))) +SCRPY_CPP_OBJ = $(addprefix $(OBJ_DIR)/Py,$(notdir $(SCR_CPP_FILES:.cpp=.o))) +SCRMEX_CPP_OBJ = $(addprefix $(OBJ_DIR)/Mx,$(notdir $(SCR_CPP_FILES:.cpp=.o))) + +CUDA_INC = -I. -I./Cuda -I/usr/local/cuda/include +MEX_INC = -I. -I./Mex -I./ScriptCmds -I./external -I$(MATALAB_DIR)/extern/include +PY_INC = -I. -I./Python -I./ScriptCmds -I./external -I$(PYTHON3_INC) -I$(NUMPY3_INC) + +MEX_LIB = -L$(MATALAB_DIR)/bin/glnxa64 -lmx -lmex +PY_LIB = -L$(PYTHON_LIB) -l$(PYTHON_VER) + +######################################### +# Common parameters +######################################### +# Passed to both Nvidia compiler and gcc/clang +CPP_FLAGS = -std=c++11 -g -D_MWAITXINTRIN_H_INCLUDED + +# Passed to gcc/clang and passthrough (--compiler-options) in nvcc +# NOTE: Any warning flags such as '-Wall' should go here +C_FLAGS = -Wall -Wno-sign-compare -fopenmp -fPIC -g + +# Pass-through linker arguments (--linker-options) in nvcc linking step +LD_FLAGS = --no-undefined +######################################### +# Nvidia nvcc parameters +######################################### +NVCC_PATH = nvcc +NVCC_FLAGS = $(CPP_FLAGS) +SMODEL = -arch=sm_30 +NVCC_INC = -I/usr/include + +ifndef COMP + COMP=clang +endif + +ifeq ($(COMP),gcc) + C_COMPILER = g++ +else ifeq ($(COMP),clang) + C_COMPILER = clang++ +endif + +OMP_LIB = -lgomp +# NOTE: Some versions of clang use libiomp5 instead of libgomp +#OMP_LIB = -liomp5 + +######################################### +# gcc/g++/clang parameters +######################################### +GCC_FLAGS = $(CPP_FLAGS) $(C_FLAGS) -static +GCC_LIBS = $(OMP_LIB) + +######################################### +# all projects to build +######################################### +all: matlab python + @echo Finished compiling + +python: HIP.so + @echo Finished compiling python wrappers + +matlab: Mex.mexa64 + @echo Finished compiling matlab wrappers + +######################################### +# link it all together +######################################### +HIP.so: $(CUDA_OBJ) $(PY_CPP_OBJ) $(SCRPY_CPP_OBJ) $(CUDA_CPP_OBJ) + $(NVCC_PATH) $(GCC_LIBS) $(PY_LIB) -shared $^ -o HIP.so $(SMODEL) --linker-options '$(LD_FLAGS)' + +Mex.mexa64: $(CUDA_OBJ) $(MEX_CPP_OBJ) $(SCRMEX_CPP_OBJ) $(CUDA_CPP_OBJ) + $(NVCC_PATH) $(GCC_LIBS) $(MEX_LIB) -shared $^ -o Mex.mexa64 $(SMODEL) --linker-options '$(LD_FLAGS)' + +######################################### +# compile the cuda library files +######################################### +$(OBJ_DIR)/%.o: Cuda/%.cu + @mkdir -p $(@D) + $(NVCC_PATH) $(NVCC_FLAGS) $(CUDA_INC) $(SMODEL) --compiler-options '$(C_FLAGS)' -c $< -o $@ $(NVCC_INC) -dc + +$(OBJ_DIR)/%.o: Cuda/%.cpp + @mkdir -p $(@D) + $(C_COMPILER) $(GCC_FLAGS) $(CUDA_INC) -c $< -o $@ + +######################################### +# compile the mex/python wrappers +######################################### +$(OBJ_DIR)/%.o: Mex/%.cpp + @mkdir -p $(@D) + $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD $(MEX_INC) -c $< -o $@ + +$(OBJ_DIR)/Mx%.o: ScriptCmds/%.cpp + @mkdir -p $(@D) + $(C_COMPILER) $(GCC_FLAGS) -DMEX_BUILD $(MEX_INC) -c $< -o $@ + +$(OBJ_DIR)/%.o: Python/%.cpp + @mkdir -p $(@D) + $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD $(PY_INC) -c $< -o $@ + +$(OBJ_DIR)/Py%.o: ScriptCmds/%.cpp + @mkdir -p $(@D) + $(C_COMPILER) $(GCC_FLAGS) -DPY_BUILD $(PY_INC) -c $< -o $@ + +######################################### +# files to clean up +######################################### +clean: + @echo Cleaning + rm -f $(OBJ_DIR)/*.o + rm -f Mex.mexa64 HIP.so