あなたの質問を完全に誤解している可能性があります。その場合はお詫び申し上げます。しかし、実際には次の 3 つの方法のいずれかが必要だと思います。方法 3 は、あなたが提供した例によく似た画像を提供することに注意してください...しかし、私は非常に異なるルートでそこにたどり着きました(sphere
コマンドをまったく使用せず、直接作業して「内側のボクセル」と「外側のボクセル」を計算します)中心からの距離で)。3 番目の画像と比べて 2 番目の画像を反転させた方が見栄えが良いので、球をゼロで埋めると、ほとんど黒い円盤のように見えます。

%% method 1: find the coordinates, and histogram them
[x y z]=sphere(200);
xv = linspace(-1,1,40);
[xh xc]=histc(x(:), xv);
[yh yc]=histc(y(:), xv);
% sum the occurrences of coordinates using sparse:
sm = sparse(xc, yc, ones(size(xc)));
sf = full(sm);
figure;
subplot(1,3,1);
imagesc(sf); axis image; axis off
caxis([0 sf(19,19)]) % add some clipping
title 'projection of point density'
%% method 2: fill a sphere and add its volume elements:
xv = linspace(-1,1,100);
[xx yy zz]=meshgrid(xv,xv,xv);
rr = sqrt(xx.^2 + yy.^2 + zz.^2);
vol = zeros(numel(xv)*[1 1 1]);
vol(rr<1)=1;
proj = sum(vol,3);
subplot(1,3,2)
imagesc(proj); axis image; axis off; colormap gray
title 'projection of volume'
%% method 3: visualize just a thin shell:
vol2 = ones(numel(xv)*[1 1 1]);
vol2(rr<1) = 0;
vol2(rr<0.95)=1;
projShell = sum(vol2,3);
subplot(1,3,3);
imagesc(projShell); axis image; axis off; colormap gray
title 'projection of a shell'