Skip to content
Snippets Groups Projects
Commit 146df914 authored by sundar's avatar sundar
Browse files

MaxFilterEllipsoid implementation

parent 49446824
No related branches found
No related tags found
No related merge requests found
function imageOut = MaxFilterEllipsoid(image1,radius,device,useMatlab)
% This will set each pixel/voxel to the min value of an ellipsoidal neighborhood with the radii given.
if (~exist('device','var') || isempty(device))
device = 1;
end
if (~exist('useMatlab','var') || isempty(useMatlab))
useMatlab = false;
end
if (~useMatlab)
[numCudaDevices, memoryStats] = CudaMex('DeviceCount');
if (numCudaDevices < 1)
useMatlab = true;
elseif (device > numCudaDevices)
device = numCudaDevices;
end
% do something smart here if there is not enough memory...
end
if (useMatlab)
[x,y,z] = ndgrid(-radius:radius);
se = strel(sqrt(x.^2 + y.^2 + z.^2) <= radius);
imageOut = imdilate(image1, se);
else
radiusZ = 3; radiusY = radiusZ; radiusX = radiusY;
imageOut = CudaMex('MaxFilterEllipsoid',image1,[radiusX,radiusY,radiusZ],device);
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment