Make an ellipsoid mask inside a material

i need to create an ellipsoid mask, inscribed in a box with a material. The input will be the center of the box and the 3 dimension x,y,z. Anyone know how to do it?
Thank you!

I’ve made the ellipsoid mask like this:

I don’t know if there is a better way to do it, i’m not a programmer , but it’s work fine :slight_smile: