Commit 222dce71 authored by Andrew Cohen's avatar Andrew Cohen

rebuilt agains cuda 9.1

parent 32d38de7
% Closure - This kernel will dilate follow by an erosion. % Closure - This kernel will dilate follow by an erosion.
% arrayOut = HIP.Cuda.Closure(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.Closure(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = Closure(arrayIn,kernel,numIterations,device) function arrayOut = Closure(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('Closure',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('Closure',arrayIn,kernel,numIterations,device);
end end
classdef (Abstract,Sealed) Cuda classdef (Abstract,Sealed) Cuda
methods (Static) methods (Static)
commandInfo = Info() commandInfo = Info()
Help(command) Help(command)
[numCudaDevices,memoryStats] = DeviceCount() [numCudaDevices,memoryStats] = DeviceCount()
deviceStatsArray = DeviceStats() deviceStatsArray = DeviceStats()
arrayOut = Closure(arrayIn,kernel,numIterations,device) arrayOut = Closure(arrayIn,kernel,numIterations,device)
arrayOut = ElementWiseDifference(array1In,array2In,device) arrayOut = ElementWiseDifference(array1In,array2In,device)
arrayOut = EntropyFilter(arrayIn,kernel,device) arrayOut = EntropyFilter(arrayIn,kernel,device)
arrayOut = Gaussian(arrayIn,sigmas,numIterations,device) arrayOut = Gaussian(arrayIn,sigmas,numIterations,device)
[minValue,maxValue] = GetMinMax(arrayIn,device) [minValue,maxValue] = GetMinMax(arrayIn,device)
arrayOut = HighPassFilter(arrayIn,sigmas,device) arrayOut = HighPassFilter(arrayIn,sigmas,device)
arrayOut = LoG(arrayIn,sigmas,device) arrayOut = LoG(arrayIn,sigmas,device)
arrayOut = MaxFilter(arrayIn,kernel,numIterations,device) arrayOut = MaxFilter(arrayIn,kernel,numIterations,device)
arrayOut = MeanFilter(arrayIn,kernel,numIterations,device) arrayOut = MeanFilter(arrayIn,kernel,numIterations,device)
arrayOut = MedianFilter(arrayIn,kernel,numIterations,device) arrayOut = MedianFilter(arrayIn,kernel,numIterations,device)
arrayOut = MinFilter(arrayIn,kernel,numIterations,device) arrayOut = MinFilter(arrayIn,kernel,numIterations,device)
[minOut,maxOut] = MinMax(arrayIn,device) [minOut,maxOut] = MinMax(arrayIn,device)
arrayOut = MultiplySum(arrayIn,kernel,numIterations,device) arrayOut = MultiplySum(arrayIn,kernel,numIterations,device)
arrayOut = Opener(arrayIn,kernel,numIterations,device) arrayOut = Opener(arrayIn,kernel,numIterations,device)
arrayOut = StdFilter(arrayIn,kernel,numIterations,device) arrayOut = StdFilter(arrayIn,kernel,numIterations,device)
valueOut = Sum(arrayIn,device) valueOut = Sum(arrayIn,device)
arrayOut = VarFilter(arrayIn,kernel,numIterations,device) arrayOut = VarFilter(arrayIn,kernel,numIterations,device)
arrayOut = WienerFilter(arrayIn,kernel,noiseVariance,device) arrayOut = WienerFilter(arrayIn,kernel,noiseVariance,device)
end end
methods (Static, Access = private) methods (Static, Access = private)
varargout = Mex(command, varargin) varargout = Mex(command, varargin)
end end
end end
% DeviceCount - This will return the number of Cuda devices available, and their memory. % DeviceCount - This will return the number of Cuda devices available, and their memory.
% [numCudaDevices,memoryStats] = HIP.Cuda.DeviceCount() % [numCudaDevices,memoryStats] = HIP.Cuda.DeviceCount()
% NumCudaDevices -- this is the number of Cuda devices available. % NumCudaDevices -- this is the number of Cuda devices available.
% MemoryStats -- this is an array of structures where each entry corresponds to a Cuda device. % 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. % The memory structure contains the total memory on the device and the memory available for a Cuda call.
function [numCudaDevices,memoryStats] = DeviceCount() function [numCudaDevices,memoryStats] = DeviceCount()
[numCudaDevices,memoryStats] = HIP.Cuda.Mex('DeviceCount'); [numCudaDevices,memoryStats] = HIP.Cuda.Mex('DeviceCount');
end end
% DeviceStats - This will return the statistics of each Cuda capable device installed. % DeviceStats - This will return the statistics of each Cuda capable device installed.
% deviceStatsArray = HIP.Cuda.DeviceStats() % deviceStatsArray = HIP.Cuda.DeviceStats()
% DeviceStatsArray -- this is an array of structs, one struct per device. % 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. % The struct has these fields: name, major, minor, constMem, sharedMem, totalMem, tccDriver, mpCount, threadsPerMP, warpSize, maxThreads.
function deviceStatsArray = DeviceStats() function deviceStatsArray = DeviceStats()
[deviceStatsArray] = HIP.Cuda.Mex('DeviceStats'); [deviceStatsArray] = HIP.Cuda.Mex('DeviceStats');
end end
% ElementWiseDifference - This subtracts the second array from the first, element by element (A-B). % ElementWiseDifference - This subtracts the second array from the first, element by element (A-B).
% arrayOut = HIP.Cuda.ElementWiseDifference(array1In,array2In,[device]) % arrayOut = HIP.Cuda.ElementWiseDifference(array1In,array2In,[device])
% image1In = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = ElementWiseDifference(array1In,array2In,device) function arrayOut = ElementWiseDifference(array1In,array2In,device)
[arrayOut] = HIP.Cuda.Mex('ElementWiseDifference',array1In,array2In,device); [arrayOut] = HIP.Cuda.Mex('ElementWiseDifference',array1In,array2In,device);
end end
% EntropyFilter - This calculates the entropy within the neighborhood given by the kernel. % EntropyFilter - This calculates the entropy within the neighborhood given by the kernel.
% arrayOut = HIP.Cuda.EntropyFilter(arrayIn,kernel,[device]) % arrayOut = HIP.Cuda.EntropyFilter(arrayIn,kernel,[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = EntropyFilter(arrayIn,kernel,device) function arrayOut = EntropyFilter(arrayIn,kernel,device)
[arrayOut] = HIP.Cuda.Mex('EntropyFilter',arrayIn,kernel,device); [arrayOut] = HIP.Cuda.Mex('EntropyFilter',arrayIn,kernel,device);
end end
% Gaussian - Gaussian smoothing. % Gaussian - Gaussian smoothing.
% arrayOut = HIP.Cuda.Gaussian(arrayIn,sigmas,[numIterations],[device]) % arrayOut = HIP.Cuda.Gaussian(arrayIn,sigmas,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = Gaussian(arrayIn,sigmas,numIterations,device) function arrayOut = Gaussian(arrayIn,sigmas,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('Gaussian',arrayIn,sigmas,numIterations,device); [arrayOut] = HIP.Cuda.Mex('Gaussian',arrayIn,sigmas,numIterations,device);
end end
% GetMinMax - This function finds the lowest and highest value in the array that is passed in. % GetMinMax - This function finds the lowest and highest value in the array that is passed in.
% [minValue,maxValue] = HIP.Cuda.GetMinMax(arrayIn,[device]) % [minValue,maxValue] = HIP.Cuda.GetMinMax(arrayIn,[device])
% imageIn = This is a one to five dimensional array. % imageIn = This is a one to five dimensional array.
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% minValue = This is the lowest value found in the array. % minValue = This is the lowest value found in the array.
% maxValue = This is the highest value found in the array. % maxValue = This is the highest value found in the array.
function [minValue,maxValue] = GetMinMax(arrayIn,device) function [minValue,maxValue] = GetMinMax(arrayIn,device)
[minValue,maxValue] = HIP.Cuda.Mex('GetMinMax',arrayIn,device); [minValue,maxValue] = HIP.Cuda.Mex('GetMinMax',arrayIn,device);
end end
% Help - Help on a specified command. % Help - Help on a specified command.
% HIP.Cuda.Help(command) % HIP.Cuda.Help(command)
% Print detailed usage information for the specified command. % Print detailed usage information for the specified command.
function Help(command) function Help(command)
HIP.Cuda.Mex('Help',command); HIP.Cuda.Mex('Help',command);
end end
% HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided. % HighPassFilter - Filters out low frequency by subtracting a Gaussian blurred version of the input based on the sigmas provided.
% arrayOut = HIP.Cuda.HighPassFilter(arrayIn,sigmas,[device]) % arrayOut = HIP.Cuda.HighPassFilter(arrayIn,sigmas,[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = HighPassFilter(arrayIn,sigmas,device) function arrayOut = HighPassFilter(arrayIn,sigmas,device)
[arrayOut] = HIP.Cuda.Mex('HighPassFilter',arrayIn,sigmas,device); [arrayOut] = HIP.Cuda.Mex('HighPassFilter',arrayIn,sigmas,device);
end end
% Info - Get information on all available mex commands. % Info - Get information on all available mex commands.
% commandInfo = HIP.Cuda.Info() % commandInfo = HIP.Cuda.Info()
% Returns commandInfo structure array containing information on all mex commands. % Returns commandInfo structure array containing information on all mex commands.
% commandInfo.command - Command string % commandInfo.command - Command string
% commandInfo.outArgs - Cell array of output arguments % commandInfo.outArgs - Cell array of output arguments
% commandInfo.inArgs - Cell array of input arguments % commandInfo.inArgs - Cell array of input arguments
% commandInfo.helpLines - Cell array of input arguments % commandInfo.helpLines - Cell array of input arguments
function commandInfo = Info() function commandInfo = Info()
[commandInfo] = HIP.Cuda.Mex('Info'); [commandInfo] = HIP.Cuda.Mex('Info');
end end
% LoG - Apply a Lapplacian of Gaussian filter with the given sigmas. % LoG - Apply a Lapplacian of Gaussian filter with the given sigmas.
% arrayOut = HIP.Cuda.LoG(arrayIn,sigmas,[device]) % arrayOut = HIP.Cuda.LoG(arrayIn,sigmas,[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = LoG(arrayIn,sigmas,device) function arrayOut = LoG(arrayIn,sigmas,device)
[arrayOut] = HIP.Cuda.Mex('LoG',arrayIn,sigmas,device); [arrayOut] = HIP.Cuda.Mex('LoG',arrayIn,sigmas,device);
end end
% MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. % MaxFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel.
% arrayOut = HIP.Cuda.MaxFilter(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.MaxFilter(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = MaxFilter(arrayIn,kernel,numIterations,device) function arrayOut = MaxFilter(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('MaxFilter',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('MaxFilter',arrayIn,kernel,numIterations,device);
end end
% MeanFilter - This will take the mean of the given neighborhood. % MeanFilter - This will take the mean of the given neighborhood.
% arrayOut = HIP.Cuda.MeanFilter(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.MeanFilter(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = MeanFilter(arrayIn,kernel,numIterations,device) function arrayOut = MeanFilter(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('MeanFilter',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('MeanFilter',arrayIn,kernel,numIterations,device);
end end
% MedianFilter - This will calculate the median for each neighborhood defined by the kernel. % MedianFilter - This will calculate the median for each neighborhood defined by the kernel.
% arrayOut = HIP.Cuda.MedianFilter(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.MedianFilter(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = MedianFilter(arrayIn,kernel,numIterations,device) function arrayOut = MedianFilter(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('MedianFilter',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('MedianFilter',arrayIn,kernel,numIterations,device);
end end
% MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel. % MinFilter - This will set each pixel/voxel to the max value of the neighborhood defined by the given kernel.
% arrayOut = HIP.Cuda.MinFilter(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.MinFilter(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = MinFilter(arrayIn,kernel,numIterations,device) function arrayOut = MinFilter(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('MinFilter',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('MinFilter',arrayIn,kernel,numIterations,device);
end end
% MinMax - This returns the global min and max values. % MinMax - This returns the global min and max values.
% [minOut,maxOut] = HIP.Cuda.MinMax(arrayIn,[device]) % [minOut,maxOut] = HIP.Cuda.MinMax(arrayIn,[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% minOut = This is the minimum value found in the input. % minOut = This is the minimum value found in the input.
% maxOut = This is the maximum value found in the input. % maxOut = This is the maximum value found in the input.
function [minOut,maxOut] = MinMax(arrayIn,device) function [minOut,maxOut] = MinMax(arrayIn,device)
[minOut,maxOut] = HIP.Cuda.Mex('MinMax',arrayIn,device); [minOut,maxOut] = HIP.Cuda.Mex('MinMax',arrayIn,device);
end end
% MultiplySum - Multiplies the kernel with the neighboring values and sums these new values. % MultiplySum - Multiplies the kernel with the neighboring values and sums these new values.
% arrayOut = HIP.Cuda.MultiplySum(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.MultiplySum(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = MultiplySum(arrayIn,kernel,numIterations,device) function arrayOut = MultiplySum(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('MultiplySum',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('MultiplySum',arrayIn,kernel,numIterations,device);
end end
% Opener - This kernel will erode follow by a dilation. % Opener - This kernel will erode follow by a dilation.
% arrayOut = HIP.Cuda.Opener(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.Opener(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = Opener(arrayIn,kernel,numIterations,device) function arrayOut = Opener(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('Opener',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('Opener',arrayIn,kernel,numIterations,device);
end end
% StdFilter - This will take the standard deviation of the given neighborhood. % StdFilter - This will take the standard deviation of the given neighborhood.
% arrayOut = HIP.Cuda.StdFilter(arrayIn,kernel,[numIterations],[device]) % arrayOut = HIP.Cuda.StdFilter(arrayIn,kernel,[numIterations],[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 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. % 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. % 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. % This is useful for growing regions by the shape of the structuring element or for very large neighborhoods.
% Can be empty an array []. % Can be empty an array [].
% %
% device (optional) = Use this if you have multiple devices and want to select one explicitly. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %
% imageOut = This will be an array of the same type and shape as the input array. % imageOut = This will be an array of the same type and shape as the input array.
function arrayOut = StdFilter(arrayIn,kernel,numIterations,device) function arrayOut = StdFilter(arrayIn,kernel,numIterations,device)
[arrayOut] = HIP.Cuda.Mex('StdFilter',arrayIn,kernel,numIterations,device); [arrayOut] = HIP.Cuda.Mex('StdFilter',arrayIn,kernel,numIterations,device);
end end
% Sum - This sums up the entire array in. % Sum - This sums up the entire array in.
% valueOut = HIP.Cuda.Sum(arrayIn,[device]) % valueOut = HIP.Cuda.Sum(arrayIn,[device])
% imageIn = This is a one to five dimensional array. The first three dimensions are treated as spatial. % 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 % The spatial dimensions will have the kernel applied. The last two dimensions will determine
% how to stride or jump to the next spatial block. % 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. % 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 % Setting this to [] allows the algorithm to either pick the best device and/or will try to split
% the data across multiple devices. % the data across multiple devices.
% %