function sphere = fbs_buildSphere(mapping,center,radius,vdim)
if radius == 0
    sphere = center;
    return
end

iVoxel = 1;
% returns the IDs within Sphere
coord = mapping.indexToCoordMap.get(center);

vxrad = ceil((radius*ones(1,3))./(ones(1,1)*vdim))';

[x y z] = ndgrid(-vxrad(1,iVoxel):sign(vdim(1)):vxrad(1,iVoxel), ...
    -vxrad(2,iVoxel):sign(vdim(2)):vxrad(2,iVoxel), ...
    -vxrad(3,iVoxel):sign(vdim(3)):vxrad(3,iVoxel));
sel = (x./vxrad(1,iVoxel)).^2 + (y./vxrad(2,iVoxel)).^2 + ...
    (z./vxrad(3,iVoxel)).^2 <= 1;

x = coord(1,1)+x(sel(:));
y = coord(2,1)+y(sel(:));
z = coord(3,1)+z(sel(:));

sphere = [];
for iCoord = 1:size(x,1);
       key = java.util.Vector(3,0);
        key.add(0,x(iCoord));
        key.add(1,y(iCoord));
        key.add(2,z(iCoord));
    id = mapping.coordToIndexMap.get(key);
    sphere = [sphere id];
end

end