Thank you all for the help. I have implemented a function that creates the mask used by imageJ for a given radius. Here is the code for anyone who is interested:

```
function[kMask] = ijRadMask(radius)
% IJRADMASK get mask for imerode/imdilate which is identical to the one
% used by imageJ for erosion/dilation
% input: radius in pixels to be eroded/dilated
% output: disk mask for erosion/dilation
r2 = floor(radius^2 + 1); %simulate java int conversion
kRadius = int32(floor(sqrt(r2 + 1e-10)));
kernel = int32(zeros(kRadius + 1, 1));
kernel(kRadius + 1) = kRadius; %set kernel center
for y = 1:double(kRadius) %make kernel
dx = int32(floor(sqrt(r2 - y^2 + 1e-10)));
kernel((kRadius + 1) - y) = dx;
end
kMask = zeros(kRadius*2 + 1); %mask for filter
kHeight = 2*kRadius + 2;
mCenter = kRadius + 1;
kMask(mCenter, 1:size(kMask, 2)) = 1; %horizontal line through center
for i = 1:(size(kernel, 1) - 1)
kMask(i, (mCenter - kernel(i)):mCenter + kernel(i)) = 1;
kMask(kHeight - i, (mCenter - kernel(i)):mCenter + kernel(i)) = 1;
end
end
```