Pratik,
I do not know of a command that would let you do this. One possible solution is to start with the equation of you sphere/ellipsoid. I am going to use a sphere of the form x^2+y^2+z^2=R^2. x and y are the coordinates of the specific image, and z would correspond to the image. You could then loop through each coordinate in the stack by
s=size(stack);
width=s(1);
leng=s(2);
depth=s(3);
R=3;
tolerance=0.01;
for x=1:width
for y=1:leng
for z=1:depth
if(x^2+y^2+z^2-R^2<tolerance)
stack(x,y,z)=7;
end
end
end
end
You would put a 7 or whatever value whenever x^2+y^2+z^2-R^2=0, but since that will almost never happen, define some tolerance for it to be true under. Won't give you a perfect sphere or ellipsoid and is rather ineffecient, but could work.